CPU Scheduling GATE CS PYQ Quiz

Last Updated :
Discuss
Comments

Question 1

Consider the 3 processes, P1, P2 and P3 shown in the table.

Process           Arrival time         Time Units Required
P1 0 5
P2 1 7
P3 3 4

The completion order of the 3 processes under the policies FCFS and RR2 (round robin scheduling with CPU quantum of 2 time units) are

  • FCFS: P1, P2, P3
    RR2: P1, P2, P3
  •  FCFS: P1, P3, P2
    RR2: P1, P3, P2
  • FCFS: P1, P2, P3
    RR2: P1, P3, P2
  • FCFS: P1, P3, P2 
    RR2: P1, P2, P3

Question 2

Three processes arrive at time zero with CPU bursts of 16, 20 and 10 milliseconds. If the scheduler has prior knowledge about the length of the CPU bursts, the minimum achievable average waiting time for these three processes in a non-preemptive scheduler (rounded to nearest integer) is _____________ milliseconds.

  • 12

  • 36

  • 46

  • 10

Question 3

A scheduling algorithm assigns priority proportional to the waiting time of a process. Every process starts with priority zero (the lowest priority). The scheduler re-evaluates the process priorities every T time units and decides the next process to schedule. Which one of the following is TRUE if the processes have no I/O operations and all arrive at time zero?

  • This algorithm is equivalent to the first-come-first-serve algorithm

  • This algorithm is equivalent to the round-robin algorithm.

  • This algorithm is equivalent to the shortest-job-first algorithm..

  • This algorithm is equivalent to the shortest-remaining-time-first algorithm

Question 4

Consider the following table of arrival time and burst time for three processes P0, P1 and P2.

Process   Arrival time   Burst Time
P0 0 ms 9 ms
P1 1 ms 4 ms
P2 2 ms 9 ms

The pre-emptive shortest job first scheduling algorithm is used. Scheduling is carried out only at arrival or completion of processes. What is the average waiting time for the three processes?

  • 5.0 ms

  • 4.33 ms

  • 6.33

  • 7.33

Question 5

Which of the following statements are true?

I. Shortest remaining time first scheduling may cause starvation
II. Preemptive scheduling may cause starvation
III. Round robin is better than FCFS in terms of response time
  • I only

  • I and III only

  • II and III only

  • I, II and III

Question 6

An operating system uses Shortest Remaining Time first (SRT) process scheduling algorithm. Consider the arrival times and execution times for the following processes:

Process  Execution time  Arrival time
P1 20 0
P2 25 15
P3 10 30
P4 15 45

What is the total waiting time for process P2?

  • 5

  • 15

  • 40

  • 55

Question 7

Group 1 contains some CPU scheduling algorithms and Group 2 contains some applications. Match entries in Group 1 to entries in Group 2.

     Group I                          Group II
(P) Gang Scheduling (1) Guaranteed Scheduling
(Q) Rate Monotonic Scheduling (2) Real-time Scheduling
(R) Fair Share Scheduling (3) Thread Scheduling
  • P – 3 Q – 2 R – 1

  • P – 1 Q – 2 R – 3

  • P – 2 Q – 3 R – 1

  • P – 1 Q – 3 R – 2

Question 8

Consider three processes, all arriving at time zero, with total execution time of 10, 20 and 30 units, respectively. Each process spends the first 20% of execution time doing I/O, the next 70% of time doing computation, and the last 10% of time doing I/O again. The operating system uses a shortest remaining compute time first scheduling algorithm and schedules a new process either when the running process gets blocked on I/O or when the running process finishes its compute burst. Assume that all I/O operations can be overlapped as much as possible. For what percentage of time does the CPU remain idle?

  • 0%

  • 10.6%

  • 30.0%

  • 89.4%

Question 9

Consider three processes (process id 0, 1, 2 respectively) with compute time bursts 2, 4 and 8 time units. All processes arrive at time zero. Consider the longest remaining time first (LRTF) scheduling algorithm. In LRTF ties are broken by giving priority to the process with the lowest process id. The average turn around time is:

  • 13 units

  • 14 units

  • 15 units

  • 16 units

Question 10

Consider three CPU-intensive processes, which require 10, 20 and 30 time units and arrive at times 0, 2 and 6, respectively. How many context switches are needed if the operating system implements a shortest remaining time first scheduling algorithm? Do not count the context switches at time zero and at the end.

  • 1

  • 2

  • 3

  • 4

There are 31 questions to complete.

Take a part in the ongoing discussion