• edited by
9,301 views
33 33 votes

We wish to schedule three processes $P1$, $P2$ and $P3$ on a uniprocessor system. The priorities, CPU time requirements and arrival times of the processes are as shown below.
$$\begin{array}{|c|c|c|c|} \hline \textbf{Process} & \textbf{Priority} & \textbf{CPU time} & \textbf{Arrival time}\\
&  & \textbf{required} & \textbf{(hh:mm:ss)}
\\\hline \text{P1} & \text{10 (highest)} & 20\text{ sec} &  00:00:05 \\\hline \text{P2} & 9 & 10 \text{ sec}&  00:00:03 \\\hline \text{P3} & \text{8 (lowest)} & 15 \text{ sec}&  00:00:00 \\\hline  \end{array}$$

We have a choice of preemptive or non-preemptive scheduling. In preemptive scheduling, a late-arriving higher priority process can preempt a currently running process with lower priority. In non-preemptive scheduling, a late-arriving higher priority process must wait for the currently executing process to complete before it can be scheduled on the processor.
What are the turnaround times (time from arrival till completion) of $P2$ using preemptive and non-preemptive scheduling respectively?

  1. $30$ sec, $30$ sec
  2. $30$ sec, $10$ sec
  3. $42$ sec, $42$ sec
  4. $30$ sec, $42$ sec

3 Answers

Best answer
39 39 votes

Answer will be (D).

TAT = Completion Time - Arrival Time.

The Gannt Chart for Non Preemptive scheduling will be $(0)P3,(15)P1,(35)P2(45).$

From above this can be inferred easily that completion time for $P2$ is $45$, for $P1$ is $35$ and $P3$ is $15.$

Gantt Chart for Preemptive-  $(0)P3,(1)P3,(2)P3,(3)P2,(4)P2,(5)P1,(25)P2,(33)P3(45)$.

Similarly take completion time from above for individual processes and subtract it from the Arrival time to get TAT.

• edited by
Answer:
Position:
Show:

Related questions

100 100 votes
7 answers 7 answers
26.4k
26.4k views
Ishrat Jahan asked Nov 3, 2014
26,350 views
A disk has $8$ equidistant tracks. The diameters of the innermost and outermost tracks are $1$ cm and $8$ cm respectively. The innermost track has a storage capacity of $...
55 55 votes
4 answers 4 answers
18.0k
18.0k views
Ishrat Jahan asked Nov 3, 2014
17,965 views
A disk has $8$ equidistant tracks. The diameters of the innermost and outermost tracks are $1$ cm and $8$ cm respectively. The innermost track has a storage capacity of $...
49 49 votes
3 answers 3 answers
11.3k
11.3k views
Ishrat Jahan asked Nov 3, 2014
11,312 views
In a computer system, four files of size $11050$ bytes, $4990$ bytes, $5170$ bytes and $12640$ bytes need to be stored. For storing these files on disk, we can use either...
55 55 votes
7 answers 7 answers
15.7k
15.7k views
Ishrat Jahan asked Nov 3, 2014
15,668 views
Two shared resources $R_1$ and $R_2$ are used by processes $P_1$ and $P_2$. Each process has a certain priority for accessing each resource. Let $T_{ij}$ denote the prior...