1 / 46

Chapter 7

Chapter 7. Operating Systems. O BJECTIVES. Understand the components of an operating system. Understand the concept of virtual memory. Understand the concept of deadlock and starvation. List some of the characteristics of popular operating systems such as Windows 2000, UNIX, and Linux.

foster
Télécharger la présentation

Chapter 7

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. Chapter 7 Operating Systems

  2. OBJECTIVES Understand the components of an operating system. Understand the concept of virtual memory. Understand the concept of deadlock and starvation. List some of the characteristics of popular operating systemssuch as Windows 2000, UNIX, and Linux. Define the purpose and functions of an operating system. After reading this chapter, the reader should be able to:

  3. Computer System • Application programs–use the computer hardware to solve users’ problems. • Operating systems–control the access of hardware by users.

  4. 7.1 DEFINITION

  5. Note: An operating system is an interface between the hardware of a computer and the user (program or human)that facilitates the execution of the other programs and the access to hardware and software resources.

  6. Note: Goals of An operating system 1. Efficient use of hardware 2. Easy to use resources.

  7. 7.2 EVOLUTION

  8. Batch systems • Card-reader + line-printer + tape-drive • Job – a program to be executed.

  9. Time-sharing systems • Multiprogramming • Hold several jobs in memory • Only assign a resource to a job that needs it on the condition that the resource is available. • Time-sharing – Resources can be shared between different jobs.Each job can be allocated a portion of time to use the resource.

  10. program job process Time-sharing systems • Scheduling – allocating the resources to different programs and deciding which program should use which resourcewhen. • A job is a program to be run. • A process is a program that is in memory and waiting for resources.

  11. Personal systems • Personal computer • Single-user operating systems.

  12. Parallel systems • Multiple CPUs on the same machine. • Each CPU can be used to serve one program or a part of a program. • Many tasks can be accomplished in parallel instead of serially.

  13. Distributed systems • A program can be run partially on one computer and partially on another computerif they are connected through an internetwork such as the Internet. • Resources can distributed.

  14. 7.3 COMPONENTS

  15. Components of an operating system • User Interface (Shell)is responsible for communication outside the OS.

  16. Memory Manager • Memory management • Monoprogramming • Multiprogramming • Memory allocation must be managed to prevent the “running out of memory” syndrome.

  17. Monoprogramming • Most of the memory capacity is dedicated to one single program. • The whole program is in memory for execution. • When the program finishes running, it is replaced by another program.

  18. Monoprogramming • Memory manager • Load the program into memory • Run it • Replace it with the next program • Problems of Monoprogramming • The program must fit in memory. • When the I/O operations are being carried out, the CPU is idle.

  19. Multiprogramming • More than one program is in memory at the same time, and they are executed concurrently. • The CPU switches between the programs.

  20. Categories of multiprogramming • Nonswapping – the program remains in memory during execution. • Swapping – the program can be swapped between memory and disk one or more times during execution.

  21. Partitioning • Memory is divided into variable length sections. • Each program is entirely in memory and occupying contiguous locations. • The CPU switches between programs.It executes some instructions until it either • encounters an I/O operation or • the allocated time has expired. • Fragmentation • internal fragmentation – memory space that is internal toa partition, but is not being used. • external fragmentation – Enough memory space exists but not contiguous.

  22. Partitioning

  23. Paging • Memory is divided into equally sized sections called frames. • The program is divided into equally sized sections called pages. • The program does not have to be contiguous in memory. • The whole program still needs to be in memory before being executed. • Fragmentation • internal fragmentation – the last frame. • Noexternal fragmentation – Allows non-contiguous allocation.

  24. Paging

  25. Demand Paging & Demand Segmentation • Demand Paging -The pages can be loaded into memory one by one on demand. • Demand Segmentation – The program is divided into segments that match the programmer’s view (modules). • Demand Paging and Segmentation

  26. Virtual memory • Demand Paging & Demand Segmentation – Part of the program is in main memory andpart is on the disk. • A physical memory size of 10MBcan execute 10 programs, each of size 3MB.→ A virtual memory size of 30MB.

  27. Process manager • Program – a nonactive set of instructions stored on disk. • Job – a program becomes a jobfrom the moment it is selected for executed until it has finished running and becomes a program again. • May be • Residing on disk (Hold) • In memory waiting for an I/O event (Waiting) • In memory waiting for execution (Ready) • In memory while being executed by CPU (Running) • Has finished executing and becomes a program again (Terminated) • Process - a program in execution - a job in memory

  28. State diagram • A process in the running state, one of three tings can happen: • exhausts its allocated slot of time • execute until it needs I/O • terminated

  29. Process manager uses two schedulers to move a job/process from one state to another: • Job scheduler – • create a process from a job • terminate a process • Process scheduler – move a process from one state to another.

  30. Job scheduler

  31. Process scheduler

  32. Queuing (waiting list) • Process manager uses queues to handle multiple processes/jobs • Waiting for CPU (Ready queue) • Waiting for memory (Job queue) • Waiting for I/O device (I/O queue) • JCB/PCB (Job control block/Process control block) –store information about that job/process • Process manager stores the JCB/PCB in the queues instead of the job/process itself. • Process manager can have different policies for selecting next job/process from a queue. • FIFO(First In First Out) • Shortest length first • Priority

  33. Queues for process management

  34. Process Synchronization • Process management – synchronizedifferent processes with different resources. • Deadlock – occurs if OS • allows a process to start running without first checking to see if the required resources are ready and • allows the process to hold it as long as it want.

  35. Four necessary conditions for deadlock: • Mutual exclusion – only one process can hold a resource • Resource holding – a process holds a resource even though it cannot use ituntil other resources are available. • No preemption – OS cannot temporarily reallocate a resource • Circular wait – all processes and resources involved form a loop • Don’t allow anyone to happen. Deadlock

  36. Deadlock on a bridge

  37. Note: Deadlockoccurs when OS does not put resource restrictions on processes.

  38. Dining philosophers

  39. Starvation • Starvation – It can happen when OS puts too many resource restrictions on a process. • [ex.] OS specifies possession of all the required resourcesbefore a process can be run

  40. Starvation

  41. Starvation

  42. Figure 7-15.c Starvation

  43. Device manager • I/O manager – is responsible for access to I/O devices. • Assure that the devices are functioning properly. • Maintain queues • Control scheduling policies

  44. File manager • controls access to the files. • Creation/deletion/modification • Naming • Storage of files • Archiving and backup • Archive – copy files to a long-term storage medium for backup.

  45. 7.4 POPULAR OPERATING SYSTEMS

  46. Popular Operating Systems • Windows 2000 • GUI • Virtual memory • Multiprogramming • UNIX • Portable OS (written mostly in C) • A powerful set of utilities (commands) • Device independent (include device drivers in OS itself) • Linux • Based on UNIX • Make UNIX more efficient when run on an Intel microprocessor

More Related