0% found this document useful (0 votes)
9 views15 pages

Operation Systems

Uploaded by

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

Operation Systems

Uploaded by

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

OPERATING

SYSTEMS

MADE BY: XHANI


ALLUSHI
To be
done:

Preemptive Priority and non RR .. compare output for Awt and Tat.
Also consider context switch 2ns ...
Print in C ++ your generalities and one from
chedules applied.”
“Additional scores if you code a simulator
for one from them”.
Here
we have
five
process
es
Understanding the Inputs

• Processes (P1–P5) are arriving at different times:


P1 = 0, P2 = 2, P3 = 4, P4 = 5, P5 = 7
• Priority (lower number = higher priority):
• P2 (0) → Highest
• P5 (1)
• P1 (2)
• P3 (2)
• P4 (3)
• CPU Burst Times:
P1 = 15, P2 = 2, P3 = 4, P4 = 2, P5 = 8
• Step-by-Step Execution:
• Preemptive scheduling means the process with the highest priority (smallest priority number) at any time will execute, even
if another process is already running.
Gantt Chart Construction
•At each time
step, i choose the
process
with the shortest
remaining burst time
among those that
have arrived and add
2 ns for each context
switch.

Completion Times
• P1: 22
• P2: 4
• P3: 26
• P4: 28
• P5: 15
Turnaround Time (TAT) = Completion Time - Arrival Time

• P1 = 22 - 0 = 22
• P2 = 4 - 2 = 2
• P3 = 26 - 4 = 22
• P4 = 28 - 5 = 23
• P5 = 15 - 7 = 8
Waiting Time (WT) = Turnaround Time - Burst Time

• P1 = 22 - 15 = 7
• P2 = 2 - 2 = 0
• P3 = 22 - 4 = 18
• P4 = 23 - 2 = 21
• P5 = 8 - 8 = 0
Avarage Turnaround Time
(TAT)
Final Results:
• Gantt Chart: | P1 | P2 | P1 | P5 | P1 | P3 | P4
|
• Average Turnaround Time = 15.4
• Average Waiting Time = 9.2
Generalities printed on C++
Generalities on C++
Coclusions
• 1. Algorithm Efficiency: In terms of average waiting time (WT) and average turnaround time
(TAT), the SJF Preemptive algorithm fared better than Round Robin.
• While SJF Preemptive's emphasis on shorter burst times reduces wait times overall,
it may cause lengthier processes to starve.
• 2. Impact of Context Switching: Compared to SJF Preemptive, Round Robin's efficiency
is greatly impacted by the overhead caused by its time quantum, which results in a
greater number of context switches.
• 3. Performance vs. Fairness: Round Robin compromises overall efficiency while
guaranteeing fairness by distributing equal time slices.
• Because SJF Preemptive places a higher priority on process efficiency, it is more
suited for settings where prompt action is essential.
Conclusion...
• 4. Measures In brief:
Average TAT: 19.4 ns for Round Robin and 7 ns for SJF
Preemptive. Average WT: 13.2 ns (Round Robin) versus
1.2 ns (SJF Preemptive).
• 5. Algorithm Suitability: Batch processing and other predictable, low-
interactivity systems are most suited for SJF Preemptive.
Round Robin works better in interactive systems where fairness and user
pleasure are top
concerns.
• 6. Implementation and Simulation: Using C++ code, the project showed how
scheduling
algorithms might be applied to mimic SJF Preemptive and Round Robin.
• The results of the algorithm simulation were printed with personal
information, demonstrating programming flexibility.
Thank you

You might also like