February 02Page 1 Operating Systems Introduction
February 02Page 2 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
February 02Page 3 CS Components Application Programs Operating System Computer Hardware User 1User 2User 4User 3User 5
February 02Page 4 Early Computers (Mainframes) First Computers had no OS –programmer had to control hardware ( …) “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
February 02Page 5 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
February 02Page 6 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
February 02Page 7 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
February 02Page 8 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
February 02Page 9 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
February 02Page 10 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.
February 02Page 11 Multi-programmed Batch Systems 1965 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,…
February 02Page 12 Multi-programming Memory allocation for multi-programmed system Operating System Job 1, (User) Job 2 Job 3
February 02Page 13 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
February 02Page 14 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
February 02Page 15 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
February 02Page 16 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)
February 02Page 17 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.
February 02Page 18 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,…
February 02Page 19 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
February 02Page 20 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
February 02Page 21 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.
February 02Page 22 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,…
February 02Page 23 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
February 02Page 24 References Silberscharz A. and Galvin P., Operating System Concepts, John Wiley & Sons, 1999 Tanenbaum A., Modern Operating Systems, 2 nd edition, Prentice Hall, New Jersey, 2001