Test: Process Synchronization- 2

20 Questions MCQ Test Operating System | Test: Process Synchronization- 2

This mock test of Test: Process Synchronization- 2 for Computer Science Engineering (CSE) helps you for every Computer Science Engineering (CSE) entrance exam. This contains 20 Multiple Choice Questions for Computer Science Engineering (CSE) Test: Process Synchronization- 2 (mcq) to study with solutions a complete question bank. The solved questions answers in this Test: Process Synchronization- 2 quiz give you a good mix of easy questions and tough questions. Computer Science Engineering (CSE) students definitely take this Test: Process Synchronization- 2 exercise for a better result in the exam. You can find other Test: Process Synchronization- 2 extra questions, long questions & short questions for Computer Science Engineering (CSE) on EduRev as well by searching above.

What is the name of the operating system that reads and reacts in terms of operating system?


A real-time operating system is an operating system that guarantees to process events or data by a specific moment in time. Option (C) is correct.


Which of the following need not necessarily be saved on a Context Switch between processes?


The values stored in registers, stack pointers and program counters are saved on context switch between the processes so as to resume the execution of the process. There's no need for saving the contents of TLB as it is being invalid after each context switch. So, option (B) is correct


Fork is


fork() creates a new process by duplicating the calling process, The new process, referred to as child, is an exact duplicate of the calling process, referred to as parent, except for the following : The child has its own unique process ID, and this PID does not match the ID of any existing process group. The child’s parent process ID is the same as the parent’s process ID. The child does not inherit its parent’s memory locks and semaphore adjustments. The child does not inherit outstanding asynchronous I/O operations from its parent nor does it inherit any asynchronous I/O contexts from its parent. So, option (D) is correct.


Dining Philosopher's problem is a:


Dining Philosopher's problem is a Classical IPC problem. Option (B) is correct.


Round Robin schedule is essentially the pre-emptive version of


FIFO when implemented in preemptive version, acts like a round-robin algorithm. So, option (A) is correct.


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?


Throughput means total number of tasks executed per unit time i.e. sum of waiting time and burst time. Shortest job first scheduling is a scheduling policy that selects the waiting process with the smallest execution time to execute next. Thus, in shortest job first scheduling, shortest jobs are executed first. This means CPU utilization is maximum. So, maximum number of tasks are completed. Option (B) is correct.


In an operating system, indivisibility of operation means:


In an operating system, indivisibility of operation means processor can not be pre-empted. One a process starts its execution it will not suspended or stop its execution inside the processor. So, option (C) is correct.


Which is the correct definition of a valid process transition in an operating system?


The statetransition diagram of a process(preemptive scheduling):

Option 1: Wake up: ready → running It is incorrect as when a process wakes up it is shifted from blocked state to ready state and not from ready to running. Option 2: Dispatch: ready → running It is correct as the dispatcher selectively assigns the CPU to one of the process in the ready queue based on a well defined algorithm. Option 3: Block: ready → running It is incorrect as a process is blocked when it is either pre-empted by some other process or due to some i/o operation. So when a process gets blocked it shifts from running state to blocked state. Option 4: Timer runout: ready → running When the time duration of execution of a process expires, the timer interrupts and the process shifts from the running state to ready queue. So, option (B) is correct.


The performance of Round Robin algorithm depends heavily on


In round robin algorithm, the size of time quanta plays a very important role as: If size of quanta is too small: Context switches will increase and it is counted as the waste time, so CPU utilization will decrease. If size of quanta is too large: Larger time quanta will lead to Round robin regenerated into FCFS scheduling algorithm. So, option (D) is correct.


Process is:


A process is termed as a program in execution. Whenever a program needs to be executed, its process image is created inside the main memory and is placed in the ready queue. Later CPU is assigned to the process and it starts its execution. So, option (C) is correct.


Four jobs to be executed on a single processor system arrive at time 0 in the order A, B, C, D . Their burst CPU time requirements are 4, 1, 8, 1 time units respectively. The completion time of A under round robin scheduling with time slice of one time unit is


The order of execution of the processes with the arrival time of each process = 0, using round robin algorithm with time quanta = 1 A B C D A C A C A, i.e, after 8 context switches, A finally completes it execution So, the correct option is (D).


There are three processes in the ready queue. When the currently running process requests for I/O how many process switches take place?


Single process switch will take place as when the currently running process requests for I/O, it would be placed in the blocked list and the first process residing inside the Ready Queue will be placed in the Running list to start its execution. Option (A) is correct.


Two processes X and Y need to access a critical section. Consider the following synchronization construct used by both the processes.


Here, varP and varQ are shared variables and both are initialized to false. Which one of the following statements is true?


When both processes try to enter critical section simultaneously,both are allowed to do so since both shared variables varP and varQ are true.So, clearly there is NO mutual exclusion. Also, deadlock is prevented because mutual exclusion is one of the four conditions to be satisfied for deadlock to happen.Hence, answer is A.


In a certain operating system, deadlock prevention is attempted using the following scheme. Each process is assigned a unique timestamp, and is restarted with the same timestamp if killed. Let Ph be the process holding a resource R, Pr be a process requesting for the same resource R, and T(Ph) and T(Pr) be their timestamps respectively. The decision to wait or preempt one of the processes is based on the following algorithm.
 if T(Pr) < T(Ph)

then kill Pr

else wait
Which one of the following is TRUE?

  1. This scheme is making sure that the timestamp of requesting process is always lesser than holding process
  2. The process is restarted with same timestamp if killed and that timestamp can NOT be greater than the existing time stamp

From 1 and 2,it is clear that any new process coming having LESSER timestamp will be KILLED.So,NO DEADLOCK possible However, a new process will lower timestamp may have to wait  infinitely because of its LOWER timestamp(as killed process will also have same timestamp ,as it was killed earlier).STARVATION IS Definitely POSSIBLE So Answer is A


Suppose we want to synchronize two concurrent processes P and Q using binary semaphores S and T. The code for the processes P and Q is shown below.

Process P:
while (1) {
   print '0';
   print '0';
Process Q:
while (1) {
   print '1';
   print '1';

Synchronization statements can be inserted only at points W, X, Y and Z. Which of the following will always lead to an output staring with '001100110011' ?


P(S) means wait on semaphore ‘S’ and V(S) means signal on semaphore ‘S’. [sourcecode] Wait(S) { while (i <= 0) --S; } Signal(S) { S++; } [/sourcecode] Initially, we assume S = 1 and T = 0 to support mutual exclusion in process P and Q. Since S = 1, only process P will be executed and wait(S) will decrement the value of S. Therefore, S = 0. At the same instant, in process Q, value of T = 0. Therefore, in process Q, control will be stuck in while loop till the time process P prints 00 and increments the value of T by calling the function V(T). While the control is in process Q, semaphore S = 0 and process P would be stuck in while loop and would not execute till the time process Q prints 11 and makes the value of S = 1 by calling the function V(S). This whole process will repeat to give the output 00 11 00 11 … .
Thus, B is the correct choice.


Which of the following does not interrupt a running process?


Scheduler process doesn’t interrupt any process, it’s Job is to select the processes for following three purposes. Long-term scheduler(or job scheduler) –selects which processes should be brought into the ready queue Short-term scheduler(or CPU scheduler) –selects which process should be executed next and allocates CPU. Mid-term Scheduler (Swapper)- present in all systems with virtual memory, temporarily removes processes from main memory and places them on secondary memory (such as a disk drive) or vice versa. The mid-term scheduler may decide to swap out a process which has not been active for some time, or a process which has a low priority, or a process which is page faulting frequently, or a process which is taking up a large amount of memory in order to free up main memory for other processes, swapping the process back in later when more memory is available, or when the process has been unblocked and is no longer waiting for a resource.


What is the name of the technique in which the operating system of a computer executes several programs concurrently by switching back and forth between them?


In a multitasking system, a computer executes several programs simultaneously by switching them back and forth to increase the user interactivity. Processes share the CPU and execute in an interleaving manner. This allows the user to run more than one program at a time. Option (B) is correct.


A task in a blocked state


Waiting or Blocked state is when a process has requested some input/output and is waiting for the resource. So, option (D) is correct.


Consider the following statements about process state transitions for a system using preemptive scheduling.

I. A running process can move to ready state.
II. A ready process can move to running state.
III. A blocked process can move to running state.
IV. A blocked process can move to ready state.

Which of the above statements are TRUE ?


According to process state transitions for a system using preemptive scheduling:

So, a blocked process can NOT move to running state. Only statements I, II, and IV are correct. Option (C) is true.


Consider the methods used by processes P1 and P2 for accessing their critical sections whenever needed, as given below. The initial values of shared boolean variables S1 and S2 are randomly assigned.
Method Used by P1
while (S1 == S2) ;
Critica1 Section
S1 = S2;

Method Used by P2
while (S1 != S2) ;
Critica1 Section
S2 = not (S1);
Which one of the following statements describes the properties achieved?


It can be easily observed that the Mutual Exclusion requirement is satisfied by the above solution, P1 can enter critical section only if S1 is not equal to S2, and P2 can enter critical section only if S1 is equal to S2. But here Progress Requirement is not satisfied. Suppose when s1=1 and s2=0 and process p1 is not interested to enter into critical section but p2 want to enter critical section. P2 is not able to enter critical section in this as only when p1 finishes execution, then only p2 can enter (then only s1 = s2 condition be satisfied). Progress will not be satisfied when any process which is not interested to enter into the critical section will not allow other interested process to enter into the critical section.

Related tests