Docsity

High Performance Computing Lecture 17: Process Management and Scheduling, Slides of Computer Science

Partial preview of the text

Download High Performance Computing Lecture 17: Process Management and Scheduling and more Slides Computer Science in PDF only on Docsity!

High Performance Computing

Lecture 17

2

Some Possible Process States

 A process could be Waiting for something to

happen

 Example: A parent process that made the wait() system call is waiting (sleeping) for its child process to terminate

 A process could be Ready for the OS to

cause it to run

 Running, Waiting, Ready

4

Process Management

 OS should try to maximize processor

utilization

 utilization: fraction of time that the processor is busy

 OS could change status of that process to

`Waiting’ and make another process

`Running’

 Question: Which other process?

 Determined by the process scheduler

5

Process Scheduler

 The part of the OS that manages the sharing

of CPU time among processes

 Possible considerations that the scheduler

could use in making scheduling decisions

 Minimize average program execution time  Fairness to all the programs in execution

7

Process Scheduling Policies

 Preemptive vs Non-preemptive

 Preemptive policy: one where the OS `preempts’ the running process from the CPU even though it is not waiting for something  Idea: give a process some maximum amount of CPU time before preempting it, for the benefit of the other processes  CPU time slice: maximum amount of CPU time allotted to a process before preempting it from the CPU

8

Process State Transition Diagram

Running Ready Waiting preempted or yields CPU scheduled waiting for an event to happen the awaited event happens

10

Non-Preemptive Scheduling Policies

1. First Come First Served (FCFS)

 Idea: Maintain a queue of ready processes  Queue: a data structure with 2 operations

  1. Insert: Add a new process to the back of the queue
  2. Delete: Remove the process from the front of the queue

 Schedule next the process from the front of

the ReadyQ

front P 1 P 2 P 5 back

11

Non-Preemptive Scheduling Policies

1. First Come First Served (FCFS)

 Idea: Maintain a queue of ready processes  Queue: a data structure with 2 operations

  1. Insert: Add a new process to the back of the queue
  2. Delete: Remove the process from the front of the queue

 Schedule next the process from the front of

the ReadyQ

front P 2 P 5 back after P 1 has been scheduled to run

13

Preemptive Scheduling Policies

1. Round robin

 Maintain a FCFS ReadyQ  When the currently running process is preempted, schedule the process from the front of the ReadyQ  Insert the previously running process at the end of the ReadyQ  This is much fairer than any of the non- preemptive scheduling policies