0% found this document useful (0 votes)
14 views13 pages

Unit 2

The document contains a series of questions related to operating systems, specifically focusing on process scheduling, threads, and CPU management. It includes multiple-choice questions, one-liners, and subjective questions that assess knowledge on concepts like preemptive scheduling, thread management, and various scheduling algorithms. Additionally, it features examples for calculating average waiting and turnaround times for given processes.

Uploaded by

Akshat Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views13 pages

Unit 2

The document contains a series of questions related to operating systems, specifically focusing on process scheduling, threads, and CPU management. It includes multiple-choice questions, one-liners, and subjective questions that assess knowledge on concepts like preemptive scheduling, thread management, and various scheduling algorithms. Additionally, it features examples for calculating average waiting and turnaround times for given processes.

Uploaded by

Akshat Joshi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

PARUL UNIVERSITY

PIET/PIT - CSE/IT
Operating System (203105203)

UNIT- 2 ASSIGNMENT - 2
---------------------------------------------------------------------------------------------------------

1) Threads of a process share

a. Global Variables but not heap


b. Heap but not Global Variables
c. Neither Global Variable nor heap
d. Both global variable and heap

---------------------------------------------------------------------------------------------------------

2) Consider the following CPU processes with arrival times (in milliseconds)
and length of CPU bursts (in milliseconds) as given below:

If the pre-emptive shortest remaining time first scheduling algorithm is used


to schedule the processes, then the average waiting time across all processes
is _______ millisecond.

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

---------------------------------------------------------------------------------------------------------

4) 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?

a. Shortest remaining time first


b. Round-robin with time quantum less than the shortest CPU burst
c. Uniform random
d. Highest priority first with priority proportional to CPU burst length

--------------------------------------------------------------------------------------------------------
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.

The average turn around time of these processes is ___________


milliseconds.
a. 8.25
b. 10.25
c. 6.35
d. 4.25
---------------------------------------------------------------------------------------------------------

6) The maximum number of processes that can be in Ready state for a


computer system with n CPUs is

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. On per-thread basis, the OS maintains only CPU register state


b. The OS does not maintain a separate stack for each thread
c. On per-thread basis, the OS does not maintain virtual memory
state
d. On per-thread basis, the OS maintains only scheduling and
accounting information
---------------------------------------------------------------------------------------------------------

8) Multithreading is also called as ____________

a. Concurrency
b. Simultaneity
c. Crosscurrent
d. Recurrent

---------------------------------------------------------------------------------------------------------

9) 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.

Arrival
time
Process Priority CPU time required (hh:mm:ss)

P1 10(highest) 20 sec 00:00:05

P2 9 10 sec 00:00:03

P3 8 (lowest) 15 sec 00:00:00


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.

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:

I. If a process makes a transition D, it would result in another process making


transition A immediately.
II. A process P2 in blocked state can make transition E while another process
P1 is in running state.
III. The OS uses preemptive scheduling.
IV. The OS uses non-preemptive scheduling.
Which of the above statements are TRUE?
a. I and II
b. I and III
c. II and III
d. II and IV
--------------------------------------------------------------------------------------------------------
10) 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?

a. This algorithm is equivalent to the first-come-first-serve algorithm.


b. This algorithm is equivalent to the round-robin algorithm.
c. This algorithm is equivalent to the shortest-job-first algorithm.
d. This algorithm is equivalent to the shortest-remaining-time-first

algorithm

---------------------------------------------------------------------------------------------------------

11) 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

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

---------------------------------------------------------------------------------------------------------

15) A thread is also called ___________

a. Light Weight Process(LWP)


b. Heavy Weight Process(HWP)
c. Process
d. None of the mentioned

---------------------------------------------------------------------------------------------------------

16) Which of the following statements is false about thread?

a. Thread is a lightweight process.


b. Thread takes more time to terminate a running thread than a process.
c. Thread takes less time for switching in between threads.
d. Thread consumes less system resources.
---------------------------------------------------------------------------------------------------------

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?

a. Shortest remaining time first


b. Round-robin with time quantum less than the shortest CPU burst
c. Uniform random
d. Highest priority first with priority proportional to CPU burst length

---------------------------------------------------------------------------------------------------------

20) Which one of the following is FALSE?

a. User level threads are not scheduled by the kernel.


b. When a user level thread is blocked, all other threads of its
process are blocked.
c. Context switching between user level threads is faster than
context switching between kernel level threads.
d. Kernel level threads cannot share the code segment

---------------------------------------------------------------------------------------------------------

21) Which of the following statements is FALSE?

a. The long term scheduler controls the degree of multiprogramming


b. Multiple process of a single program cannot exist
c. Ready queue of the processes resides in main memory
d. A Process can have multiple sub Process
---------------------------------------------------------------------------------------------------------

22) A scheduler which selects processes from Primary memory is called

a. Long Term Scheduler


b. Medium Term Scheduler
c. Short Term Scheduler
d. Job Scheduler

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

---------------------------------------------------------------------------------------------------------

24) Which one of the following is FALSE?

a. User level threads are not scheduled by the kernel.


b. When a user level thread is blocked, all other threads of its
process are blocked.
c. Context switching between user level threads is faster than
context switching between kernel level threads.
d. Kernel level threads cannot share the code segment.

One liner Questions:


1. Process is ________ Activity and Program ____________ Activity.
2. When does a process terminate?
3. List out the name of the section in which process memory can be divided?
4. What is context Switch?
5. What is Thread?
6. Define Process Scheduling.
7. What is Non Pre-emptive Scheduling and Pre-emptive Scheduling?
8. Define Throughput, Turnaround time, waiting time, Load Average and
Response Time.
9. Which system call is used for Process Termination?
10.What is Non Pre-emptive Scheduling and Pre-emptive Scheduling?
11. What is Convoy Effect?

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 .

Process id Average Time Burst 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.

Process id Average Time Burst Time

P1 0 3

P2 1 2

P3 2 1

P4 3 5

P5 4 4

P6 5 2

If the CPU scheduling policy is FCFS and there is 1 unit of overhead in


scheduling the processes, find the efficiency of the algorithm.

(3) Consider the set of 5 processes whose arrival time and burst time are given
below-

Process id Average Time Burst Time

P1 3 1

P2 1 4

P3 4 2

P4 0 6

P5 2 3

If the CPU scheduling policy is SJF non-preemptive, calculate the average


waiting time and average turnaround time.

(4) Consider the set of 5 processes whose arrival time and burst time are given
below-

Process id Average Time Burst Time


P1 3 1

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-

Process id Average Time Burst Time

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-

Process id Average Time Burst Time

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-

Process id Average Time Burst Time

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.

You might also like