Operating Systems

Download Report

Transcript Operating Systems

Operating Systems
• Operating System
– Program in software and firmware that directly
communicates with hardware
– Services of
• Resource management – efficient, secure use of resources
– CPU, memory, peripheral devices, data
• User friendliness
– Virtualization- virtualizes machine, devices, GUI interface
» In contrast, for example, to coding hardware addresses
– Abstraction – user (and other software) need not know details
of implementation
» In contrast to, say, early days of programmer coding overlays
Intro to CS Chpt 3 Operating
Systems
1
Types of Operating Systems
• General purpose operating systems (in laptops,
mainframes, etc.)
– Windows
What are the issues of one OS dominating the market?
– Linux, UNIX, Solaris, MacOS (Lion)
– IBM’s Z series
• (Hard) Real-time operating systems
– Virtualization is less important that real-time constraints
– Resource heavy to guarantee response time
– OS functions are minimized
Intro to CS Chpt 3 Operating
Systems
2
Mobile and embedded OS
• OS for sensor networks (e.g.,TinyOS),
cash registers and GPS (e.g,.,WEPOS),
• Smart phones
– iOS, Android, webOS, Blackberry
– Convergence of technologies
•
•
•
•
Wireless LAN (802.11) and Internet browsing
Video and images
Camera
Telephony (VoIP)
Intro to CS Chpt 3 Operating
Systems
3
History of OS
• 1940s
– Programmer was OS
– Programmer signed up for use of computer
– Loaded data into cells, wired machine, set
switches, read data from cells
– Input/output was most tedious and repetitive
of tasks
• early operating systems were I/O monitors
Intro to CS Chpt 3 Operating
Systems
4
History of OS
• 1950s Batch processing
– OS accepted batch of jobs
• Program, data, job control language, & compiler to
translate the program were submitted in batch typically
as groups of punched cards
• Jobs were queued for acceptance by OS
– Error in JCL would abort job before it began
• Multiprogramming
• Interactive programming
Intro to CS Chpt 3 Operating
Systems
5
History of OS
• Soft real-time processing
– Time-sharing to enable interactive processing
• CPU switches so quickly between users that each thinks
that he has the entire use of the machine
– Transaction processing, multi-media
• Hard real-time systems – control systems
• Personal Computers
– Development of PC OS paralleled that of earlier
machines
Intro to CS Chpt 3 Operating
Systems
6
History of OS
• Multiprocessing
– Most general purpose computers today have
multiple processors (cores)
– Shared memory
– Dispatch list may be shared by processors
• Distributed systems
– Network of computers
– Single OS distributed on all computers
– Ex: The Internet (TCP/IP is the OS)
Intro to CS Chpt 3 Operating
Systems
7
History of OS
• Wireless and Mobile OS
– Wireless LANs
• IEEE 802.11
– SmartPhones
• Android, iOS, Blackberry, Windows Phone
• The Cloud
• Programs executed, data stored (& replicated) on
Internet; users can “lease” storage, processing
capability, applications according to their needs
• MOBILITY
Intro to CS Chpt 3 Operating
Systems
8
Software Classification
Software
/
\
Applications
System
/
\
utilities
OS
/ \
user interface kernel
Text figure 3.3
Intro to CS Chpt 3 Operating
Systems
9
Software
• Application software
– Programs that perform user work; interact with
users
– Examples: Spreadsheets, word processing,
database programs, games, photoshop, CAD/CAM
• System software
– Services for application software to aid in control
of hardware, provide security, monitor system
– Examples: firewalls, compilers
Intro to CS Chpt 3 Operating
Systems
10
Utility Programs
• Operations performed on behalf of the OS but
not an integral part of its performance
–
–
–
–
–
Formatting, defragmenting a disk
Most file operations
Network communications
Internet browsing
Distinction between utility programs (system
software) and application programs is not always
clear
Intro to CS Chpt 3 Operating
Systems
11
OS Resource Management
• Process management
– Create, schedule, delete processes (and threads)
– Process synchronization
– Interprocess communication
• (Main) Memory management
– Allocate, deallocate main memory
– Protect memory
– Support “Virtual memory”
• File management
– Manage mass storage facilities; create, delete files
– Supports directories, subdirectories
• Device (Peripherals) management
– Manage interrupts
– Device drivers that communicate with controllers
Intro to CS Chpt 3 Operating
Systems
12
Shell/ command interpreter
• In modern OS, the user interface (shell) is
classified as a user program (runs with user
privileges)
– Shell creates user environment
• May use GUI (graphical user interface) for
communication through clicks of a mouse
• UNIX environments allow user to modify shell
• Windows users modify their GUI by, for example,
adding icons to the desktop
– Interprets user commands
Intro to CS Chpt 3 Operating
Systems
13
Question
• Go to Windows command mode and type
dir
• See flag options on dir by typing
dir/?
• Check the data management options
In UNIX or Windows PowerShell, try ls
man ls (manual information on “ls”)
Intro to CS Chpt 3 Operating
Systems
14
Boot strapping the computer
• Main memory is volatile, but must maintain the
kernel of the operating system
• When system is powered on, a small boot program,
typically stored in ROM, is executed
– Program begins the process of bringing into memory the
remainder of the OS, usually from hard disk
– Control is then transferred to BIOS to find and configure
hardware
• Note that special purpose computers have all of the
(typically small) OS permanently stored in ROM
Intro to CS Chpt 3 Operating
Systems
15
BIOS
• Basic input/output activities may be stored
in ROM/PROM/EPROM/ flash memory
– BIOS does i/o before the OS has been given
control
– Can report errors occurring during boot
– Ability to do i/o is important after a disk crash
– Can be stored on flash memory chip, allowing
changes to be made (i.e., flash BIOS)
Intro to CS Chpt 3 Operating
Systems
16
Process
• Process is a program (or part of a program) in
execution. Process changes state as it executes.
• This state is saved, perhaps in Process Control Block
– For Windows, press Cntl Alt Del or Cntl Shft Esc
to get task list or type taskmgr in Windows search
bar; see all the processes {check show processes
from all users} that are in a state of execution.
• Each process has a unique PID
• Note the other tabs and fields
• Click view tab to see other fields
Intro to CS Chpt 3 Operating
Systems
17
Time-sharing with processes
• In time-sharing systems each process is
assigned a maximum time slice
– This may vary for different processes
– Many processes release the CPU before the
maximum assigned time is exceeded
• Perhaps because they request an input or output
• i/o requires a call to the OS, which will schedule a different
process while OS handles i/o
– Others must be forcibly removed from the CPU
– In either case, the process’s state, including register
values (specifically PC), must be saved to allow it to
continue from where it was interrupted.
Intro to CS Chpt 3 Operating
Systems
18
Advantages and Disadvantages of
time-sharing
• Disadvantages
– Overhead in context switching
– More complicated OS
• Advantages
– User friendly – user thinks it has its own CPU; faster
average response
– Guaranteed that no process holds CPU forever
– Most processes release CPU early for I/O and
another process can use CPU while the first process
is waiting for i/o completion (this is true in batch
multiprogramming as well).
Intro to CS Chpt 3 Operating
Systems
19
Interrupts
• The next instruction to be executed is determined by
the value in the PC
– What if a process is executing an infinite loop?
• It will keep placing the same values in the PC
– How can a process be forcibly removed from CPU?
• Generate an interrupt to place the address of an OS instruction (first
instruction of an interrupt handler (ISR)) in PC
• Interrupts were developed to allow the processor to
be freed from much of the I/O control
– General purpose I/O processors implement I/O and send
interrupt to CPU when they have completed
• A clock interrupt controls time slices
Intro to CS Chpt 3 Operating
Systems
20
Interrupt sequence
• Device sends signal (IRQ) to Interrupt Register or
(Advanced Programmable) Interrupt Controller
– Device Manager, view, resources by type, IRQ.
• Interrupts are handled in priority order
– Hardware saves current value of the PC (typically it is placed on
the system stack)
– Hardware places address of Interrupt Handler in PC
• ISR saves register values, handles interrupt, probably
restores register values, transfers to OS
• OS restores interrupted process (or chooses another
ready process)
• Software interrupts (e.g., division by 0) are handled
similarly
Intro to CS Chpt 3 Operating
Systems
21
Competition between processes
• Multitasking in general and time-sharing in
particular enables interruption of
processes that are sharing resources
– What if one process is printing to a printer and
exceeds its time slice; then another process
starts executing and printing
• The result is incorrect for both processes
• Multi-core architecture also enables
interleaved access to memory
Intro to CS Chpt 3 Operating
Systems
22
Problems in Competition
Synchronization
• Inconsistent resource state can occur if access
to shared resource is interleaved
– Code to shared resource is called critical section
– Resources are locked to prevent incorrect use
• Locks enable resource deadlock
– A state containing a set of processes that each hold
(non shareable and non preemptable) resources
while requesting a resource held by another
process in the set
Intro to CS Chpt 3 Operating
Systems
23
Security Services
• Security systems must control vulnerabilities that
lead to system failures such as incorrect data,
erased disks, loss of confidentiality, denial of
service
– Inadvertent failures tend to be random (typically
handled by system backups)
– Malicious attacks are more difficult to control
• Frequently the attacker is an insider who knows the
vulnerabilities of the system
– Misuse of granted authority
• Outsiders can misuse a lot of information that is obtainable
on the Internet
Intro to CS Chpt 3 Operating
Systems
24
Security Services
• Authentication
– Procedure to verify account owners
• Login procedure
– Password policy; social engineering
• More complex procedures
• Authorization
– Each user is allocated specific rights to resources
• Auditing software
– Intrusion detection systems to identify unusual behavior;
sniffing software
• ISO defined basic assurances of CIA – confidentiality,
integrity, availability
• Confidentiality: assure no unauthorized access to information
- encryption mechanism (algorithm, key exchange)
Intro to CS Chpt 3 Operating
Systems
25
Some hardware security (and
protection) features
• Memory protection
– Bounds registers; virtual memory bounds
– Protection of system stack from buffer overflow
• Privileged instructions
– All instructions execute in either user or supervisor
mode
– Only the system administrator can execute
instructions to devices, memory, processor
Intro to CS Chpt 3 Operating
Systems
26
Question
• List three personal computer OS
– Windows (XP, 7, 8)
– Apple MacOS X (Leopard, Lion)
– Linux (Fedora, Ubuntu)
Intro to CS Chpt 3 Operating
Systems
27
Question
• List two types of user interfaces to the
operating system
– Command line
– GUI (graphical user interface)
Intro to CS Chpt 3 Operating
Systems
28
Question
• Which Operating System has the greatest
share of the PC market?
• Which Operating System has the greatest
share of the SmartPhone market?
Intro to CS Chpt 3 Operating
Systems
29
Question
List some mainframe Operating Systems
UNIX
Z series of IBM mainframe
e.g. z/OS, z/VM, and z/VSE
Solaris
Intro to CS Chpt 3 Operating
Systems
30
Question
• Which of the following are operating
system functions?
A) Process control
B) Hardware control
C) Word processing
– Ans. A and B
Intro to CS Chpt 3 Operating
Systems
31