OS Questions and Answers Set 2


Operating System (OS)

Questions 11 to 20

11.
Three non-preemptive jobs J1, J2, J3 are waiting to be run.  Their expected processor times are 6, 3 and 5 time units respectively.  In which order should they be run to minimize the average response time?
(a)  J1, J2, J3           (b)  J1, J3, J2           (c)  J2, J3, J1           (d)  J2, J1, J3      (e)  J3, J2, J1.
12.
The arrival times of four pre-emptive processes P1, P2, P3 and P4 to the ‘ready to run’ queue and their expected PROCESSOR times are given in the following table.
Process
Arrival Time
Expected PROCESSOR Time
P1
0
6
P2
1
4
P3
2
8
P4
3
5
If these processes are scheduled by using the pre-emptive Shortest-Job-First scheduling algorithm, what would be the possible sequence/sequences of their execution?
(a)  P1, P2, P3, P4                                 (b)  P1, P2, P4, P1, P3
(c)  P1, P2, P3, P4, P3                                                         (d)  P1, P2, P1, P3, P4       
(e)  P1, P3, P2, P4, P3.
13.
If /usr/etc/sunos/utils/emacs and utils/emacs denote the same file, what is the current directory?
(a)  /                        (b)  sunos                (c)  /usr/etc              (d)  emacs               (e)  //.
14.
Let the waiting time of a process for the CPU be the total time the process waiting in the ready to run queue.  Three pre-emptive processes P1, P2, P3 are in the ready to run queue at time 0.  P1 is at the head of the queue and P3 is at the tail.  The expected CPU time for these processes P1, P2, P3 are 24, 3 and 3 time units respectively.  If the PROCESSOR time quantum given for a process to use the CPU continuously is 4 time units, what is the average waiting time for a process if the processes are scheduled using the Round-Robin scheduling algorithm?
(a)  2 time units                                      (b)  9 time units                              (c)  5.66 time units
(d)  8.66 time units                                 (e)  3.66 time units.
15.
Consider a swapping system in which memory consists of the following hole sizes 10K, 4K, 16K, 2K, 11Kbytes.  Which holes are taken for the successive segment requests of 12K, 10K and 9K if the best fit algorithm
(a)  14K, 16K, 11K                                  (b)  14K, 10K, 11K                          (c)  16K, 14K, 11K
(d)  16K, 11K, 14K                                  (e)  10K,14K,16K.
16.
What is not the major objective of operating systems?
(a)   To act as a resource manager for multiple tasks running on the CPU, the memory and disk resources
(b)   To provide a programming interface to the user
(c)   To act as an uniform abstract machine on top of a variety of different hardware platforms
(d)   To act as a File server to client machines requiring such service
(e)   To enable loading and execution of binary code with minimum intervention by the user.
17.
Which of the following statements comparing the context of a thread with that of a process is true?
(a)   Two processes will share any context; two threads of a same process will only share the data and the code (text) areas of the context
(b)   Two processes will not share any context; two threads of a same process will share the data, code (text) and the stack areas of the context
(c)   Two processes will share the data and the code (text) areas of the user context; two threads of a same process will only share the register context
(d)   The overhead involved in context switching for processor is much higher than that for threads
(e)   The overhead involved in context switching for threads is much higher than that for processes.
18.
A certain task is multithreaded in such a way that it is supported by two kernel threads where each kernel thread is supporting more than one user thread.  Which of the following statement is not true about this scenario?
(a)   The task can utilize the combined power of more than one CPU, if CPUs are available
(b)   If a user thread makes a blocking system call, the corresponding kernel thread blocks but the task is still able to continue through the remaining kernel thread
(c)   The task could have been programmed using a thread library such as POSIX  threads or Java threads
(d)   If a user thread makes a blocking system call, the corresponding kernel thread blocks and the task will also be blocked
(e)   Kernel threads capability needs to be built into the operating system, and cannot be provided by a system call library.
19.
One needs a good practical example of a “producer-consumer” type problem from among the following.
(I)    A multithreaded audio server, where a thread writes digitized sound into a circular buffer and another thread reads it over to a web page.
(II)    a printer spooler where files are spooled on to the printer queue, to be taken and printed by the printer driver.
(III)   a shared data base updated by simultaneous queries.
Which of the following is/are true of such a good practical example?
(a)  Only (I) is true                                  (b)  Only (II) is true           (c)  Both (I) and (III) are true
(d)  Both (I) and (II) above                        (e)  All are true.
20.
Demand paging and swapping are two widely used memory management techniques.  Which of the following statements is not true in this regard?
(a)   Moving the whole user context of a process between the main memory and the virtual memory is known as swapping
(b)   Moving pages corresponding to the user context of a process between the main memory and the virtual memory as and when required is known as demand paging
(c)   Demand paging incurs a higher overhead than swapping
(d)   If both demand paging and swapping are implemented by the memory management system, the default mechanism resorted to is demand paging
(e)   When the system’s main memory space becomes comparatively smaller than the space required to run its applications, swapping activity becomes more visible.

Answers

11.
Answer : (c)
Reason:  If the above order is not followed the response time would be more.
12.
Answer : (b)
Reason:  If the order of the jobs is in P1, P2, P4, P1, P3  the average turnaround time would be smaller.
13.
Answer : (b)
Reason:  It is the right choice as other are not satisfying hierarchical structure of file system.
14.
Answer : (c)
Reason:  Average waiting time is 5.66 time units so C is the right choice.
15.
Answer : (b)
Reason:  According to the best fit strategy 14K,10K,11K holes are taken.
16.
Answer : (d)
Reason:  The remaining all are the objectives of OS but not the choice D.
17.
Answer : (d)
Reason:  Remaining all are contradictory.
18.
Answer : (d)
Reason:  D is the right choice according to the scenarios of threads.
19.
Answer : (d)
Reason:  A shared Database updated by simultaneous queries is not a good producer and consumer problem.
20.
Answer : (c)
Reason:  Demand paging doesnot incur high overhead than swapping.






1 comment :