operating systems -ch1-f08
TRANSCRIPT
-
8/2/2019 Operating Systems -ch1-F08
1/58
1
Operating Systems
408351 Section 1
4 October 2009
-
8/2/2019 Operating Systems -ch1-F08
2/58
Chapter 1 Operating Systems 2
Chapter 1: Introduction
What is an Operating System?
What Operating Systems Do
Computer-System Organization
Computer-System Architecture
Operating-System Structure
Operating-System Operations
Process Management, Memory Management, Storage Management Protection and Security
Mainframe Systems
Desktop Systems
Multiprocessor Systems
Distributed Systems
Clustered System
Real -Time Systems
Handheld Systems
Special-Purpose Systems
Computing Environments
-
8/2/2019 Operating Systems -ch1-F08
3/58
Chapter 1 Operating Systems 3
Objectives
To provide a grand tour of the major operatingsystems components
To provide coverage of basic computer systemorganization
-
8/2/2019 Operating Systems -ch1-F08
4/58
Chapter 1 Operating Systems 4
Computer Software
Software
Application
Software
System
Software
Compilers Operating System Assembler
Virtual File I/O Device
Memory System Driver
Process
Management
LaTex Word Games
-
8/2/2019 Operating Systems -ch1-F08
5/58
Chapter 1 Operating Systems 5
What is an Operating System?
A program that acts as an intermediarybetween a user of a computer and thecomputer hardware.
Operating system goals:
Execute user programs and makesolving user problems easier.
Make the computer systemconvenient to use.
Use the computer hardware in anefficient manner.
-
8/2/2019 Operating Systems -ch1-F08
6/58
Chapter 1 Operating Systems 6
Computer System Components
1. Hardware provides basic computingresources (CPU, memory, I/O devices).
2. Operating system controls and coordinatesthe use of the hardware among the various
application programs for the various users.3. Applications programs define the ways in
which the system resources are used to solvethe computing problems of the users(compilers, database systems, video games,business programs).
4. Users (people, machines, other computers).
-
8/2/2019 Operating Systems -ch1-F08
7/58
Chapter 1 Operating Systems 7
Four Components of a Computer System
-
8/2/2019 Operating Systems -ch1-F08
8/58
Chapter 1 Operating Systems 8
Operating System Definitions
No universally accepted definition Resource allocator manages and allocates resources.
Decides between conflicting requests for efficient andfair resource use
Control program Controls execution of programs to
prevent errors and improper use of the computer.
Kernel the one program running at all times (all elsebeing application programs).
As a virtual machine: Operating system provides a"new" machine. Allows many users to believe theyhave an entire piece of hardware to themselves
-
8/2/2019 Operating Systems -ch1-F08
9/58
Chapter 1 Operating Systems 9
Computer Startup
bootstrap program is loaded at power-up orreboot
Typically stored in ROM or EPROM, generallyknown as firmware
Initializates all aspects of system Loads operating system kernel and starts
execution
-
8/2/2019 Operating Systems -ch1-F08
10/58
Chapter 1 Operating Systems 10
Computer System Organization
Computer-system operation
One or more CPUs, device controllersconnect through common bus providingaccess to shared memory
Concurrent execution of CPUs and devicescompeting for memory cycles
-
8/2/2019 Operating Systems -ch1-F08
11/58
Chapter 1 Operating Systems 11
Computer-System Operation
I/O devices and the CPU can executeconcurrently.
Each device controller is in charge of aparticular device type.
Each device controller has a local buffer. CPU moves data from/to main memory to/from
local buffers
I/O is from the device to local buffer of
controller.Device controller informs CPU that it has
finished its operation by causing an interrupt.
-
8/2/2019 Operating Systems -ch1-F08
12/58
Chapter 1 Operating Systems 12
Why are operating systems important?
Use up a small percentage of the CPU time, but supports many
machines all the time. They perform more functions for more users than any other
program. They are necessary for any use of the computer.
When "the (operating) system" is down, the computer is down. They are used by many users. Lifetime - the systems remain
around longer than the programmers who wrote them. Complexity - the system must do difficult things.
Deal with ugly I/O devices, multiplexing-juggling act, handleerrors (hard!).
Asynchronous - must do several things at once. Handles interrupts, and must change what it is doing
thousands of times a second - and still get work done.
General purpose - must do many different things. Run Doom, Java, Fortran, Lisp, Trek, Databases, Web Servers,
etc. Everybody wants their stuff to run well. Need to adapt to changes very well: New devices, processors,
applications.
-
8/2/2019 Operating Systems -ch1-F08
13/58
Chapter 1 Operating Systems 13
Device-Status Table
-
8/2/2019 Operating Systems -ch1-F08
14/58
-
8/2/2019 Operating Systems -ch1-F08
15/58
Chapter 1 Operating Systems 15
Storage Structure
Main memory only large storage media thatthe CPU can access directly.
Secondary storage extension of main memorythat provides large nonvolatile storage capacity.
Magnetic disks rigid metal or glass platterscovered with magnetic recording material
Disk surface is logically divided into tracks,which are subdivided into sectors.
The disk controllerdetermines the logicalinteraction between the device and thecomputer.
-
8/2/2019 Operating Systems -ch1-F08
16/58
Chapter 1 Operating Systems 16
Storage Hierarchy
Storage systemsorganized inhierarchy.
Speed
Cost
Volatility Caching copying
information intofaster storagesystem; main
memory can beviewed as a lastcache for secondarystorage.
-
8/2/2019 Operating Systems -ch1-F08
17/58
Chapter 1 Operating Systems 17
Caching
Important principle, performed at many levels in acomputer (in hardware, operating system,software)
Information in use copied from slower to fasterstorage temporarily
Faster storage (cache) checked first to determine ifinformation is there
If it is, information used directly from the cache(fast)
If not, data copied to cache and used there Cache smaller than storage being cached
Cache management important design problem
Cache size and replacement policy
-
8/2/2019 Operating Systems -ch1-F08
18/58
Chapter 1 Operating Systems 18
Performance of Various Levels of Storage
Movement between levels of storage hierarchycan be explicit or implicit
-
8/2/2019 Operating Systems -ch1-F08
19/58
Chapter 1 Operating Systems 19
Migration of Integer A from Disk to Register
Multitasking environments must be careful to use mostrecent value, no matter where it is stored in the storagehierarchy
Multiprocessor environment must provide cachecoherency in hardware such that all CPUs have the most
recent value in their cache
Distributed environment situation even more complex
Several copies of a datum can exist
Various solutions covered in Chapter 17
-
8/2/2019 Operating Systems -ch1-F08
20/58
Chapter 1 Operating Systems 20
Operating System Structure
Multiprogramming needed for efficiency
Single user cannot keep CPU and I/O devices busy at all times
Multiprogramming organizes jobs (code and data) so CPU alwayshas one to execute
A subset of total jobs in system is kept in memory
One job selected and run viajob scheduling
When it has to wait (for I/O for example), OS switches to another
job Timesharing (multitasking) is logical extension in which CPU
switches jobs so frequently that users can interact with each job whileit is running, creating interactive computing
Response time should be < 1 second
Each user has at least one program executing in memoryprocess
If several jobs ready to run at the same time CPU scheduling
If processes dont fit in memory, swapping moves them in andout to run
Virtual memory allows execution of processes not completely inmemory
-
8/2/2019 Operating Systems -ch1-F08
21/58
Chapter 1 Operating Systems 21
Memory Layout for Multiprogrammed System
-
8/2/2019 Operating Systems -ch1-F08
22/58
Chapter 1 Operating Systems 22
Operating-System Operations
Interrupt driven by hardware
Software error or request creates exception or trap
Division by zero, request for operating system service
Other process problems include infinite loop, processesmodifying each other or the operating system
Dual-mode operation allows OS to protect itself andother system components
User mode and kernel mode
Mode bit provided by hardware
Provides ability to distinguish when system isrunning user code or kernel code
Some instructions designated as privileged, onlyexecutable in kernel mode
System call changes mode to kernel, return fromcall resets it to user
-
8/2/2019 Operating Systems -ch1-F08
23/58
Chapter 1 Operating Systems 23
Common Functions of Interrupts
Interrupt transfers control to the interruptservice routine generally, through the interruptvector, which contains the addresses of all theservice routines.
Interrupt architecture must save the address ofthe interrupted instruction.
Incoming interrupts are disabledwhile anotherinterrupt is being processed to prevent a lostinterrupt.
A trap is a software-generated interrupt causedeither by an error or a user request.
An operating system is interruptdriven.
-
8/2/2019 Operating Systems -ch1-F08
24/58
Chapter 1 Operating Systems 24
Interrupt Handling
The operating system preserves the state of theCPU by storing registers and the program counter.
Determines which type of interrupt has occurred:
Polling (no information is passed with the interrupt,thus the CPU polls (asks) every device if it is the one whoinitiate the interrupt)
vectoredinterrupt system (the device who issuedthe interrupt inform the CPU by adding its ID to theinterrupt request)
Separate segments of code determine what actionshould be taken for each type of interrupt
-
8/2/2019 Operating Systems -ch1-F08
25/58
Chapter 1 Operating Systems 25
Interrupt Timeline
-
8/2/2019 Operating Systems -ch1-F08
26/58
Chapter 1 Operating Systems 26
I/O Structure
After I/O starts, control returns to user program
only upon I/O completion. Wait instruction idles the CPU until the next
interrupt
Wait loop (contention for memory access).
At most one I/O request is outstanding at a
time, no simultaneous I/O processing. After I/O starts, control returns to user program
without waiting for I/O completion.
System call request to the operating systemto allow user to wait for I/O completion.
Device-status table contains entry for each I/Odevice indicating its type, address, and state.
Operating system indexes into I/O device tableto determine device status and to modify tableentry to include interrupt.
-
8/2/2019 Operating Systems -ch1-F08
27/58
Chapter 1 Operating Systems 27
Two I/O Methods
Synchronous Asynchronous
-
8/2/2019 Operating Systems -ch1-F08
28/58
Chapter 1 Operating Systems 28
Transition from User to Kernel Mode
Timer to prevent infinite loop / process hoggingresources
Set interrupt after specific period
Operating system decrements counter
When counter zero generate an interrupt
Set up before scheduling process to regaincontrol or terminate program that exceedsallotted time
-
8/2/2019 Operating Systems -ch1-F08
29/58
Chapter 1 Operating Systems 29
Process Management
A process is a program in execution. It is a unit of work withinthe system. Program is apassive entity, process is an activeentity.
Process needs resources to accomplish its task
CPU, memory, I/O, files
Initialization data
Process termination requires reclaim of any reusable resources
Single-threaded process has one program counter specifyinglocation of next instruction to execute
Process executes instructions sequentially, one at a time,until completion
Multi-threaded process has one program counter per thread Typically system has many processes, some user, some
operating system running concurrently on one or more CPUs
Concurrency by multiplexing the CPUs among theprocesses / threads
-
8/2/2019 Operating Systems -ch1-F08
30/58
Chapter 1 Operating Systems 30
Process Management Activities
The operating system is responsible for thefollowing activities in connection with processmanagement:
Creating and deleting both user and systemprocesses
Suspending and resuming processes
Providing mechanisms for processsynchronization
Providing mechanisms for processcommunication
Providing mechanisms for deadlock handling
-
8/2/2019 Operating Systems -ch1-F08
31/58
Chapter 1 Operating Systems 31
Memory Management
All data in memory before and after processing
All instructions in memory in order to execute
Memory management determines what is inmemory when (placement and replacement)
Optimizing CPU utilization and computerresponse to users
Memory management activities
Keeping track of which parts of memory are currentlybeing used and by whom
Deciding which processes (or parts thereof) and datato move into and out of memory
Allocating and deallocating memory space as needed
-
8/2/2019 Operating Systems -ch1-F08
32/58
Chapter 1 Operating Systems 32
Storage Management
OS provides uniform, logical view of information storage Abstracts physical properties to logical storage unit - file
Each medium is controlled by device (i.e., disk drive, tapedrive) Varying properties include access speed, capacity, data-
transfer rate, access method (sequential or random)
File-System management
Files usually organized into directories
Access control on most systems to determine who canaccess what
OS activities include Creating and deleting files and directories
Primitives to manipulate files and dirs
Mapping files onto secondary storage
Backup files onto stable (non-volatile) storage media
-
8/2/2019 Operating Systems -ch1-F08
33/58
Chapter 1 Operating Systems 33
Mass-Storage Management
Usually disks used to store data that does not fit in mainmemory or data that must be kept for a long period oftime.
Proper management is of central importance
Entire speed of computer operation hinges on disk
subsystem and its algorithms OS activities
Free-space management
Storage allocation
Disk scheduling
Some storage need not be fast Tertiary storage includes optical storage, magnetic tape
Still must be managed
Varies between WORM (write-once, read-many-times) and RW(read-write)
-
8/2/2019 Operating Systems -ch1-F08
34/58
Chapter 1 Operating Systems 34
I/O Subsystem
One purpose of OS is to hide peculiarities ofhardware devices from the user
I/O subsystem responsible for
Memory management of I/O including
buffering (storing data temporarily while itis being transferred), caching (storing partsof data in faster storage for performance),spooling (the overlapping of output of onejob with input of other jobs)
General device-driver interface
Drivers for specific hardware devices
-
8/2/2019 Operating Systems -ch1-F08
35/58
Chapter 1 Operating Systems 35
Protection and Security
Protection any mechanism for controlling access ofprocesses or users to resources defined by the OS
Security defense of the system against internal and externalattacks
Huge range, including denial-of-service, worms, viruses,identity theft, theft of service
Systems generally first distinguish among users, to determinewho can do what User identities (user IDs, security IDs) include name and
associated number, one per user
User ID then associated with all files, processes of that user todetermine access control
Group identifier (group ID) allows set of users to be defined andcontrols managed, then also associated with each process, file
Privilege escalation allows user to change to effective ID withmore rights
-
8/2/2019 Operating Systems -ch1-F08
36/58
Chapter 1 Operating Systems 36
Computing Environments
Traditional computer Blurring over time
Office environment
PCs connected to a network, terminals
attached to mainframe or minicomputersproviding batch and timesharing
Now portals allowing networked and remotesystems access to same resources
Home networks Used to be single system, then modems
Now firewalled, networked
-
8/2/2019 Operating Systems -ch1-F08
37/58
Chapter 1 Operating Systems 37
Computing Environments (Cont.)
Client-Server Computing Dumb terminals supplanted by smart PCs
Many systems now servers, responding to requests generated byclients
Compute-server provides an interface to client to requestservices (i.e. database)
File-server provides interface for clients to store and retrievefiles
-
8/2/2019 Operating Systems -ch1-F08
38/58
Chapter 1 Operating Systems 38
Peer-to-Peer Computing
Another model of distributed system
P2P does not distinguish clients and servers
Instead all nodes are considered peers
May each act as client, server or both
Node must join P2P network Registers its service with central lookup
service on network, or
Broadcast request for service and respond
to requests for service via discoveryprotocol
Examples include Napsterand Gnutella
-
8/2/2019 Operating Systems -ch1-F08
39/58
Chapter 1 Operating Systems 39
Web-Based Computing
Web has become ubiquitous
PCs most prevalent devices
More devices becoming networked to allow webaccess
New category of devices to manage web trafficamong similar servers: load balancers
Use of operating systems like Windows 95,client-side, have evolved into Linux and
Windows XP, which can be clients and servers
-
8/2/2019 Operating Systems -ch1-F08
40/58
Chapter 1 Operating Systems 40
1- Mainframe Systems
Reduce setup time by batching similar jobs Automatic job sequencing automatically
transfers control from one job to another.First rudimentary operating system.
Resident monitor initial control in monitor
control transfers to job
when job completes control transfers
back to monitor
-
8/2/2019 Operating Systems -ch1-F08
41/58
Chapter 1 Operating Systems 41
2- Multiprogrammed Batch Systems
Several jobs are kept in main memory at the sametime, and the CPU is multiplexed among them.
-
8/2/2019 Operating Systems -ch1-F08
42/58
Chapter 1 Operating Systems 42
OS Features Needed for Multiprogramming
I/O routine supplied by the system. Memory management the system must
allocate the memory to several jobs.
CPU scheduling the system must
choose among several jobs ready to run. Allocation of devices.
-
8/2/2019 Operating Systems -ch1-F08
43/58
Chapter 1 Operating Systems 43
3- Time-Sharing SystemsInteractive Computing
The CPU is multiplexed among several jobsthat are kept in memory and on disk (theCPU is allocated to a job only if the job is inmemory).
A job swapped in and out of memory to the
disk. On-line communication between the user
and the system is provided; when theoperating system finishes the execution ofone command, it seeks the next control
statement from the users keyboard.
On-line system must be available for usersto access data and code.
-
8/2/2019 Operating Systems -ch1-F08
44/58
-
8/2/2019 Operating Systems -ch1-F08
45/58
Chapter 1 Operating Systems 45
5- Parallel Systems
Multiprocessor systems with more than on CPUin close communication.
Advantages of parallel system:
Increased throughput
Economical Increased reliability
graceful degradation
fail-soft systems
-
8/2/2019 Operating Systems -ch1-F08
46/58
Chapter 1 Operating Systems 46
Parallel Systems (Cont.)
Symmetric multiprocessing (SMP) Each processor runs an identical copy of the
operating system.
Many processes can run at once without
performance deterioration. Most modern operating systems support SMP
Asymmetric multiprocessing
Each processor is assigned a specific task;
master processor schedules and allocatedwork to slave processors.
More common in extremely large systems
-
8/2/2019 Operating Systems -ch1-F08
47/58
-
8/2/2019 Operating Systems -ch1-F08
48/58
Chapter 1 Operating Systems 48
Multiprocessor Operating Systems
ChallengesMutual exclusion
Ensure that only one process can access the
shared resource at one time
Cache coherence problem Occurs when a processor modifies data in its
Cache, the data is also cached by other processors
-
8/2/2019 Operating Systems -ch1-F08
49/58
Chapter 1 Operating Systems 49
6- Distributed Systems
Distribute the computation amongseveral physical processors.
Advantages of distributed systems.
Resources Sharing
Computation speed up load sharing Reliability
Communications
-
8/2/2019 Operating Systems -ch1-F08
50/58
Chapter 1 Operating Systems 50
Distributed Systems (cont)
Requires networking infrastructure.
Local area networks (LAN) or Wide area networks (WAN)
Distributed Operating Systems Provide transparencies of locations of resources, program
execution Challenge: the lack of shared memory, global clock, and
unpredictable delays May be either client-serverorpeer-to-peersystems.
-
8/2/2019 Operating Systems -ch1-F08
51/58
Chapter 1 Operating Systems 51
7-Clustered Systems
Clustering allows two or more systems to sharestorage.
Provides high reliability.
Asymmetric clustering: one server runs the
application while other servers are standby. Symmetric clustering: all N hosts are running
the application.
-
8/2/2019 Operating Systems -ch1-F08
52/58
Chapter 1 Operating Systems 52
Advanced Operating Systems
Database Operating System Supports transactions, concurrency control
and failure recovery
Real-time Operating System Ensures that jobs are completed by deadlines
Maximizes number of jobs satisfyingdeadlines
-
8/2/2019 Operating Systems -ch1-F08
53/58
Chapter 1 Operating Systems 53
8- Real-Time Systems
Often used as a control device in a dedicated
application such as controlling scientificexperiments, medical imaging systems,industrial control systems, and some displaysystems.
Well-defined fixed-time constraints. Real-Time systems may be either hardor
softreal-time.
Hard real-time system: Disaster occurs iftasks are not done by the deadlines
Soft real-time: Users are less satisfied
Ex. Video streaming servers
-
8/2/2019 Operating Systems -ch1-F08
54/58
Chapter 1 Operating Systems 54
9- Handheld Systems
Personal Digital Assistants (PDAs)
Cellular telephones
Issues:
Limited memory
Slow processors Small display screens.
-
8/2/2019 Operating Systems -ch1-F08
55/58
Chapter 1 Operating Systems 55
Advanced Operating Systems
1960-1970 OS designs focus on a stand-alone
computer with a single processor
Later OS designs focus on an advanced OS
Classification of a advanced OS is driven by
advances in high-speed architectures new applications
Advanced OSes
Architecture driven Application driven
Multiprocessorsystems Distributed systems Database systems Real-time systems
-
8/2/2019 Operating Systems -ch1-F08
56/58
Chapter 1 Operating Systems 56
Migration of Operating-System Concepts and Features
-
8/2/2019 Operating Systems -ch1-F08
57/58
Chapter 1 Operating Systems 57
Layered approach
divides the OS into several layers. Each layer has well-defined functions
Example: MULTICS Drawback: Functions must be carefully assigned to a
layer because a layer can only use functionality of thelayer directly beneath it.
Kernel-based approach There is a collection of primitives, the kernel, over
which the rest of the OS is built Example: Linux, Unix, Windows 2000
Virtual machine approach
Creates an illusion that the entire machine is at thesole disposal of each user; this illusion is created bytime-multiplexing of resources among all users.
Example: IBM VM/370; users run CMS (ConversationalMonitor System) OS on top of VM/370
OS Design Approaches
-
8/2/2019 Operating Systems -ch1-F08
58/58
Whats Next
Detailed discussion of the various topicsintroduced today in succeeding meetings
Please check the course homepage for news
and new lecture notes.
See you next time