14
More than a program A process is a program in execution. A process execution must progress in a sequential manner. A process includes: program counter stack data section What is a process?

Scheduling Slides

Embed Size (px)

DESCRIPTION

os

Citation preview

Module 4: Processes

More than a programA process is a program in execution.A process execution must progress in a sequential manner.A process includes: program counter stack data section What is a process?

1This should actually be moved to Chapter 1. This definition appears on Ch 1, p. 17 of the textbook.

As a process executes, it changes statenew: The process is being createdrunning: Instructions are being executedwaiting: The process is waiting for some event to occurready: The process is waiting to be assigned to a processterminated: The process has finished executionProcess State

Diagram of Process State

Information associated with each processProcess stateProgram counterCPU registersCPU scheduling informationMemory-management informationAccounting informationI/O status information

Process Control Block (PCB)

Process Control Block (PCB)

CPU Switch From Process to Process

Job queue set of all processes in the systemReady queue set of all processes residing in main memory, ready and waiting to executeDevice queues set of processes waiting for an I/O deviceProcesses migrate among the various queuesProcess Scheduling Queues

Ready Queue And Various I/O Device Queues

Representation of Process Scheduling

Long-term scheduler (or job scheduler) selects which processes should be brought into the ready queueShort-term scheduler (or CPU scheduler) selects which process should be executed next and allocates CPUSchedulers

Addition of Medium Term Scheduling

Short-term scheduler is invoked very frequently (milliseconds) (must be fast)Long-term scheduler is invoked very infrequently (seconds, minutes) (may be slow)The long-term scheduler controls the degree of multiprogrammingProcesses can be described as either:I/O-bound process spends more time doing I/O than computations, many short CPU burstsCPU-bound process spends more time doing computations; few very long CPU burstsSchedulers (Cont.)

When CPU switches to another process, the system must save the state of the old process and load the saved state for the new process

Context-switch time is overhead; the system does no useful work while switching

Time dependent on hardware supportContext Switch

THANK YOU