Chapter 10 Operating Systems.

Slides:



Advertisements
Similar presentations
Operating Systems Chapter 6.
Advertisements

Operating System CS105. Objectives Role of an operating system Manages resources – Memory – CPU – Secondary storage – I/O devices Memory CPU Hard Disk.
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition Chapter 5: CPU Scheduling.
Operating Systems Chapter 6
Chapter 5 CPU Scheduling. CPU Scheduling Topics: Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling.
Operating System Concepts with Java – 7 th Edition, Nov 15, 2006 Silberschatz, Galvin and Gagne ©2007 Processes and Their Scheduling.
Chapter 10 Operating Systems. 2 Chapter Goals Describe the two main responsibilities of an operating system Define memory and process management Explain.
Chapter 3: CPU Scheduling
Silberschatz, Galvin and Gagne ©2009 Operating System Concepts – 8 th Edition, Chapter 5: CPU Scheduling.
CS 311 – Lecture 23 Outline Kernel – Process subsystem Process scheduling Scheduling algorithms User mode and kernel mode Lecture 231CS Operating.
Scheduling in Batch Systems
Chapter 6: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts – 7 th Edition, Feb 2, 2005 Chapter 6: CPU Scheduling Basic.
Chapter 10 Operating Systems. 2 Chapter Goals Describe the two main responsibilities of an operating system Define memory and process management Explain.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 6: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms.
What we will cover…  CPU Scheduling  Basic Concepts  Scheduling Criteria  Scheduling Algorithms  Evaluations 1-1 Lecture 4.
Chapter 5-CPU Scheduling
Computer Organization and Architecture
02/11/2004CSCI 315 Operating Systems Design1 CPU Scheduling Algorithms Notice: The slides for this lecture have been largely based on those accompanying.
Chapter 10 Operating Systems. 2 Chapter Goals Describe the two main responsibilities of an operating system Define memory and process management Explain.
Chapter 10 Operating Systems. 2 Chapter Goals Describe the two main responsibilities of an operating system Define memory and process management Explain.
Chapter 10 Operating Systems.
Chapter 10 Operating Systems Nell Dale • John Lewis.
Chapter 10 Operating Systems *. 2 Chapter Goals Describe the main responsibilities of an operating system Define memory and process management Explain.
Chapter 6: CPU Scheduling
Chapter 4 Processor Management
CS212: OPERATING SYSTEM Lecture 3: Process Scheduling 1.
CPS120: Introduction to Computer Science Operating Systems Nell Dale John Lewis.
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.
Chapter 10 Operating Systems.
Scheduling. Alternating Sequence of CPU And I/O Bursts.
CIS250 OPERATING SYSTEMS Memory Management Since we share memory, we need to manage it Memory manager only sees the address A program counter value indicates.
6 Memory Management and Processor Management Management of Resources Measure of Effectiveness – On most modern computers, the operating system serves.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
Alternating Sequence of CPU And I/O Bursts. Histogram of CPU-burst Times.
CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Thread Scheduling Multiple-Processor Scheduling Operating Systems Examples Algorithm.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
10-1 Software Categories Application software Software written to address specific needs—to solve problems in the real world Word processing programs,
By Teacher Asma Aleisa Year 1433 H.   Goals of memory management  To provide a convenient abstraction for programming.  To allocate scarce memory.
1 11/29/2015 Chapter 6: CPU Scheduling l Basic Concepts l Scheduling Criteria l Scheduling Algorithms l Multiple-Processor Scheduling l Real-Time Scheduling.
Silberschatz and Galvin  Operating System Concepts Module 5: CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor.
1 CS.217 Operating System By Ajarn..Sutapart Sappajak,METC,MSIT Chapter 5 CPU Scheduling Slide 1 Chapter 5 CPU Scheduling.
6.1 CPU Scheduling Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Purpose of Operating System Part 2 Monil Adhikari.
Chapter 10 Operating Systems. 2 Chapter Goals Describe the responsibilities of an operating system Define memory and process management Explain how timesharing.
Silberschatz, Galvin and Gagne ©2011 Operating System Concepts Essentials – 8 th Edition Chapter 2: The Linux System Part 4.
Chapter 4 CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms Multiple-Processor Scheduling Real-Time Scheduling Algorithm Evaluation.
Memory management The main purpose of a computer system is to execute programs. These programs, together with the data they access, must be in main memory.
1 Module 5: Scheduling CPU Scheduling Scheduling Algorithms Reading: Chapter
Basic Concepts Maximum CPU utilization obtained with multiprogramming
1 Lecture 5: CPU Scheduling Operating System Fall 2006.
Lecturer 5: Process Scheduling Process Scheduling  Criteria & Objectives Types of Scheduling  Long term  Medium term  Short term CPU Scheduling Algorithms.
Chapter 5: CPU Scheduling. 5.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts Chapter 5: CPU Scheduling Basic Concepts Scheduling Criteria.
1 Chapter 5: CPU Scheduling. 2 Basic Concepts Scheduling Criteria Scheduling Algorithms.
Chapter 10 Operating Systems.
Chapter 2: The Linux System Part 4
Memory Management.
Chapter 2 Memory and process management
Chapter 10 Operating Systems.
Chapter 8: Main Memory.
Process management Information maintained by OS for process management
Chapter 6: CPU Scheduling
Chapter 5: CPU Scheduling
Introduction What is an operating system bootstrap
Operating System Concepts
Main Memory Background Swapping Contiguous Allocation Paging
Chapter 10 Operating Systems.
Mid-Term Review Good Results Always Answer Questions
Presentation transcript:

Chapter 10 Operating Systems

Software Categories

Software Categories Application software is written to address our specific needs—to solve problems in the real world. Word processing programs, games, inventory control systems, automobile diagnostic programs, and missile guidance programs are all application software. System software manages a computer system at a fundamental level. It provides the tools and an environment in which application software can be created and run.

System Software Within the class of system software are two categories: Utility software programs for performing various activities fundamental to computer installations, but not part of the OS. (Examples include formating a disk, networking, copying files, using a modem, and data compression.) Operating Systems

Operating System An operating system also consists of two parts. The kernel manages computer resources, such as memory and input/output devices. The shell provides an interface through which a human can interact with the computer. An operating system also allows application programs to interact with the other system resources.

Operating System Figure 10.1 An operating system interacts with many aspects of a computer system.

Operating System The various roles of an operating system generally revolve around the idea of “sharing nicely”. An operating system manages resources, and these resources are often shared in one way or another among programs that “want” to use them.

Managing Resources Resource management consists of: Memory management Process management CPU scheduling

Memory Management Memory management keeps track of what is stored in memory and where in memory it is. Multiprogramming is the technique of keeping multiple programs in main memory at the same time. These programs compete for access to the CPU so that they can execute.

Memory Figure 10.3 Memory is a continuous set of bits referenced by specific addresses

Logical and Physical Addresses A program may include instructions that transfer control. For example, in BASIC a programmer can say GOTO 200 where 200 is the line number of the instruction to be executed next. This line number is relative to the start of the program and so is a logical address. However, the physical address is the actual location in memory where this instruction is stored.

Memory Management A logical address (sometimes called a virtual or relative address) is a value that specifies a generic location, relative to the program but not to the reality of main memory. A physical address is an actual address in the main memory device. Operating systems must employ techniques to: Track where and how a program resides in memory. Convert logical program addresses into actual memory addresses.

Memory Management There are three approaches to memory management depending on how we conceive of memory being organised: Single Contiguous Memory Partitioned Memory Paged Memory

Single Contiguous Memory Management There are only two programs in memory The operating system The application program This approach is called single contiguous memory management. Figure 10.4 Main memory divided into two sections

Single Contiguous Memory Management In this system, a logical address is simply an integer value relative to the starting point of the program. To produce a physical address, we add a logical address to the starting address of the program in physical main memory.

Single Contiguous Memory Management Figure 10.5 binding a logical address to a physical one

Partition Memory Management When using fixed partitions, main memory is divided into a particular number of partitions. When using dynamic partitions, the partitions are created to fit the need of the programs.

Partition Memory Management At any point in time, memory is divided into a set of partitions, some empty and some allocated to programs. The Base register holds the beginning address of the current partition. The Bounds register holds the length of the current partition. Figure 10.6 Address resolution in partition memory management

Partition Selection First fit Best fit Worst fit Program is allocated to the first partition big enough to hold it. Best fit Program is allocated to the smallest partition big enough to hold it. Worst fit Program is allocated to the largest partition big enough to hold it.

Paged Memory Management Paged memory technique: main memory is divided into small fixed-size blocks of storage called frames. A program is divided into pages that (for the sake of our discussion) we assume are the same size as a frame. The operating system maintains a separate page-map table (PMT) for each program in memory.

Paged Memory Management To produce a physical address, you first look up the page in the PMT to find the frame number in which it is stored. Then multiply the frame number by the frame size and add the offset to get the physical address. Figure 10.7 A paged memory management approach

Paged Memory Management An important extension is demand paging. Not all parts of a program actually have to be in memory at the same time. In demand paging, the pages are brought into memory on demand. The act of bringing in a page from secondary memory, which often causes another page to be written back to secondary memory, is called a page swap.

Paged Memory Management The demand paging approach gives rise to the idea of virtual memory, the illusion that there are no restrictions on the size of a program. Too much page swapping, however, is called thrashing and can seriously degrade system performance.

Resource Management A process can be defined as a program in execution. The operating system performs process management to carefully track the progress of each process and all of its intermediate states.

Batch Processing Figure 10.2 In early systems, human operators would organize jobs into batches

Timesharing Multiprogramming allowed multiple processes to be active at once, which gave rise to the ability for programmers to interact with the computer system directly, while still sharing its resources. A timesharing system allows multiple users to interact with a computer at the same time. In a timesharing system, each user has his or her own virtual machine, in which all system resources are (in effect) available for use.

Process Management The Process States Figure 10.8 The process life cycle

The Process Control Block The operating system must manage a large amount of data for each active process. Usually that data is stored in a data structure called a process control block (PCB). Each state is represented by a list of PCBs, one for each process in that state.

The Process Control Block Keep in mind that there is only one CPU and therefore only one set of CPU registers. These registers contain the values for the currently executing process. The values define the state of the machine at any given time. Each time a process is moved to the running state: Register values for the interrupted process are stored into its PCB. Register values of the process admitted to the running state are loaded into the CPU from its waiting state PCB. This exchange of information is called a context switch.

CPU Scheduling The act of determining which process in the ready state should be moved to the running state. That is, decide which process should be given over to the CPU.

CPU Scheduling Nonpreemptive scheduling occurs when the currently executing process gives up the CPU voluntarily. Preemptive scheduling occurs when the operating system decides to favour another process, preempting the currently executing process. Turnaround time for a process is the amount of time between when the process arrives in the ready state to the time it exits the running state for the last time.

CPU Scheduling In each of the following examples we will consider 5 processes arriving in the Ready state. The service time for each is listed in this table. How does the dispatcher decide their order?

First-Come, First-Served The first ordering structure that comes to mind is the queue. Processes are moved to the CPU in the order in which they arrive in the Ready state. FCFS scheduling is nonpreemptive – one process completes before the next begins.

First-Come, First-Served The Gantt Chart below shows the order and turn around time for the 5 processes. Page 336

First-Come, First-Served Process Turn Around Time p1 140 p2 215 p3 535 p4 815 p5 940 Average 529 Page 336

Shortest Job Next This technique looks at all processes in the Ready state and dispatches the one with the shortest service time. It is also generally implemented as a nonpreemptive algorithm.

Shortest Job Next The same 5 processes produce a much smaller average turn around time. SJN is provably optimal as a strategy. It’s weakness is that it relies on knowledge of the future. Process Turn Around Time p2 75 p5 200 p1 340 p4 620 p3 940 Average 435

Round Robin Scheduling …distributes the processing time equitably among all ready processes. The algorithm establishes a particular time slice (or quantum), which is the amount of time each process receives before being preempted. It is then returned to the ready state to allow another process its turn. The Round-robin algorithm is preemptive.

Round Robin Scheduling Suppose the time slice is 50. This Gannt Chart shows how the processes will be scheduled. Process Turn Around Time p1 515 p2 325 p3 940 p4 920 p5 640 Average 668

Round Robin Scheduling Notice that Round Robin is much less efficient in principle. However, multiprogramming requires a pre-emptive strategy. Can you think of a reason?