HistoryAndHardware

advertisement
Bare Machine (early 1950s)
n
Structure
F
F
F
F
n
Large machines run from console
Single user system
Programmer/User as operator
Paper tape or punched cards
Early Software
F Assemblers, compilers, linkers, loaders
F Libraries of common subroutines
F Device drivers
n
Inefficient use of expensive resources
F Low CPU utilization
F Significant amount of setup time
n
Solutions
F Add a card reader
F Hire an operator
Operating System Concepts
2.1
Silberschatz, Galvin and Gagne 2002
Simple Batch Systems
n Reduce setup time by batching similar jobs
n Automatic job sequencing - automatically transfers control
from one job to another - first rudimentary OS
n Resident monitor
F Initial control in monitor
F Control transfers to job
F Job transfers control back to monitor (or chaos ensues)
n Use control cards to
F Separate jobs
F Specify job types, e.g., FORTRAN
F Separate code from data
Operating System Concepts
2.2
Silberschatz, Galvin and Gagne 2002
Memory Layout for a Simple Batch System
Operating System Concepts
2.3
Silberschatz, Galvin and Gagne 2002
Offline Operation
n Do card reading and printing offline
F Jobs copied from cards to tape
F Tape loads to CPU, and results output to tape
F Tape content printed
n Advantages
F CPU constrained only by tape speed
F No changes to existing code
F Multiple card readers and printers per CPU
Operating System Concepts
2.4
Silberschatz, Galvin and Gagne 2002
Offline Operation Layout
Operating System Concepts
2.5
Silberschatz, Galvin and Gagne 2002
Spooling
n Overlap I/O of one job with computation of another job.
While executing one job, the OS:
F Reads next job from card reader into a storage area on the
disk (job queue).
F Outputs printout of previous job from disk to printer.
n Job pool – data structure that allows the OS to select
which job to run next in order to increase CPU utilization
n Critical change of hardware
F Allows CPU to swap between IO control and job
F Implemented with interrupts
Operating System Concepts
2.6
Silberschatz, Galvin and Gagne 2002
Spooling
Operating System Concepts
2.7
Silberschatz, Galvin and Gagne 2002
Two I/O Methods
Synchronous
Operating System Concepts
Asynchronous
2.8
Silberschatz, Galvin and Gagne 2002
Synchronous IO
n After I/O starts, control returns to user program only upon
I/O completion.
F Wait instruction idles the CPU until the next interrupt
F At most one I/O request is outstanding at a time, no
simultaneous I/O processing.
n More common in real time systems
Asynchronous IO
n After I/O starts, control returns to user program without
waiting for I/O completion.
F System call – request to the operating system to allow user
to wait for I/O completion
F IO device interrupts on completion
n I/O devices and the CPU can execute concurrently.
Operating System Concepts
2.9
Silberschatz, Galvin and Gagne 2002
Asynchronous IO Request
n User process requests IO service
F Device-status table contains entry for each I/O device
indicating its type, address, and state
F If device is idle the IO starts
F If the device is busy, the request is queued (double
buffering)
Operating System Concepts
2.10
Silberschatz, Galvin and Gagne 2002
Asynchronous IO
n Each device controller has a local buffer.
n CPU moves data from/to memory to/from local buffers
n Device controller informs CPU that it has finished its
operation by causing an interrupt.
n On interrupt the OS indexes into I/O device table to
determine device status and do service
F Feed more data from this request
F Start next request on queue
F Note device idle
Operating System Concepts
2.11
Silberschatz, Galvin and Gagne 2002
Multiprogrammed Batch Systems
n Several jobs are kept in main memory at the same time,
and the CPU is multiplexed among them.
Operating System Concepts
2.12
Silberschatz, Galvin and Gagne 2002
OS Features Needed for Multiprogramming
n I/O routine supplied by the system.
n Memory management – the system must allocate the
memory to several jobs.
n CPU scheduling – the system must choose among
several jobs ready to run.
n Allocation of devices.
Operating System Concepts
2.13
Silberschatz, Galvin and Gagne 2002
Time-Sharing Interactive Computing
n Multi-programming plus …
F Multi-user
F On-line communication between the user and the system is
provided; when the operating system finishes the execution
of one command, it seeks the next “control statement” from
the user’s keyboard.
F On-line file system must be available for users to access
data and code
n Jobs may be swapped in and out of memory to the disk.
Operating System Concepts
2.14
Silberschatz, Galvin and Gagne 2002
Dual-Mode Operation
n
Provide hardware support to differentiate between at least two
modes of operations.
1. User mode – execution done on behalf of a user.
2. Monitor mode (also kernel mode or system mode) – execution done
on behalf of operating system.
Mode bit added to computer hardware to indicate the current
mode: monitor (0) or user (1).
n When an interrupt or fault occurs hardware switches to monitor
mode
n When executing in monitor mode, the operating system has
unrestricted access to both monitor and user’s memory.
n Privileged instructions can be issued only in monitor mode.
Interrupt/fault
n
monitor
user
set user mode
Operating System Concepts
2.15
Silberschatz, Galvin and Gagne 2002
CPU Protection
n Timer – interrupts computer after specified period to
ensure operating system maintains control.
F Timer is decremented every clock tick.
F When timer reaches the value 0, an interrupt occurs.
n Timer commonly used to implement time sharing.
n Timer also used to compute the current time.
n Load-timer is a privileged instruction.
n Setting the interrupt vector is privileged
Operating System Concepts
2.16
Silberschatz, Galvin and Gagne 2002
Memory Protection
n In order to have memory protection, add two registers
that determine the range of legal addresses a program
may access:
F Base register – holds the smallest legal physical memory
address.
F Limit register – contains the size of the range
n Memory outside the defined range is protected.
n The load instructions for the base and limit registers are
privileged instructions.
Operating System Concepts
2.17
Silberschatz, Galvin and Gagne 2002
Use of A Base and Limit Register
Operating System Concepts
2.18
Silberschatz, Galvin and Gagne 2002
I/O Protection
n All I/O instructions are privileged instructions.
Operating System Concepts
2.19
Silberschatz, Galvin and Gagne 2002
Personal Computers
n Computer system dedicated to a single user.
n I/O devices – keyboards, mice, display screens, small
n
n
n
n
printers.
Goals: User convenience and responsiveness.
Can adopt technology developed for larger operating
systems
Individuals have sole use of computer - only multiprogramming.
May run several different types of operating systems
(Windows, MacOS, UNIX, Linux)
Operating System Concepts
2.20
Silberschatz, Galvin and Gagne 2002
Multiprocessor Systems
n Multiprocessor systems with more than one CPU in close
communication.
n Tightly coupled system – processors share memory and a
clock; communication usually takes place through the
shared memory.
Operating System Concepts
2.21
Silberschatz, Galvin and Gagne 2002
Multiprocessor Systems
n
Symmetric multiprocessing (SMP)
F Each CPU runs an identical copy of the operating system.
F Many processes can run at once without performance deterioration.
F Most modern operating systems support SMP
n
Asymmetric multiprocessing
F Each processor is assigned a specific task; master processor
schedules and allocated work to slave processors.
F More common in extremely large systems
n
Advantages of multiprocessor systems:
F Increased throughput
F Economical
F Increased reliability
4 Graceful degradation
4 Fail-soft systems
Operating System Concepts
2.22
Silberschatz, Galvin and Gagne 2002
Distributed Systems
n Distribute the computation among several physical
processors.
n Loosely coupled system – each processor has its own
local memory; processors communicate with one another
through various communications lines, such as highspeed buses or telephone lines.
n May be either client-server or peer-to-peer systems.
Operating System Concepts
2.23
Silberschatz, Galvin and Gagne 2002
Distributed Systems (cont)
n Requires networking infrastructure.
F Local area networks (LAN) or Wide area networks (WAN)
n Advantages of distributed systems.
F Resources Sharing
F Computation speed up – load sharing
F Reliability
F Communications
Operating System Concepts
2.24
Silberschatz, Galvin and Gagne 2002
Real-Time Systems
n
n
n
Often used as a control device in a dedicated application such
as controlling scientific experiments, medical imaging systems,
industrial control systems, and some display systems.
Well-defined fixed-time constraints.
Hard real-time: guaranteed task completion
F Secondary storage limited or absent, data stored in short term
memory, or read-only memory (ROM)
F Conflicts with time-sharing systems, not supported by generalpurpose operating systems.
n
Soft real-time: absolute task priority
F Limited utility in industrial control of robotics
F Useful in applications (multimedia, virtual reality) requiring
advanced operating-system features.
Operating System Concepts
2.25
Silberschatz, Galvin and Gagne 2002
Handheld Systems
n Personal Digital Assistants (PDAs)
n Cellular telephones
n Issues:
F Limited memory
F Slow processors
F Small display screens.
Operating System Concepts
2.26
Silberschatz, Galvin and Gagne 2002
Migration of Operating-System Concepts and Features
Operating System Concepts
2.27
Silberschatz, Galvin and Gagne 2002
Download