Welcome Introduction to Operating Systems Dr Taieb Znati

Welcome Introduction to Operating Systems Dr. Taieb Znati 226, Eberly Hall znati@cs. pitt. edu 624 -8417 1

Why study OS theory? n n OS is a very important part of a computer systems Problems, methods, and solutions found in OS theory can also apply to many other areas of computer science. Chap 1 2

Course Overview n Philosophy u Focus on issues that are of theoretical interest as well as of practical value n Objective u Provide a clear understanding of key problems associted with OS design F Bring awareness to existing solutions F Discuss their limitations Chap 1 3

Course Topics. n n n n Operating system overview. Processes management u Processes, threads and scheduling, Concurrency u Mutual exclusion and synchronization. Deadlock Storage Management u Memory management and virtual memory File System Management I/O Subsystem Distributed Systems Overview Chap 1 4

Course Evaluation n Projects and Homework Assignments u 35% n Midterm Exam u 30% n Final Exam u 45% Chap 1 5

Operating Systems Overview Chapter 1 6

Operating System n A program that controls the execution of application programs u OS must relinquish control to user programs and make sure that it regains it when necessary n An interface between the user and hardware u Masks the details of the hardware to application programs n It tries to optimize the use of computing resources for maximum performance Chap 1 7

Services Provided by the OS n Facilities for Program creation u editors, n compilers, linkers, and debuggers Program execution u loaders, n Access to I/O and files u deals n I/O and file initialization with the specifics of I/O and file formats System access u Protection in access to resources and data u Resolves conflicts for resource contention Chap 1 8

Services Provided by the OS n Error Detection u hardware errors memory error F device failure F u software errors n Error Response simply report error to the application u Retry the operation u Abort the application u arithmetic overflow F access forbidden memory locations F u Inability of OS to grant request Chap 1 9

Services Provided by the OS n Accounting u collect statistics on resource usage u monitor performance (eg: response time) u used for system parameter tuning to improve performance u useful for anticipating future enhancements u used for billing users (on multiuser systems) Chap 1 10

Evolution of an Operating System n Must adapt to hardware upgrades and new types of hardware. u Character vs graphic terminals u Additional memory, channels, CPUs n n Must be able to offer new services, eg: internet support The need to change the OS on regular basis place requirements on its design u modular construction with clean interfaces u possibly, object oriented methodology Chap 1 11

Historical Evolution of OS n n n 4 4 The beginning: I/O routines, system setups Simple Batch OS Multi-programmed Batch OS Time-Sharing Systems Networked systems, Client-Server Web computers, Multimedia the functionalities of simpler systems are also present in more evolved ones often, the same problems and solutions present in simple systems are also present in more advanced ones. Chap 1 12

Simple Batch Systems n n n n First operating systems (mid-50 s) User submits a job (typically, cards) to a computer operator Computer operator places a batch of jobs on a input device (e. g. card reader) A special program, the monitor, manages the execution of each program in the batch Resident monitor is in main memory and always available for execution Monitor utilities are loaded when needed Only one program at the time in memory u Executed to the end before the next one is loaded. Chap 1 13

The Monitor n n Monitor reads jobs one at a time from the input device Monitor places a job in the user program area A monitor instruction branches to the start of the user program Execution of user program continues until: end-of-program, timeout or error occurs u This causes Monitor to resume u Chap 1 14

Job Control Language (JCL) n Language used to provide instructions to the monitor what compiler to use u what files to use u n n n Example of job format: ------->> $JOB sets up machine $FTN loads the compiler and transfers control to it $LOAD loads the compiled object code $RUN transfers control to same Chap 1 $JOB setup parms $FTN FORTRAN program cards. . . $LOAD $RUN Data cards. . . $END $JOB Other program. . 15

Job Control Language (JCL) n n I/O is delegated to OS Each I/O instruction, in user program, causes OS I/O routine to be invoked u user cannot read a JCL line u user cannot print in the middle of other user’s printout. . . n OS reads the next JCL line at completion of user program Chap 1 16

Desirable Hardware Features n Memory protection u memory area containing the monitor must be protected from user programs n Timer u prevents a job from monopolizing the system u an interrupt occurs when allocated time expires Chap 1 17

Desirable Hardware Features n n Privileged instructions (e. g. I/O, setting certain registers) u can be executed only by the OS u an interrupt occurs if a program tries these instructions F CPU can execute in Supervisor or User mode (bit in CPU) (these are also called Master/Slave mode) F Privileged instructions possible only in Supervisor mode F Only OS can switch CPU to Supervisor mode and back F User programs can execute in User mode only Extended role of Interrupts u for relinquishing control to and regaining control from user programs Chap 1 18

Interruption Terminology (129) n n Confusing terminology in the literature…not standardized A good idea is to distinguish between : Interrupts: independent of program that is executing. Examples: I/O, timer u Traps: caused by program execution. Examples: illegal access. u The word fault is also used, esp. wrt paging and segmentation u n But the handling mechanisms are similar Chap 1 19

Multiprogrammed Batch Systems I/O operations are exceedingly slow (compared to instruction execution) n A program containing even a small number of I/O ops will spend most of its time waiting for them è Poor CPU usage when only one program is executing n Chap 1 20

Multiprogrammed Batch Systems n n If several programs can execute, then CPU can switch to another one whenever one is awaiting for I/O to complete This is multitasking (multiprogramming) Chap 1 21

Requirements for Multiprogramming n n Hardware support: u I/O interrupts F in order to execute instructions while I/O device is busy u Memory management F several ready-to-run jobs must be kept in memory (real or virtual) u Memory protection to protect applications from each other Software support from the OS: u To manage resource contention, esp: F CPU scheduling (which program is to be run next) F Memory allocation Chap 1 22

Example: three jobs are submitted JOB 1 n n JOB 2 JOB 3 Type of job Heavy compute Heavy I/O Duration 5 min. 10 min. Memory req. 50 K 100 K 80 K Need disk? No No Yes Need terminal No Yes No Need printer? No No Yes Almost no contention for resources All 3 can run in minimum time in a multitasking environment (assuming JOB 2 &3 have enough CPU time to keep their I/O operations active) Chap 1 23

Advantages of Multiprogramming Uniprogramming Multiprogramming Processor use 17% 33% Memory use 30% 67% Disk use 33% 67% Printer use 33% 67% Elapsed time 30 min. 15 min. Throughput rate 6 jobs/hr 12 jobs/hr Avg. response time 18 min. (5+20+30)/3 10 min. Chap 1 24

Time Sharing Systems (TSS) n Batch multiprogramming does not support interaction with users u user n n n frustrations ! TSS extends multiprogramming to handle multiple interactive jobs Processor’s time is shared among multiple users Multiple users simultaneously access the system through terminals Chap 1 25

TSS n n n Because of slow human reaction time, a typical user may need only 2 secs of processing time per minute Then up to 30 users could be able to share the same system without noticeable delay in the computer reaction time The OS functionalities needed are the same as for batch, plus more. . . Chap 1 26

Parallel Systems n Multiprocessor systems involve multiprocessors in close communication, sharing hardware devices, such as bus, clock, memory and peripheral devices u Increased throughput u Graceful degradation F Fault Chap 1 tolerance 27

Distributed Systems n In contrast to tightly coupled systems, distributed systems do not share memory or a clock u Processor n communicate through a network Why distributed systems? u Resource sharing, computation speedup, reliability, and need for communication Chap 1 28

Real-Time Systems n RT systems are needed when there are stringent timing requirements on the operation of the processor of the data flow u Process control, medical imaging, real-time multimedia applications n RT guarantees u Soft guarantees u Hard guarantees n Scheduling becomes crucial Chap 1 29

Conclusion n OS overview OS services OS Types u Batch systems u Multiprogrammed batch systems u TSS u Parallel and Distributed Systems u RT systems Chap 1 30
- Slides: 30