240 likes | 345 Views
Operating Systems. Introduction. OS is a Control Program. OS Functions are: 1) OS is a resource allocator. Resources are: CPU time I/O devices Files Memory, internal (SIMM, DIMM) Mass Storage (HD, MTU…) 2) To make Computer System user friendly GUI, Sound, Use of human (like) languages.
E N D
Operating Systems Introduction
OS is a Control Program • OS Functions are: • 1) OS is a resource allocator. Resources are: • CPU time • I/O devices • Files • Memory, internal (SIMM, DIMM) • Mass Storage (HD, MTU…) • 2) To make Computer System user friendly • GUI, Sound, Use of human (like) languages
CS Components User 1 User 2 User 3 User 4 User 5 Application Programs Operating System Computer Hardware
Early Computers (Mainframes) • First Computers had no OS • programmer had to control hardware (011101110…) • “Single User” machine • User had to book time to use CS • CS was often not available, or was idle • Computers were set up to run a (ONE) job • load, run and unload compiler, (removable disk of 5MByte) • load assembler, …(JOB, FOR,…), another disk
Batch System • Job Cards were used to specify steps in the job process • load compiler, one instruction, one card • run compiler, • unload compiler, • load assembler, • Changes in the program were done by punching new cards • Human operators had to batch jobs together • jobs requiring the same compiler run in the batch
Resident Monitor – First OS • Monitor Program was doing job scheduling • User is no longer in control of the CS • Resident Monitor was always in memory • RM was first OS, with components: • Loader • Job Sequencer • Control Card Interpreter (Command Interpreter) • The computer efficiency was increased
Monitor Program • While the user application is running, it must not be allowed to alter the monitor • CPU hardware is designed to protect the monitor in memory • an error message is generated if protected memory area is to be accessed • Monitor must take control of CS if a application enters an infinite loop • Timer is a hardware to support that • when timer goes off, monitor program gain control back
Monitor • Monitor prevents possible hardware damage, caused by application software, by using • Privileged instructions: • CPU allows only the monitor to run instructions which use the I/O devices, and which will report back with an error in case of any failure • How does CS hardware put Monitor Program back in control of CS? • Traps • Interrupts
Next Step - Spooled Batch Systems • I/O activities are too slow comparing to CPU activities, order of [ms], [sec] vs. [ns]: • Card reader is slow, and following that, CPU is mostly idle as it waits for data to come in • Writing output / printing is also slow, and CPU also mostly idle • Computer CPU time was always expensive, $$$ • SPOOL-ing (Simultaneous Peripheral Operation On Line) was THE solution
Spooled Batch Systems • Cheaper machines do the Input and record details on a tape or disk • Tape or Disk is then used by the main computer • Output is written on the disk, or tape, which another cheaper machine reads to print out • CPU Idle time is down from few min to few sec, ms.
Multi-programmed Batch Systems1965 • Spooling still means that the CPU is mostly idle while accessing data from • A disk ( few 10s ms) or • A tape (few min) • Next step: Multi-programmed Batch Systems • Introduce more than one user application into memory. While I/O is occurring, CPU run another job • Operating System, or Control Program, now have to do Job Management • Priority, FCFS, RR,…
Multi-programming • Memory allocation for multi-programmed system
Concurrent Jobs • Operating System is now doing resource allocation for concurrent jobs in memory • By the time an input device is available, few jobs are most likely waiting ( in a i/o queue for that device) • OS must ensure that the data goes to the correct job i.e. user application • OS must protect devices from competing jobs • Fairness of resource allocation is to be in place • Efficiency of the system is always an issue • Deadlock prevention, and/or recovery should be enforced
New OS functions to Support Multitasking • I/O routines to handle concurrent requests • More sophisticated memory management • multiple jobs must be placed in memory and • be protected from each other • CPU scheduling, • to choose which ready-to-run job gets the CPU first • I/O devices, and Mass storage devices, allocation algorithms are developed to handle concurrent requests • Disk Management: FCFS, SSTF, SCAN, CSCAN, LOOK, CLOOK • Printer queue: FCFS
Batch Jobs, still in place • Modern Operating Systems like Windows (DOS), UNIX,…, can perform batch jobs, as well. • UNIX batch shell script: • mkdir new_dir • cp *.txt new_dir • startx • logout
Multi-user Interactive Systems • Batch Systems: There was no interaction between programmer and application during execution • User have to provide all possible inputs in advance, • Question was, how to handle errors, in the process? • Multi-user Interactive Systems, or Time sharing was introduced in 1970s: • User application and OS can: • take inputs, interactively, and • Produce outputs, in a reasonable time • CS serve many users (Honeywell, IBM… 128, 256 users)
Multi-user Interactive Systems • CPU schedules a small time-slice to each user application • For n users, • give each user (job, task) approximately 1/n of the CPU time, over a short interval (Round Robin Algorithm) • Such OS requires File System with easy interface for an interactive user.
Finally, PC Systems, late 1970,… • Hardware is becoming cheap, • A PC is a single user machine, • As being a single user CS, used to have just a few, hardware and resources, protection mechanisms • PC is quite sophisticated now, • Well known PC Operating Systems: • CPM, DOS, WINDOWS,…
Other CS and OS • Parallel Systems, Multiprocessing • More than one CPU sharing the same clock, bus, and sometimes the same memory • Parallel processing, load sharing • Two Types • Symmetric systems: • each CPU runs a copy of the OS. The separate operating systems can communicate with each other when necessary in order to balance workloads and coordinate resources • Asymmetric systems: • only one OS. Different OS processes can be running on different CPUs
Networked Systems • User is able to access files/peripherals across a network and can log in to remote machines • CPUs time is a network resource as well • Network types: • LAN, MAN (broadcasting mostly, but switching as well) • WAN (switching mostly) • Internet Computing
Distributed Systems • User sees the system as it is just his local system, • in reality, files and running programs are on different machines. • On some systems, running applications are able to migrate from system to system • Internet Computing • On other systems, a running application has to stay on the computer that started it.
Real-time OS • Systems defined according response time. • Real Time OS guarantees that a request to the OS will be done within a certain time-limit (short time usually). • Mainly used for embedded systems that need to control processes, or equipment • Automatic pilot, • medical equipment, • some military systems, • power station,…
Real-time OS • Hard limit real-time: • Absolutely guarantees that any request will be done within a time limit • system usually limits types of activities the user application can perform to ensure a request can be met • Soft limit real-time: • to do the request on time
References • Silberscharz A. and Galvin P., Operating System Concepts, John Wiley & Sons, 1999 • Tanenbaum A., Modern Operating Systems, 2nd edition, Prentice Hall, New Jersey, 2001