1 / 77

Unit 6 Operating Systems

Unit 6 Operating Systems. Dr Damitha Karunaratna University of Colombo school of computing. Topics to discuss. What is an operating system(OS)? Main objectives of an OS Main functions of an OS Evolution of OS. Process management. Context switching. Process state diagrams.

tale
Download Presentation

Unit 6 Operating Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unit 6Operating Systems Dr DamithaKarunaratna University of Colombo school of computing

  2. Topics to discuss • What is an operating system(OS)? • Main objectives of an OS • Main functions of an OS • Evolution of OS. • Process management. • Context switching. • Process state diagrams

  3. Components of a Computer System • hardware—electronic, mechanical, optical devices. • software—programs. • Software saved on the storage media. • Software burned into hardware – Firmware • Liveware – Computer Users

  4. What is an operating system(OS)? • An operating system (OS) is a resource manager. • What is the necessity for a resource manager? • Many processes are active at any given time and compete for resources. • An operating system provides orderly and controlled allocation of the resources among processes (jobs) that are competing for them.

  5. Different types of Software • Application Software • Systems Software • Operating system • System utilities • The quality of system software also directly affects the application software

  6. Types of Software • Utility software: system software designed to help analyze, configure, optimize or maintain a computer(Anti-virus, Backup software, Editors, Data compression, Disk cleaners ….). • They are not essential to the running of the computer Transient Component

  7. What is an operating system(OS)?

  8. What is an operating system(OS)? Kernel : Part of the O/S that resides in the main memory all the time.

  9. Execution of source programs

  10. Address mapping for re-locatable programs

  11. Different types of Oss(Based on the processor) • Windows/Linux – For personal computers • Unix,z/OS, OS/390, VM – For mainframes • MacOs – For Macs • X Server, Windows Server – Server Operating Systems • Symbian, Android – For mobile phones.

  12. Different types of OSs (Based on the users) • Single User – Allows only a single user to use the OS at any given time. The use may run several processes at the same time. • Example - DOS • Multi User - Allows multiple users to access a computer system at the same time • Example UNIX, Time-sharing systems and Internet servers.

  13. Different types of OSs(Based on the number of tasks) • Single Task– Allows only one running program at any given time. • Multi Task - A multi-tasking operating system allows more than one program to be running at the same time.

  14. Different types of OSs • Real Time – OS is designed to run applications with very precise timing and with a high degree of reliability. • The main objective of real-time operating systems is their quick and predictable response to events. • These types of OS are needed in situations where downtime is costly or a program delay could cause a safety hazard.

  15. Main objectives of an OS • Convenience: Make the computer more convenient to use • Provide easy to use interface for a normal users. • Hide the complexity of the hardware devices from the application developer. • Efficiency: Monitor and manage resources of the computer system efficiently • CPU • Main memory • Secondary Storages • Various devices connected to the computer

  16. Services provided by an OS • Process Management • Storage (external) management • Memory management • I/O device management • Management of the File System • Networking • User Interface • Protection

  17. Services provided by an OS…. • Error detection and response • Hardware errors: memory error or device failure • Software errors: arithmetic errors, access forbidden memory locations • Accounting • collect statistics (billing) • monitor performance

  18. Types of User Interfaces • Command Line Interface(CLI)

  19. Types of User Interfaces • Graphical User Interface(GUI)

  20. OS and Processors Operating systems are software Operating systems are designed and developed for a specific CPU family. • Macintosh OS: Motorola 680xx, PowerPC Gx, Intel • DOS: Intel CPUs • Windows 9x and XP: Intel 80386, 80486, and Pentium CPUs • Linux: Intel CPUs • MS NT & 2000: Intel CPUs Can any OS run on any processor?

  21. Compatibility of Software Question Will software developed for one operating system work on another? For example will MS Word for Macintosh run on a PC with Windows XP?

  22. Compatibility of Software Question Will software developed for one operating system work on another? Answer No (unless there is special emulation software or hardware). The software is typically developed separately for each operating system.

  23. Evolution of Operating systems Serial Processing (1940 – mid 1950s) • Single user system. • Programmer/User acts as the operator and interacted with the hardware. • No operating system. • Machines run from a console with display lights, toggle switches. • Paper Tapes or Punched cards for the program and I/O. • Setup included loading the compiler, source program, saving compiled program, and loading and linking Disadvantages : • Scheduling: Hardcopy sigh-up sheet for reserving time • User could reserve for 45 mins and finish in 30 mins => wastage of time • User may not be able to finish in scheduled time

  24. Simple batch system Simple Batch Processing Systems • Use of high-level languages • Jobs are batched together by the language. • Input/output is through punch cards and magnetic tapes. • Software called the Monitor was introduced to sequence the jobs. • Hardware support for the monitor model • Memory protection: some memory areas are accessible only to the monitor • Privileged mode instructions: only accessible to the monitor • Interrupts (early machines did not have this)

  25. Simple batch processing system • The user submits a job (written on cards or tape) to a computer operator. • The computer operator place a batch of several jobs on an input device. • A special program called the monitor, manages the execution of each program in the batch. • “Monitor” is always in main memory. • Monitor reads and loaded programs sequentially and then (the utility programs when needed) passed the control to the loaded program. • When a job terminates the control returns back to the monitor program. • Alternate execution between user program and the monitor program. • instructions for the monitor were given by using a special purpose language called Job Control Language (JCL)

  26. Simple batch system ….. • A user program executes in user mode, in which certain areas of memory were protected from the user’s use, and user program is not allowed to execute certain instructions. • The monitor executes in a system mode, or a kernel modeand it can execute privileged instructions and can access protected memory segments. • Machine time alternates between monitor and the user programs.

  27. Simple batch system ….. Disadvantages • A portion of the memory has to be allocated for the monitor • A small portion of the machine time is consumed by the monitor. Advantage of batch systems. • Reduce setup time by batching similar jobs.

  28. Card Deck of a job

  29. Simple batch system : Problems • During I/O operations CPU is not used.

  30. Simple batch system : I/O • I/O devices (Card Readers, Printers) slow when compared to CPU. Solution: Offline Operation (Satellite Computers) • Speed up computationby loading jobs into memory from tapes while cardreading and line printing is done off-line using smaller machines.

  31. Multiprogramming • Running multiple programs “at the same time” • Requires sharing the CPU among multiple processes • Transfer of control is called a context switch Firefox Word javac Firefox Word

  32. Multiprogramming • Why multiprogramming? • Single user cannot keep CPU and I/O devices busy at all times. • Multiprogramming organizes jobs (code and data) so CPU always has one to execute. • A subset of total jobs in system is kept in memory. • One job selected and CPU is give for that job. • When it has to wait, OS switches to another job.

  33. Multiprogramming

  34. Time Sharing Systems • Processor’s time is shared among multiple users • Multiple users simultaneously access the system through terminals.

  35. Multiprogramming Vs Time Sharing Systems • Multiprogramming maximizes CPU utilization • Time-sharing minimizes user response time

  36. Loading the Operating System • OS is also a software like any other, but has to be loaded and run by the OS itself. • The process of initializing the computer and loading the OS is known as bootstrapping or booting the system. • The bootstrapping program normally exist in non-volatile memory and is executed automatically when the machine is turned on. • The operating system software (kernel) copied into RAM, usually from the hard disk, during the boot-up. • Once loaded the OS wait for an event to occur (eg: user typing a command) and process the event. • OS is an event driven software.

  37. Loading the Operating System • The kernel remains in RAM while the computer is on and is in charge of the overall operation of the computer system. • The kernel contains the “internal programs” for the most often used operations like file management, memory management, security.

  38. Gaining Control • The OS gets the control of the CPU when either an external event or an internal event occurs. • External Events • Character typed at the console • Completion of an I/O operation • Timer quantum allowed for a process expires. • Internal Events • Division by zero, • System call issued by a program • Page Fault • Unauthorized memory access

  39. Interrupts • External events get the attention of the CPU through Interrupts. • For example when a disk driver has finished transferring the requested data, it generates an interrupt to the OS to inform the OS that the task is over. • Interrupts occur asynchronously to the ongoing activity of the processor. Thus the times at which interrupts occur are unpredictable.

  40. Interrupt Handlers • Interrupt Handlers : Code that get executed when an interrupt occurs. • Associated with each type of interrupt there is a specific program to handle that type of interrupts – Interrupt handler (Interrupt service routine)

  41. Getting the services of OS • How do the user programs get the service of OS? • User programs access the functionality of the OS through system calls – privileged operations. • Example : open(), close(), fork(),……. • The execution of system call change the execution mode of the CPU to supervisor mode.

  42. Processes • Process is a fundamental concepts in modern operating systems. • It was first introduced by the designers of Multics operating systems in the 1960s. • The programs that reside in main memory are absolutely different from their counter-parts the program files on hard disks or any other secondary storage devices.

  43. Process and a program • A process is a program in execution • An instance of a program running on a computer. • The entity that can be assigned to and executed on a processor • A program is astatic set of instructions

  44. Process and a program • A process exists in a limited span of time. Two or more processes could be executing the same program, each using their own data and resources. • A program is a static entity made up of instructions. A program exists in the secondary storage till it is deleted. A program does not perform the action by itself.

  45. Process creation and termination • When a new process is created, the operating system builds the date structures that are used to manage the process and allocates space in main memory to the process. • A process may terminates in a number of ways. • After completion of the instructions. • User terminates (kills) the process explicitly. For example clicking on the cross button in the windows applications. • A process may terminate due to abnormal condition. • When a process finishes, the operating system will free the memory space it occupies and remove the data structures it allocated to manage the process.

  46. Processes in a typical Linux system

  47. Uniprocessor Scheduling • Type of processes • I/O bound processes • Processor bound processes

  48. Uniprocessor Scheduling • Types of Scheduling • Long-term scheduling(Job scheduling) : It determines which programs are admitted to the system for processing. Job scheduler selects processes from the queue and loads them into memory for execution. Process loads into the memory for CPU scheduling. • Medium-term scheduling : Medium term scheduling is in charge of swapping processes between the main memory and the secondary storage. • Short-term scheduling (low-level scheduling) : Determines which ready process will be assigned the CPU when it next becomes available.

  49. Scheduling Policies • Non-preemptive • Once a process is in the running state, it will continue until it terminates or blocks itself for I/O. • Preemptive • Currently running process may be interrupted and moved to the Ready state by the OS. • Allows for better service since any one process cannot monopolize the processor for very long

  50. Processor Scheduling • Assigning the processor to the processes. • Turnaround time : Time required for a particular process to complete, from submission time to completion. • Response time : The time taken in an interactive program from the issuance of a command to the commence of a response to that command. • Throughput : Number of processes completed per unit time. May range from 10 / second to 1 / hour depending on the specific processes. • Waiting time : How much time a process spends in the ready queue waiting its turn to get on the CPU.

More Related