Multiple choice questions MCQs in OS, Important questions in process management of operating systems course.
Multiple Choice Questions in Operating Systems - Process Management
1. Process A is waiting for the result produced
by process B. Also, process A has higher priority than B. So the OS prefers process
A and refuses to give CPU time to B. Therefore, both A and B are stuck. What is
this scenario called?
(a) Starvation
(b) Deadlock
(c) Livelock
(d) None of the above
View Answer
Answer: (a)
Starvation
is a condition where a process does not get the resources it needs for a long
time because the resources are being allocated to other processes. It
generally occurs in a Priority based scheduling System. Where High Priority
requests get processed first. Thus a request with least priority may never be
processed.
|
2. Which of the following components
ensures that process can execute within its own address space?
(a) I/O Device
(b) Memory addressing hardware
(c) Stack pointers
(d) All of the above
View Answer
Answer: (b)
Memory
addressing hardware ensures that the process can execute within its own
address space.
|
3. Let the time taken to switch between
user and kernel modes of execution be t1 while the time taken to
switch between two processes be t2. Which of the following is TRUE?
(a) t1 > t2
(b) t1 = t2
(c) t1 < t2
(d) Nothing can be said
about the relation between t1 and t2
View Answer
Answer: (c)
Time
taken to switch two processes is very large as compared to time taken to
switch between kernel and user mode of execution because : Switch between
processes or context switch needs saving the PCB of previous process , saving
registers and then loading the PCB of new process and its registers etc.
However, switch between kernel and user mode of execution, the OS has to just
change a single bit at hardware level which is very fast operation.
|
4. Pipe is used for inter-process
communication. Which statements about PIPE are true?
(a) We may read and write
from pipe at the same time
(b) pipe is used for
unidirectional flow of data
(c) The pipe() system call
requires an array of two integers as parameter
(d) All of the above
View Answer
Answer: (d)
pipe in inter-process
communication
pipe()
is a system call that facilitates inter-process communication. It opens a pipe,
which is an area of main memory that is treated as a "virtual
file". The pipe can be used by the creating process, as well as all its
child processes, for reading and writing.
One
process can write to this "virtual file" or pipe and another
related process can read from it.
If
a process tries to read before something is written to the pipe, the process
is suspended until something is written.
The
pipe system call finds the first two available positions in the process's
open file table and allocates them for the read and write ends of the pipe.
Recall that the open system call allocates only one position in the open file
table.
|
5. 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.
(a) 1
(b) 2
(c) 3
(d) 4
View Answer
Answer: (b)
Simply
a preemptive version of SJF: preempt the running process if a new process arrives
with a CPU burst length less than the remaining time of the current executing
process.
Process
execute in this way.
0
to 10 time units process p1 then switching, 11 to 30 time units process p2
then switching, and 31 to 60 process p3.
Only
two context switching possible (since we did not consider the starting and
ending switching or even the OS scheduler switching)
|
*************
No comments:
Post a Comment