Presentation is loading. Please wait.

Presentation is loading. Please wait.

Silberschatz, Galvin and Gagne  2002 4.1 Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Types of shedulars Process.

Similar presentations


Presentation on theme: "Silberschatz, Galvin and Gagne  2002 4.1 Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Types of shedulars Process."— Presentation transcript:

1 Silberschatz, Galvin and Gagne  2002 4.1 Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Types of shedulars Process states 2-state model 5-state model 6-state model 7-state model Operations on Processes

2 Silberschatz, Galvin and Gagne  2002 4.2 Operating System Concepts Process Concept An operating system executes a variety of programs:  Batch system – jobs  Time-shared systems – user programs or tasks Textbook uses the terms job and process almost interchangeably. Process – a program in execution; process execution must progress in sequential fashion. Program:  Resides on disk; passive entity Peocess  Resides in memory, running on or waiting for cpu; active entiry

3 Silberschatz, Galvin and Gagne  2002 4.3 Process Execution Execution sequence  Fetch  Decode  Execute  Write results  Set PC to next instruction  Repeat Operating System Concepts

4 Silberschatz, Galvin and Gagne  2002 4.4 Process Components A process includes:  CPU state (program counter and other control registers)  code section  data section  Stack (parameters and local variables for sub-functions)  Heap (space for dynamically allocated memory)  Environment (command line parameters)  Process control block (PCB: a kernel data structure) Operating System Concepts

5 Silberschatz, Galvin and Gagne  2002 4.5 Process control block Operating System Concepts A data structure which contains all the information about a running process. Helps OS to manage processes. Used in context switching.

6 Silberschatz, Galvin and Gagne  2002 4.6 Basic Types of Process CPU Bound processes  Which spend more time on cpu and less on I/O e.g. running a mathematical computation like matrix multiplication, running simulations to process given data etc. I/O Bound processes  Which spend more time on I/O and less on CPU e.g. word processors, data entry software etc. Operating System Concepts

7 Silberschatz, Galvin and Gagne  2002 4.7 2-State Process Model Operating System Concepts Not Running Enter Dispatch Pause Wait for an I/O Exit Running

8 Silberschatz, Galvin and Gagne  2002 4.8 CMP320 PUCIT Arif Butt 8 Queuing Diagram (2-State Process Model) Queuing structure for a two state process model is: Limitations If all processes in the queue are always ready to execute only then the above queuing discipline will work But it may also be possible that some processes in the queue are ready to execute, while some are waiting for an I/O operation to complete So the dispatcher has to scan the list of processes looking for the process that is not blocked and is there in the queue for the longest 3/9/2016

9 Silberschatz, Galvin and Gagne  2002 4.9 5-State Model A process may not be in exactly two states when there are more than one processes. For example, when one process has completed its I/O, its can’t get back to CPU because another process may be using it. So this process is ready but can’t run. Also process may be blocked for more than one reasons like: A process may be waiting for an event to occur; e.g. a process has created a child process and is waiting for it to return the result A process may be waiting for a resource which is not available at this time Process has gone to sleep for some time Operating System Concepts

10 Silberschatz, Galvin and Gagne  2002 4.10 Operating System Concepts Process State As a process executes, it changes state  new: The process is being created.  running: Instructions are being executed.  waiting: The process is waiting for some event to occur e.g. I/O completion or any other signal to come.  ready: The process is waiting to be assigned CPU.  terminated: The process has finished execution.

11 Silberschatz, Galvin and Gagne  2002 4.11 Operating System Concepts Process Scheduling Queues Job queue – set of all processes in the system. Ready queue – set of all processes residing in main memory, ready and waiting to execute. Device queues – set of processes waiting for an I/O device. Process migration between the various queues.

12 Silberschatz, Galvin and Gagne  2002 4.12 CMP320 PUCIT Arif Butt 12 3/9/2016 Queuing Diagram (Using 2-Queues Limitation: When an event occurs the dispatcher would have to cycle through the entire Blocked Queue to see which process is waiting for that event. This can cause huge overhead when there may be 100’s or 1000’s of processes

13 Silberschatz, Galvin and Gagne  2002 4.13 Operating System Concepts Ready Queue And Various I/O Device Queues

14 Silberschatz, Galvin and Gagne  2002 4.14 Operating System Concepts Representation of Process Scheduling

15 Silberschatz, Galvin and Gagne  2002 4.15 3/9/2016 CMP320 PUCIT Arif Butt Limitation: This only allows processes which are blocked to be swapped out. What if there is no blocked process but we still need to free up memory? Solution: Add another state Ready Suspended and swap out a process from the ready state 6-State Process Model (one suspended state)

16 Silberschatz, Galvin and Gagne  2002 4.16 3/9/2016 CMP320 PUCIT Arif Butt 7-State Process Model (two suspended state)


Download ppt "Silberschatz, Galvin and Gagne  2002 4.1 Operating System Concepts Chapter 4: Processes Process Concept Process Scheduling Types of shedulars Process."

Similar presentations


Ads by Google