All Exams Test series for 1 year @ ₹349 only
Question

Consider a CPU that has to execute two types of processes. The first type, Actuators (A), requires a CPU burst of 6 seconds. The second type, Controllers (C), requires a CPU burst of 8 seconds. A new process of type A arrives at time $t = 10$, 20, 30, 40, and 50 (in seconds). Similarly, a new process of type C arrives at time $t = 11$, 22, 33, 44, and 55 (in seconds). The CPU scheduling policy is First Come First Serve (FCFS). The first process of type A starts running at $t = 10$ seconds. The average waiting time (in seconds) for the 10 processes is ___________. (rounded off to one decimal place)

FCFS Process Execution Trace

The First Come First Serve (FCFS) scheduling policy processes tasks strictly in the order of their arrival. This scenario involves two types of processes: Actuators (A) with a CPU burst of 6 seconds and Controllers (C) with a CPU burst of 8 seconds. New processes of type A arrive at $t=10, 20, 30, 40, 50$, and type C at $t=11, 22, 33, 44, 55$. The first process of type A begins execution at $t=10$.

We track the start and completion times for each process to determine waiting times.

Process Arrival Time ($t_a$) Burst Time ($t_b$) Start Time ($t_s$) Completion Time ($t_c$) Waiting Time ($t_w$)
A1 10 6 10 16 0
C1 11 8 16 24 5
A2 20 6 24 30 4
C2 22 8 30 38 8
A3 30 6 38 44 8
C3 33 8 44 52 11
A4 40 6 52 58 12
C4 44 8 58 66 14
A5 50 6 66 72 16
C5 55 8 72 80 17

Waiting Time Calculation

The waiting time ($t_w$) for each process is calculated using the formula: $t_w = t_s - t_a$, where $t_s$ is the start time and $t_a$ is the arrival time.

The individual waiting times are listed in the table above.

To find the average waiting time, we sum the waiting times of all 10 processes:

$ \text{Total Waiting Time} = 0 + 5 + 4 + 8 + 8 + 11 + 12 + 14 + 16 + 17 = 95 \text{ seconds} $

There are 10 processes in total. The average waiting time is computed as:

$ \text{Average Waiting Time} = \frac{\text{Total Waiting Time}}{\text{Number of Processes}} = \frac{95}{10} = 9.5 \text{ seconds} $

The average waiting time for the 10 processes is 9.5 seconds, rounded to one decimal place.

Was this answer helpful?

Important Questions from CPU Scheduling

  1. Assume that the following tasks are to be executed on a single processor system. All tasks have arrived at 0 msec.

    Job IDCPU
    a4
    b1
    c7
    d2

    How long does it take for task "a" to complete if the scheduling time slice is a round-robin with 1 ms?

  2. Consider the following processes with CPU Burst time P1, P2, P3 arrived at time 0.
    ProcessCPU Burst Time (MS)
    P124
    P23
    P33

    What is the average waiting time of these processes executed using FCFS algorithm.
  3. Consider the following table about processes, their burst time and arrival time
     

    ProcessBurst TimeArrival Time
    P1090
    P2300
    P3040
    P4082
    P5116


    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.

  4. A computer has two processors, $M_1$ and $M_2$. Four processes $P_1, P_2, P_3, P_4$ with CPU bursts of 20, 16, 25, and 10 milliseconds, respectively, arrive at the same time and these are the only processes in the system. The scheduler uses non-preemptive priority scheduling, with priorities decided as follows:
    • $M_1$ uses priority of execution for the processes as, $P_1 > P_3 > P_2 > P_4$, i.e., $P_1$ and $P_4$ have highest and lowest priorities, respectively.
    • $M_2$ uses priority of execution for the processes as, $P_2 > P_3 > P_4 > P_1$, i.e., $P_2$ and $P_1$ have highest and lowest priorities, respectively.
    A process $P_i$ is scheduled to a processor $M_k$, if the processor is free and no other process $P_j$ is waiting with higher priority. At any given point of time, a process can be allocated to any one of the free processors without violating the execution priority rules. Ignore the context switch time. What will be the average waiting time of the processes in milliseconds?
  5. Processes $P_1, P_2, P_3, P_4$ arrive in that order at times 0, 1, 2, and 8 milliseconds respectively, and have execution times of 10, 13, 6, and 9 milliseconds respectively.
    Shortest Remaining Time First (SRTF) algorithm is used as the CPU scheduling policy. Ignore context switching times.
    Which ONE of the following correctly gives the average turnaround time of the four processes in milliseconds?
Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App