- Information
- AI Chat
Was this document helpful?
4. RR Scheduling
Course: Operating Systems Principles (CSCI 340)
16 Documents
Students shared 16 documents in this course
University: Queens College CUNY
Was this document helpful?
asifroni673@gmail.com
(RR) Round Robin ~ Preemptive ~ CPU Scheduling Algorithm
Let
Pi
be = Process
i
where (
i
= 0, 1,
2, 3, …)
q
be = Quantum Time for each
Pi
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
with
q=3
milliseconds,
(ms)
.
Calculate
CT
,
TAT
,
WT
.
P
AT
BT
CT
TAT
WT
P0
07???
P1
24???
P2
41???
Drawing Gantt Chart:
Step 0: Start with an empty Gantt Chart. Let
RT
be =
Pi
’s Remaining Burst Time
and a data structure Queue called
PQueue
with type
Pi
with
q=3ms
.
Note: The process is enqueue to
PQueue
in orderly:
(1) the new process appears at or after its arrival time
(2) the process has remaining burst time (incomplete execution).
The process is dequeue from
PQueue
to be selectively picked for
runtime.
t=0 12 3 4 5 6 7 8 9 10 11 12
RT
P0
7
P1
4
P2
1
PQueue
→ enqueue
⋯
dequeue →
Step 1: When
t=0
,
P0
arrives and is the only process available. Following RR
algorithm, the CPU will check if there is a new process and any other available
process. The new process is
P0
and there are no other available processes.
P0
is enqueued.
PQueue
P0
Then the CPU will selectively pick the process to be executed from the Queue. By