Assignment-2 on CPU Scheduling
Assignment-2 on CPU Scheduling
2. Consider the following set of processes, with the length of the CPU burst and arrival
time given in milliseconds.
Process Burst Time Arrival Time
P1 8 0
P2 4 0.4
P3 1 1
a) Draw four Gantt charts that illustrate the execution of these processes using the
following scheduling algorithms: FCFS, SJF, Clairvoyant SJF (the algorithm can
look into the future and wait for a shorter process that will arrive).
b) What is the turnaround time of each process for each of the scheduling algorithms
in part a?
c) What is the waiting time of each process for each of the scheduling algorithms in
part a?
d) Which of the algorithms in part (a) results in the minimum average waiting time
(over all processes)?
3. The arrival time, priority, and duration of the CPU and I/O bursts for each of three
processes P1, P2 and P3 are given in the table below. Each process has a CPU burst
followed by an I/O burst followed by another CPU burst. Assume that each process
has its own I/O resource.
7. Consider a system which requires 40-time units of burst time. The Multilevel
feedback queue scheduling is used and time quantum is 2 unit for the top queue and is
incremented by 5 unit at each level, then in what queue the process will terminate the
execution?
8. Consider a uniprocessor system executing three tasks T1, T2 and T3, each of which
is composed of an infinite sequence of jobs (or instances) which arrive periodically at
intervals of 3, 7 and 20 milliseconds, respectively. The priority of each task is the
inverse of its period, and the available tasks are scheduled in order of priority, with
the highest priority task scheduled first. Each instance of T1, T2 and T3 requires an
execution time of 1,2 and 4 milliseconds, respectively. Given that all tasks initially
arrive at the beginning of the 1st millisecond and task preemptions are allowed, when
does the first instance of T3 completes its execution in milliseconds?
9. Three processes A, B and C each execute a loop of 100 iterations. In each iteration of
the loop, a process performs a single computation that requires tc CPU milliseconds
and then initiates a single I/O operation that lasts for tio milliseconds. It is assumed
that the computer where the processes execute has sufficient number of I/O devices to
each process. Also, the scheduling overhead of the OS is negligible. The processes
have the following characteristics: