Process Scheduling: Round Robin and Shortest Job Next, Exercises of Computer Science

Various process scheduling techniques, focusing on round robin and shortest job next policies. Students will learn how to calculate the number of processes created, sketch process execution timelines, and calculate response times. Experimentation with linux's nice mechanism is also encouraged.

Typology: Exercises

2012/2013

Uploaded on 04/27/2013

eha
eha 🇮🇳

4.3

(6)

42 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Module 4 (Lectures 16-20) Processes
1. Consider the following pseudo-code program
for (i = 0; i < 3; i++)
fork( );
How many processes will be created when this program is executed? Write a C
program implementing this functionality and experimentally confirm your
answer.
2. A computer system is initially idle. Subsequently, processes are created with the
properties shown in the table below. Assume that time starts at 0 and that a
process arriving at time t does so just before the currently running process (if any)
is preempted. The last column indicates the amount of running time that the
process requires.
Process Id Time of
creation
Number of Time units
of execution required
P1 0 12
P2 3 8
P3 5 6
P4 7 6
Sketch a time line showing how the execution of these processes will be
scheduled by an operating system using Round Robin scheduling with a CPU
quantum of 1 time unit.
3. Repeat question 7 assuming instead that the operating system uses the Shortest
Job Next non-preemptive scheduling policy. Calculate the process response time
(time of process completion minus time of process creation) for each of the 4
processes. Compare the average response time with that under the Round Robin
scheduling policy of question 7.
4. Repeat question 7 assuming that the CPU quantum is 4 time units instead of 1
time unit. Once again, calculate the average response time.
5. Linux provides a mechanism called nice using which you can change the
scheduling priority of a process. Read the manual entry for nice. Experiment with
it while running programs on Linux. Is it useful in reducing program execution
time?
Docsity.com

Partial preview of the text

Download Process Scheduling: Round Robin and Shortest Job Next and more Exercises Computer Science in PDF only on Docsity!

Module 4 (Lectures 16- 20 ) Processes

  1. Consider the following pseudo-code program for (i = 0; i < 3; i++) fork( ); How many processes will be created when this program is executed? Write a C program implementing this functionality and experimentally confirm your answer.
  2. A computer system is initially idle. Subsequently, processes are created with the properties shown in the table below. Assume that time starts at 0 and that a process arriving at time t does so just before the currently running process (if any) is preempted. The last column indicates the amount of running time that the process requires. Process Id Time of creation Number of Time units of execution required P1 0 12 P2 3 8 P3 5 6 P4 7 6 Sketch a time line showing how the execution of these processes will be scheduled by an operating system using Round Robin scheduling with a CPU quantum of 1 time unit.
  3. Repeat question 7 assuming instead that the operating system uses the Shortest Job Next non-preemptive scheduling policy. Calculate the process response time (time of process completion minus time of process creation) for each of the 4 processes. Compare the average response time with that under the Round Robin scheduling policy of question 7.
  4. Repeat question 7 assuming that the CPU quantum is 4 time units instead of 1 time unit. Once again, calculate the average response time.
  5. Linux provides a mechanism called nice using which you can change the scheduling priority of a process. Read the manual entry for nice. Experiment with it while running programs on Linux. Is it useful in reducing program execution time?

Docsity.com