Skip to document

1. FCFS Scheduling

An example questions on the First Come First Serve - Non-Preemptive -...
Course

Operating Systems Principles (CSCI 340)

16 Documents
Students shared 16 documents in this course
Academic year: 2018/2019
Uploaded by:
0followers
10Uploads
4upvotes

Comments

Please sign in or register to post comments.

Preview text

(FCFS) First Come First Serve ~ Non-Preemptive ~ CPU Scheduling Algorithm

Let Pi be = Process i where ( i = 0, 1, 2, 3, ...) AT be = Arrival Time BT be = Burst Time CT be = Completion Time TAT be = Turnaround Time WT be = Waiting Time Starting Time is always zero to find CT.

Draw Gantt Chart. Calculate CT , TAT , WT.

P AT BT CT TAT WT

P 0 0 5???

P 1 1 3???

P 2 2 8???

P 3 3 6???

Drawing Gantt Chart:

Step 0: Start with an empty Gantt Chart.

t = 012345678910111213141516171819202122

P 0

P 1

P 2

P 3

Step 1: When t = 0 , P 0 arrives and is the only process available. Since this algorithm is non-preemptive, this process will not be paused and will entirely execute.

t = 012345678910111213141516171819202122

P 0 0

P 1

P 2

P 3

Step 2: When t = 5 , P 0 completes and three processes ( P 1 , P 2 , P 3 ) already arrived and are available. Since this algorithm is FCFS, P 1 will execute first by following the order of the process. Also, since this is non-preemptive algorithm, this process will not be paused and will entirely execute.

t = 012345678910111213141516171819202122

P 0 0

P 1 1

P 2

P 3

Step 3: When t = 8 , P 1 completes and two processes ( P 2 , P 3 ) are available. Between P 2 and P 3 , P 2 will go first under FCFS algorithm. P 2 will execute entirely without being paused.

t = 012345678910111213141516171819202122

P 0 0

P 1 1

P 2 2

P 3

Step 4: When t = 16 , P 2 completes and only one process ( P 3 ) is available. P 3 will execute entirely without being paused.

t = 012345678910111213141516171819202122

P 0 0

P 1 1

P 2 2

P 3 3

Calculating CT , TAT , WT :

Let Completion Time ( CT ) be =

for each millisecond

For P 3 : Burst Time ( BT ) is 6 milliseconds ( ms ) and Arrival Time ( AT ) is at t = 3.

t = 012345678910111213141516171819202122

P 3 3

CT 22

TAT 19

WT 13

Completion Time ( CT ) Turnaround Time ( TAT ) Waiting Time ( WT )

=

=

=

Finishing Time – Starting Time Completion Time – Arrival Time Turnaround Time – Burst Time

CT = 22 − 0 = 22

TAT = 22 − 3 = 19

WT = 19 − 6 = 13

P AT BT CT TAT WT

P 0 0 5 5 5 0

P 1 1 3 8 7 4

P 2 2 8 16 14 6

P 3 3 6 22 19 13

Made By: asifroni673@gmail asif@qmail.cuny

Was this document helpful?

1. FCFS Scheduling

Course: Operating Systems Principles (CSCI 340)

16 Documents
Students shared 16 documents in this course
Was this document helpful?
asifroni673@gmail.com
(FCFS) First Come First Serve ~ Non-Preemptive ~ CPU Scheduling Algorithm
Let
Pi
be = Process
i
where (
i
= 0,
1, 2, 3, …)
AT
be = Arrival Time
BT
be = Burst Time
CT
be = Completion Time
TAT
be = Turnaround Time
WT
be = Waiting Time
Starting Time is always zero to find
.
Draw Gantt Chart.
Calculate
CT
,
TAT
,
WT
.
P
AT
BT
TAT
WT
P0
0 5 ? ? ?
P1
1 3 ? ? ?
P2
2 8 ? ? ?
P3
3 6 ? ? ?
Drawing Gantt Chart:
Step 0: Start with an empty Gantt Chart.
t=0 12 3 4 5 6 7 8 9 10 11 1213 14 15 16 17 18 19 2021 22
P0
P1
P2
P3
Step 1: When
t=0
,
P0
arrives and is the only process available. Since this algorithm
is non-preemptive, this process will not be paused and will entirely execute.
t=0 12 3 4 5 6 7 8 9 10 11 1213 14 15 16 17 18 19 2021 22
P0
0
P1
P2
P3