Process CPU Burst Time (MS) P1 24 P2 3 P3 3
What is the average waiting time of these processes executed using FCFS algorithm.
The First-Come, First-Served (FCFS) scheduling algorithm is the simplest CPU scheduling method. In this method, processes are executed in the order they arrive in the ready queue. Once a process starts executing, it continues until it completes or voluntarily relinquishes the CPU.
We have three processes: P1, P2, and P3. All of them arrived at the same time (time 0). Their respective CPU burst times are given:
| Process | CPU Burst Time (ms) |
|---|---|
| P1 | 24 |
| P2 | 3 |
| P3 | 3 |
Since all processes arrived at time 0, they are processed based on their arrival sequence, which is P1, followed by P2, and then P3.
The waiting time for a process is the total time it spends waiting in the ready queue before it gets the CPU. For FCFS, when all arrive at time 0:
Using the formula: Waiting Time = Turnaround Time - Burst Time. Turnaround Time = Completion Time - Arrival Time. Since Arrival Time is 0, Turnaround Time = Completion Time.
Completion Time (P1) = Burst Time (P1) = 24 ms.
Waiting Time (P1) = 24 ms - 24 ms = 0 ms.
Completion Time (P2) = Completion Time (P1) + Burst Time (P2) = 24 ms + 3 ms = 27 ms.
Waiting Time (P2) = Completion Time (P2) - Burst Time (P2) = 27 ms - 3 ms = 24 ms.
Completion Time (P3) = Completion Time (P2) + Burst Time (P3) = 27 ms + 3 ms = 30 ms.
Waiting Time (P3) = Completion Time (P3) - Burst Time (P3) = 30 ms - 3 ms = 27 ms.
To find the average waiting time, we sum the waiting times of all processes and divide by the total number of processes.
Total Waiting Time = Waiting Time (P1) + Waiting Time (P2) + Waiting Time (P3)
Total Waiting Time = 0 ms + 24 ms + 27 ms = 51 ms.
Number of Processes = 3.
Average Waiting Time = Total Waiting Time / Number of Processes
Average Waiting Time = $ \frac{51 \text{ ms}}{3} $
Average Waiting Time = $ 17 \text{ ms} $.
Therefore, the average waiting time for these processes using the FCFS algorithm is 17 ms.
Assume that the following tasks are to be executed on a single processor system. All tasks have arrived at 0 msec.
| Job ID | CPU |
| a | 4 |
| b | 1 |
| c | 7 |
| d | 2 |
How long does it take for task "a" to complete if the scheduling time slice is a round-robin with 1 ms?
Consider the following table about processes, their burst time and arrival time
| Process | Burst Time | Arrival Time |
| P1 | 09 | 0 |
| P2 | 30 | 0 |
| P3 | 04 | 0 |
| P4 | 08 | 2 |
| P5 | 11 | 6 |
Now which of the process shall finish second last as per the respective GANTT charts for the non- preemptive SJF and Round Robin (time quantum = 10) scheduling methods.