Lab 6 New
Lab 6 New
Objective
Theory:
CPU Scheduling:
CPU scheduling is a method to allocate the CPU to processes in the ready queue. The goal is to
optimize performance measures such as waiting time, turnaround time, and CPU utilization.
Scheduling Algorithms:
● Shortest Job First (SJF): A non-preemptive algorithm where the process with the
shortest burst time is executed first.
● Round Robin (RR): A preemptive scheduling algorithm where each process is assigned
a fixed time quantum. Processes are executed in a cyclic order, ensuring fairness.
Performance Metrics
1. Waiting Time (WT): The time a process spends waiting in the ready queue.
2. Turnaround Time (TAT): The total time taken by a process from arrival to completion.
3. Average Waiting Time (AWT): The average of all waiting times.
4. Average Turnaround Time (ATAT): The average of all turnaround times.
Conclusion
The lab demonstrated the implementation of three CPU scheduling algorithms: FCFS, SJF, and
RR. FCFS is simple to implement but can lead to the "convoy effect," where shorter processes
are delayed by longer ones. SJF minimizes the average waiting time, making it optimal in many
scenarios; however, it requires prior knowledge of burst times, which might not always be
feasible. Round Robin ensures fairness among processes by allocating a fixed time quantum to
each, but it may lead to increased average waiting time depending on the choice of the quantum.