Operation Systems
Operation Systems
SYSTEMS
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
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