0% found this document useful (0 votes)
10 views4 pages

M2S2-SUPPLEMENTARY1

The document outlines non-preemptive CPU scheduling techniques, focusing on First-Come First-Served (FCFS), Shortest Job First (SJF), and Priority Scheduling. It provides examples with Gantt charts and calculations for average waiting and turnaround times for each technique. Additionally, references for further reading on operating system concepts are included.

Uploaded by

Charles Uy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views4 pages

M2S2-SUPPLEMENTARY1

The document outlines non-preemptive CPU scheduling techniques, focusing on First-Come First-Served (FCFS), Shortest Job First (SJF), and Priority Scheduling. It provides examples with Gantt charts and calculations for average waiting and turnaround times for each technique. Additionally, references for further reading on operating system concepts are included.

Uploaded by

Charles Uy
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Applied Operating System

Educational Resources Information

Module Number Sub Topic Number Supplementary Level


2 2 1

SUBTOPIC 2: CPU SCHEDULING TECHNIQUES – NON PREEMPTIVE

FIRST-COME FIRST-SERVED (FCFS)

• FCFS is the simplest CPU-scheduling algorithm.


• The process that requests the CPU first gets the CPU first.
• The FCFS algorithm is non-preemptive.

Example 1:

• Consider the following set of processes that arrive at time 0, with the length of the CPU
burst given in milliseconds (ms).
• Illustrate the Gantt chart and compute for the average waiting time and average
turnaround time

Given:
Arrival Burst Waiting Turnaround
Process
Time time Time Time
P1 0 5 0-0 = 0 5-0 = 5
P2 0 3 5-0 = 5 8-0 = 8
P3 0 8 8-0 = 8 16-0 =16
P4 0 6 16-0 = 16 22-0 = 22
29/4 51/4
Average
7.25 ms 12.75 ms

Gantt Chart:

1
Formulas:

• Waiting time = Start time – Arrival time


• Turnaround time = Completion time – Arrival time
• Average Waiting Time = Sum of Waiting time / No. of processes
• Average Waiting Time = Sum of Turnaround time / No. of processes

Example 2:
Arrival Burst Waiting Turnaround
Process
Time time Time Time
P1 0 5 0-0 = 0 5-0 = 5
P2 1 3 5-1 = 4 8-1 = 7
P3 2 8 8-2 =6 16-2 = 14
P4 3 6 16-3 = 13 22-3 = 19
23/4 45/4
Average
5.75 ms 11.25 ms

Gantt Chart:

SHORTEST JOB FIRST (SJF)

• SJF algorithm associates with each process the length of the latter’s next CPU burst.

• When the CPU is available, it is assigned to the process that has the smallest next
CPU burst.

• If two processes have the same length next CPU burst, FCFS scheduling is used to
break the tie.

• SJF algorithm is non-preemptive.

2
Example 1:

Arrival Burst Waiting Turnaround


Process
Time time Time Time
P1 0 5 3-0 = 3 8-0 = 8
P2 0 3 0-0 = 0 3-0 =3
P3 0 8 14-0 = 14 22-0 = 22
P4 0 6 8-0 = 8 14-0 =14
25/4 47/4
Average
6.25 ms 11.75 ms

Gantt Chart:

Example 2:

Arrival Burst Waiting Turnaround


Process
Time time Time Time
P1 0 5 0-0 = 0 5-0 = 5
P2 1 3 5-1 = 4 8-1 = 7
P3 2 8 14-2 =12 22-2 = 20
P4 3 6 8-3 = 5 14-3 = 11
21/4 43/4
Average
5.25 ms 10.75 ms

Gantt Chart:

3
PRIORITY SCHEDULING (NP)

• Priority scheduling (non-preemptive) algorithm is one of the most common scheduling


algorithms in batch systems.
• Each process is assigned a priority.
• Process with highest priority is to be executed first and so on.
• Processes with same priority are executed on FCFS basis.
• Priority can be decided based on memory requirements, time requirements or any other
resource requirement.

Example 1:

Consider the lowest priority value gets the highest priority. In this case, process with priority
value (1) is the highest priority.

Arrival Burst Waiting Turnaround


Process Priority
Time time Time Time
P1 0 5 1 0-0 = 0 5-0 = 5
P2 0 3 2 13-0 = 13 16-0 = 16
P3 0 8 1 5-0 = 5 13-0 = 13
P4 0 6 3 16-0 = 16 22-0 = 22
34/4 56/4
Average
8.5 ms 14 ms

Gantt Chart:

REFERENCES

• Siberschatz, A. (2018). Operating System Concepts, Wiley.


• Tomsho, G. (2019). Guide to Operating Systems, Cengage Learning.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy