©Brooks/Cole, 2003 Chapter 7 Operating Systems. ©Brooks/Cole, 2003 Define the purpose and functions of an operating system. Understand the components.

Slides:



Advertisements
Similar presentations
So far Binary numbers Logic gates Digital circuits process data using gates – Half and full adder Data storage – Electronic memory – Magnetic memory –
Advertisements

Processes Management.
7 Operating Systems Foundations of Computer Science ã Cengage Learning.
Operating Systems An operating system is a set of programs that controls how the hardware of a computer works. An operating system provides a means of.
Chap 2 System Structures.
Chapter 10 Operating Systems.
Dr Mohamed Menacer College of Computer Science and Engineering Taibah University CS-334: Computer.
Operating Systems: Software in the Background
©Brooks/Cole, 2003 Chapter 7 Operating Systems. ©Brooks/Cole, 2003 Define the purpose and functions of an operating system. Understand the components.
Chapter 8 Operating System Support
Chapter 11 Operating Systems
©Brooks/Cole, 2003 Chapter 7 Operating Systems Dr. Barnawi.
Computer Organization and Architecture
 2004 Deitel & Associates, Inc. All rights reserved. Chapter 9 – Real Memory Organization and Management Outline 9.1 Introduction 9.2Memory Organization.
CS364 CH08 Operating System Support TECH Computer Science Operating System Overview Scheduling Memory Management Pentium II and PowerPC Memory Management.
Layers and Views of a Computer System Operating System Services Program creation Program execution Access to I/O devices Controlled access to files System.
Chapter 3 Operating Systems Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Chapter 3 Memory Management: Virtual Memory
Operating systems CHAPTER 7.
Operating System A program that controls the execution of application programs An interface between applications and hardware 1.
CHAPTER 2 OPERATING SYSTEM OVERVIEW 1. Operating System Operating System Definition A program that controls the execution of application programs and.
 What is OS? What is OS?  What OS does? What OS does?  Structure of Operating System: Structure of Operating System:  Evolution of OS Evolution of.
Operating Systems.
 Introduction to Operating System Introduction to Operating System  Types Of An Operating System Types Of An Operating System  Single User Single User.
The Operating Systems Layer
CS 1308 Computer Literacy and the Internet. Introduction  Von Neumann computer  “Naked machine”  Hardware without any helpful user-oriented features.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 3: Operating Systems Computer Science: An Overview Tenth Edition.
Chapter 5 Operating System Support. Outline Operating system - Objective and function - types of OS Scheduling - Long term scheduling - Medium term scheduling.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
INVITATION TO COMPUTER SCIENCE, JAVA VERSION, THIRD EDITION Chapter 6: An Introduction to System Software and Virtual Machines.
SWE202 Review. Processes Process State As a process executes, it changes state – new: The process is being created – running: Instructions are being.
6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves.
Chapter 7 Operating Systems. Define the purpose and functions of an operating system. Understand the components of an operating system. Understand the.
Computers Operating System Essentials. Operating Systems PROGRAM HARDWARE OPERATING SYSTEM.
OPERATING SYSTEMS Lecture 3: we will explore the role of the operating system in a computer Networks and Communication Department 1.
Lecture 8: 9/19/2002CS149D Fall CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture.
OPERATING SYSTEMS - I. What is an Operating System OS is a program that manages the computer hardware It provides a basis for application programs and.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
We will focus on operating system concepts What does it do? How is it implemented? Apply to Windows, Linux, Unix, Solaris, Mac OS X. Will discuss differences.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
CPSC 171 Introduction to Computer Science System Software and Virtual Machines.
7.1 7 Operating Systems Foundations of Computer Science  Cengage Learning.
Review for Quiz-2 Applied Operating System Concepts Chap.s 1,2,6,7 - ECE3055b, Spring 2005.
Operating Systems.
©Brooks/Cole, 2003 Chapter 7 Operating Systems 作業系統 ( 電腦的管家婆 )
Chapter 7 Operating Systems Foundations of Computer Science  Cengage Learning 1.
7.1 Operating Systems. 7.2 A computer is a system composed of two major components: hardware and software. Computer hardware is the physical equipment.
©Brooks/Cole, 2003 Chapter 7 Operating Systems. ©Brooks/Cole, 2003 Define the purpose and functions of an operating system. Understand the components.
Operating System (Reference : OS[Silberschatz] + Norton 6e book slides)
CPIT 201 King AbdulAziz University Faculty of Computing & Information Technology Information Technology Department CH (7) Operating System CPIT 201 Introduction.
Chapter 7 Operating Systems.
Applied Operating System Concepts -
Chapter 9 – Real Memory Organization and Management
William Stallings Computer Organization and Architecture
Introduction to Operating System (OS)
Virtual Memory Networks and Communication Department.
7 Operating system Foundations of Computer Science ã Cengage Learning.
Operating systems Lecture 3: we will explore the role of the operating system in a computer Networks and Communication Department.
Main Memory Management
Shell & Kernel Concepts in Operating System
Chapter 15 – Part 1 The Internal Operating System
Operating Systems.
Operating Systems.
Operating Systems : Overview
Operating Systems : Overview
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Presentation transcript:

©Brooks/Cole, 2003 Chapter 7 Operating Systems

©Brooks/Cole, 2003 Define the purpose and functions of an operating system. Understand the components of an operating system. Understand the concept of virtual memory. Understand the concept of deadlock and starvation. After reading this chapter, the reader should be able to: O BJECTIVES List some of the characteristics of popular operating systems such as Windows 2000, UNIX, and Linux.

©Brooks/Cole, 2003 Figure 7-1 Computer System

©Brooks/Cole, 2003 DEFINITIONDEFINITION 7.1

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. Note:

©Brooks/Cole, 2003 EVOLUTIONEVOLUTION 7.2

Evolution-- Batch systems Batch systems Batch systems Each program to be executed was called a job. Each program to be executed was called a job. A programmer who wished to execute a job sent a request to the operating room along with punched cards for the program and data. A programmer who wished to execute a job sent a request to the operating room along with punched cards for the program and data. Operating systems only ensured that all of the resources were transferred from one job to the next. Operating systems only ensured that all of the resources were transferred from one job to the next.

Evolution--Time-sharing systems Multiprogramming Multiprogramming to hold several jobs in memory to hold several jobs in memory only assign a resource to a job that needs it on the condition that the resource is available. only assign a resource to a job that needs it on the condition that the resource is available. Time sharing Time sharing Resource can be shared between different jobs Resource can be shared between different jobs Scheduling Scheduling OS allocates the resources to different programs and deciding which program should use which resource when. OS allocates the resources to different programs and deciding which program should use which resource when. Process Process A job is a program to be run, a process is a program that in memory and waiting for resources. A job is a program to be run, a process is a program that in memory and waiting for resources.

©Brooks/Cole, 2003 Evolution (cont.) Personal systems Personal systems Single-user operating systems Single-user operating systems Example: DOS (disk operating system) Example: DOS (disk operating system) Parallel systems Parallel systems Multiple CPUs on the same machine Multiple CPUs on the same machine Distributed systems Distributed systems A program can be run partially on one computer and partially on another computer if they are connected through an internetwork. A program can be run partially on one computer and partially on another computer if they are connected through an internetwork.

©Brooks/Cole, 2003 COMPONENTSCOMPONENTS 7.3

Figure 7-2 Components of an operating system A operating system has at least four duties: memory manager, process manager, device manager, and file manager. A operating system has at least four duties: memory manager, process manager, device manager, and file manager.

©Brooks/Cole, 2003 Figure 7-3 Monoprogramming

©Brooks/Cole, 2003 Memory manager (1) Monoprogramming Monoprogramming OS load a program, run it, and then replace it with the next program. OS load a program, run it, and then replace it with the next program. Only one program is in memory for execution. Only one program is in memory for execution. Problems: Problems: The program must fit in memory. The program must fit in memory. When one program is being run, no other program can be executed. When one program is being run, no other program can be executed.

©Brooks/Cole, 2003 Figure 7-4 Multiprogramming

©Brooks/Cole, 2003 Figure 7-5 Categories of multiprogramming

©Brooks/Cole, 2003 Memory manager (2) Multiprogramming--Nonswapping Multiprogramming--Nonswapping Partitioning (Fig. 7.6) Partitioning (Fig. 7.6) Memory is divided into variable length sections. Memory is divided into variable length sections. Each section or partition holds one program. Each section or partition holds one program. The CPU switches between programs The CPU switches between programs Problems: Problems: The size of the partitions has to be determined beforehand by the memory manager. The size of the partitions has to be determined beforehand by the memory manager. There may be some holes after programs are replaced by new ones. There may be some holes after programs are replaced by new ones.

©Brooks/Cole, 2003 Figure 7-6 Partitioning

©Brooks/Cole, 2003 Memory manager (3) Multiprogramming--Nonswapping Multiprogramming--Nonswapping Paging Paging Paging improves the efficiency of the partitioning. Paging improves the efficiency of the partitioning. Memory is divided into equally sized sections called frames. Memory is divided into equally sized sections called frames. The program is divided into equally sized sections called pages. The program is divided into equally sized sections called pages. Figure 7.7. Figure 7.7. Problem: the whole programs still needs to be in memory before being executed. Problem: the whole programs still needs to be in memory before being executed.

©Brooks/Cole, 2003 Figure 7-7 Paging

©Brooks/Cole, 2003 Memory manager (4) Multiprogramming--Swapping Multiprogramming--Swapping Demand paging Demand paging The program is divided into pages, but the pages can be loaded into memory one by one, executed, and replaced by another pages. The program is divided into pages, but the pages can be loaded into memory one by one, executed, and replaced by another pages. The size of pages are equal. The size of pages are equal. Demand segmentation Demand segmentation The program is divided into segments (main program and subprograms) that match the programmer ’ s view. The program is divided into segments (main program and subprograms) that match the programmer ’ s view.

©Brooks/Cole, 2003 Memory manager (5) Multiprogramming--Swapping Multiprogramming--Swapping Demand paging and segmentation Demand paging and segmentation A segment may be too large to fit any available free space in memory. A segment may be too large to fit any available free space in memory. Memory can be divided into frames, and a module can be divided into pages. Memory can be divided into frames, and a module can be divided into pages. The pages of a module can then be loaded into memory one by one and executed. The pages of a module can then be loaded into memory one by one and executed.

©Brooks/Cole, 2003 Figure 7-8 Virtual memory

©Brooks/Cole, 2003 Process manager Program Program A program is a nonactive set of instructions written by a programmer and stored on disk. A program is a nonactive set of instructions written by a programmer and stored on disk. Job Job A program becomes a job from the moment it is selected for execution until it has finished running and becomes a program again. A program becomes a job from the moment it is selected for execution until it has finished running and becomes a program again. Process Process A process is a program in execution. A process is a program in execution.

©Brooks/Cole, 2003 State diagram State diagram (Fig. 7.9) State diagram (Fig. 7.9) Hold state Hold state Ready state Ready state Running state Running state Waiting stage Waiting stage Terminated state Terminated state

Figure 7-9 State diagram with the boundaries between a program, a job, and a process

©Brooks/Cole, 2003 Schedulers Job scheduler Job scheduler The job scheduler moves a job from the hold state to the ready state or from the running state to the terminated state. (Fig. 7.10) The job scheduler moves a job from the hold state to the ready state or from the running state to the terminated state. (Fig. 7.10) Process scheduler Process scheduler The process scheduler moves a process from one state to another. (Fig. 7.11) The process scheduler moves a process from one state to another. (Fig. 7.11)

©Brooks/Cole, 2003 Figure 7-10 Job scheduler

©Brooks/Cole, 2003 Figure 7-11 Process scheduler

©Brooks/Cole, 2003 Figure 7-12 Queues for process management

©Brooks/Cole, 2003 Queuing The policies to select the next jog or process: The policies to select the next jog or process: First in, first out (FIFO) (queue) First in, first out (FIFO) (queue) Shortest length first Shortest length first The one with highest priority The one with highest priority And so on... And so on...

©Brooks/Cole, 2003 Process synchronization( 同時 ) Whenever resources can be used by more than one processes, you can have two situations: Whenever resources can be used by more than one processes, you can have two situations: Deadlock( 死結 ) Deadlock( 死結 ) Starvation( 饑餓 ) Starvation( 饑餓 )

©Brooks/Cole, 2003 Figure 7-13 Deadlock

©Brooks/Cole, 2003 Figure 7-14 Deadlock on a bridge

©Brooks/Cole, 2003 Solutions of deadlock Deadlock occurs if the 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 wants. Deadlock occurs if the 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 wants. Solutions of deadlock Solutions of deadlock Not to allow a process to start running until the resources are free. Not to allow a process to start running until the resources are free. To limit the time a process can hold a resource. To limit the time a process can hold a resource.

©Brooks/Cole, 2003 Deadlock occurs when the operating system does not put resource restrictions( 限制 ) on processes. Note:

©Brooks/Cole, 2003 Four necessary conditions Four necessary conditions for deadlock: Four necessary conditions for deadlock: Mutual exclusion Mutual exclusion Only one process can hold a resource. Only one process can hold a resource. Resource holding Resource holding A process holds a resource even though it cannot use it until other resources are available. A process holds a resource even though it cannot use it until other resources are available. No preemption( 優先權 ) No preemption( 優先權 ) The OS cannot temporarily reallocated a resource. The OS cannot temporarily reallocated a resource. Circular waiting Circular waiting All process and resources involved form a loop. All process and resources involved form a loop.

Figure 7-15.a Starvation (1)

Figure 7-15.b Starvation (2)

Figure 7-15.c Starvation (3)

Figure 7-16 Dining philosophers

©Brooks/Cole, 2003 Device manager The device manager is responsible for the efficient use on input/output devices. The device manager is responsible for the efficient use on input/output devices. The responsibilities of a device manager: The responsibilities of a device manager: Monitor every I/O device constantly to assure that the device is functioning properly. Monitor every I/O device constantly to assure that the device is functioning properly. Maintains a queue for each I/O device or one or more queues for similar I/O devices. Maintains a queue for each I/O device or one or more queues for similar I/O devices. Control the different policies for accessing I/O devices. Control the different policies for accessing I/O devices.

©Brooks/Cole, 2003 File manager The responsibilities of a file manager: The responsibilities of a file manager: Control access to files. Control access to files. Supervise ( 監督 ) the creation, deletion, and modification of files. Supervise ( 監督 ) the creation, deletion, and modification of files. Control the naming of files. Control the naming of files. Supervise the storage of files. Supervise the storage of files. Be responsible for archiving ( 檔案保管 ) and backups. Be responsible for archiving ( 檔案保管 ) and backups.

©Brooks/Cole, 2003 User interface Each OS has a user interface. Each OS has a user interface. Examples: Examples: UNIX  shell UNIX  shell Windows  window (graphical user interface, GUI) Windows  window (graphical user interface, GUI)

©Brooks/Cole, 2003 POPULAROPERATINGSYSTEMSPOPULAROPERATINGSYSTEMS 7.4

Popular operating systems Windows 2000 Windows 2000 GUI, virtual memory, multiprogramming, integral networking capability, security features, … GUI, virtual memory, multiprogramming, integral networking capability, security features, … Unix Unix Portable, powerful set of utilities, device independent, … Portable, powerful set of utilities, device independent, … Multiprogramming, virtual memory, well-designed file and directory systems, and short commands. Multiprogramming, virtual memory, well-designed file and directory systems, and short commands. Linux Linux Close to Unix Close to Unix

©Brooks/Cole, 2003 Key terms Batch operating system Batch operating system Deadlock Deadlock Demand paging Demand paging Demand paging and segmentation Demand paging and segmentation Demand segmentation Demand segmentation Device manager Device manager Distributed system Distributed system File manager File manager Frame Frame Hold state Hold state Job Job Job scheduler Linux Memory manager Monoprogramming Multiprogramming Operating system Page Paging Parallel system Partitioning Process Process manager

©Brooks/Cole, 2003 Process scheduler Process scheduler Process synchronization Process synchronization Program Program Queue Queue Ready state Ready state Running stage Running stage Multiprogramming Multiprogramming Scheduling Scheduling Single-user operating system Single-user operating system software software Starvation State diagram Terminated state Time sharing UNIX User interface Virtual memory Waiting state