Unit 2
Unit 2
PIET/PIT - CSE/IT
Operating System (203105203)
UNIT- 2 ASSIGNMENT - 2
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
2) Consider the following CPU processes with arrival times (in milliseconds)
and length of CPU bursts (in milliseconds) as given below:
a. 1
b. 2
c. 3
d. 4
---------------------------------------------------------------------------------------------------------
3) Consider the set of processes with arrival time(in milliseconds), CPU burst
time (in milliseconds), and priority(0 is the highest priority) shown below.
None of the processes have I/O burst time.
The average waiting time (in milliseconds) of all the processes using
preemptive priority scheduling algorithm is _____.
a. 29
b. 30
c. 31
d. 32
---------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------
5) Consider the following processes, with the arrival time and the length of
the CPU burst given in milliseconds. The scheduling algorithm used is
preemptive shortest remaining-time first.
a. N
b. n2
c. 2n
d. Independent of n
---------------------------------------------------------------------------------------------------------
7) A thread is usually defined as a “light weight process” because an
operating system (OS) maintains smaller data structures for a thread than for
a process. In relation to this, which of the following is TRUE?
a. Concurrency
b. Simultaneity
c. Crosscurrent
d. Recurrent
---------------------------------------------------------------------------------------------------------
Arrival
time
Process Priority CPU time required (hh:mm:ss)
P2 9 10 sec 00:00:03
a. 30 sec, 30 sec
b. 30 sec, 10 sec
c. 42 sec, 42 sec
d. 30 sec, 42 sec
---------------------------------------------------------------------------------------------------------
10) In the following process state transition diagram for a uniprocessor
system, assume that there are always some processes in the ready state:
Now consider the following statements:
algorithm
---------------------------------------------------------------------------------------------------------
a. I only
b. I and III only
c. II and III only
d. I, II and III
---------------------------------------------------------------------------------------------------------
12) Which of the following scheduling algorithms is non-preemptive?
a. Round Robin
b. First-In First-Out
c. Multilevel Queue Scheduling
d. Multilevel Queue Scheduling With feedback
---------------------------------------------------------------------------------------------------------
13) Consider a set of n tasks with known runtimes r1, r2, … rn to be run on a
uniprocessor machine. Which of the following processor scheduling
algorithms will result in the maximum throughput?
a. Round-Robin
b. Shortest-Job-First
c. Highest-Response-Ratio-Next
d. First-Come-First-Served
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
17) Which of the following level of a thread is the fastest to create and
manage thread?
a. Many-to-Many
b. Kernel
c. Many-to-One
d. User
---------------------------------------------------------------------------------------------------------
18) Which of the following is/are shared by all the threads in a process?
I. Program counter
II. Stack
III. Address space
IV. Registers
a. I and II only
b. III only
c. IV only
d. III and IV only
---------------------------------------------------------------------------------------------------------
19) Consider an arbitrary set of CPU-bound processes with unequal CPU burst
lengths submitted at the same time to a computer system. Which one of the
following process scheduling algorithms would minimize the average waiting
time in the ready queue?
---------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------
23) Interval between the time since submission of the job to the time its
results become available, is called
a. Response Time
b. Throughput
c. Waiting time
d. Turnaround Time
---------------------------------------------------------------------------------------------------------
Subjective Questions:
1. Write Difference Between Program and Process.
2. Explain Process States with Diagram.
3. Explain Process Control Block.
4. Write Difference Between Thread and Process.
5. Differentiate between User Level Thread and Kernel Level Thread.
6. Advantages and disadvantages of User Level and Kernel Level Threads.
7. Define Throughput, Turnaround time, waiting time, Response Time, Load
Average.
8. Difference between Long Term, Short Term, Medium Term Schedulers.
Examples :
(1) Consider the following Processes with CPU execution time.Calculate the
average Waiting time and average turnaround time .
P1 0 2
P2 1 3
P3 2 5
P4 3 4
P5 4 6
(2) Consider the set of 6 processes whose arrival time and burst time are given
below.
P1 0 3
P2 1 2
P3 2 1
P4 3 5
P5 4 4
P6 5 2
(3) Consider the set of 5 processes whose arrival time and burst time are given
below-
P1 3 1
P2 1 4
P3 4 2
P4 0 6
P5 2 3
(4) Consider the set of 5 processes whose arrival time and burst time are given
below-
P2 1 4
P3 4 2
P4 0 6
P5 2 3
If the CPU scheduling policy is SJF preemptive, calculate the average waiting time and average
turnaround time.
(5) Consider the set of 3 processes whose arrival time and burst time are given
below-
P1 0 9
P2 1 4
P3 2 9
If the CPU scheduling policy is SRTF, calculate the average waiting time and
average turn around time.
(6) Consider the set of 5 processes whose arrival time and burst time are given
below-
P1 0 5
P2 1 3
P3 2 1
P4 3 2
P5 4 3
If the CPU scheduling policy is Round Robin with time quantum = 2 unit,
calculate the average waiting time and average turn around time.
(7) Consider the set of 6 processes whose arrival time and burst time are given
below-
P1 5 5
P2 4 6
P3 3 7
P4 1 9
P5 2 2
P6 6 3
If the CPU scheduling policy is Round Robin with time quantum = 3, calculate
the average waiting time and average turn around time.