Monday, December 28, 2020

Operating systems multiple choice questions for exams - Set 22

Operating systems exams - multiple choice questions (MCQ) and answers, Objective type questions, OS exam questions, MCQ in system programming, semaphores, marshaling, monitors, race condition


Operating Systems MCQ questions and answers – Set 22

 

1. A race condition is when:

a) Multiple processes are all trying to finish first

b) A process runs too slow

c) The correctness of the code depends upon the timing of the execution

d) None of the above

Answer: (c) The correctness of the code depends upon the timing of the execution       

A race condition is a semantic error. It is a flaw that occurs in the timing or the ordering of events that leads to erroneous program behavior.

A race condition occurs when two threads access a shared variable at the same time. The first thread reads the variable, and the second thread reads the same value from the variable. Then the first thread and second thread perform their operations on the value, and they race to see which thread can write the value last to the shared variable. The value of the thread that writes its value last is preserved, because the thread is writing over the value that the previous thread wrote. [Refer here for more]

 

2. Semaphores, Condition Variables, and Monitors support which of the following set of distinct operations?

a) Parallelization and event notification

b) Synchronization and event notification

c) Synchronization and parallelization

d) None of the above

Answer: (b) Synchronization and event notification  

The operations of semaphores, condition variables and monitors include synchronization and event notification.

The main aim of using a semaphore is process synchronization and access control for a common resource in a concurrent environment. The operations of semaphores are wait and signal.

Condition variables provide a mechanism to wait for events. Condition variables support three operations: Wait, Signal and Broadcast.

Monitors provide a structured concurrent programming primitive, which is used by processes to ensure exclusive access to resources, and for synchronizing and communicating among users.

 

3. The main advantage of multilevel page tables is that they

a) Use page table memory efficiently

b) Reduce the complexity of the paging system

c) Speed up page table references

d) None of the above

Answer: (a) Use page table memory efficiently

With many processes in a system, the page tables can potentially take up a large chunk of physical memory. One solution to the large memory requirements of page tables is to use multilevel paging. In this scheme, a virtual address is divided into three or more sections, with all but the last section being page numbers in different page tables, and the last one being the offset. We look up the first page table to find the second table, then look up the second table to find the frame in which the page is stored.

This scheme uses the page table memory efficiently. [Refer here for more]

4. Remote procedure calls rely on marshaling parameters. Marshaling means ______.

a) transforming the parameters into a form suitable for network transmission.

b) sending the parameters over the network to a remote server.

c) having the remote server extract the parameters from the network message.

d) having the remote server place the parameters on the stack to make a procedure call.

Answer: (a) transforming the parameters into a form suitable for network transmission           

Marshaling is placing all the parameters into a stream of bytes in an agreed upon format so that they can be transmitted. Unmarshaling is the opposite process.

Marshaling is the process of gathering data and transforming it into a standard format before it is transmitted over a network so that the data can transcend network boundaries.

 

5. Which of the following protocols is most suitable to the statement “a message may be lost between the sending process and the receiving process and as a result the receiving process may never receive that message.”

a) UDP protocol

b) TCP protocol

c) IP protocol

d) Both UDP  and TCP

Answer: (a) UDP protocol 

The UDP protocol does not do anything to resend lost messages, but TCP will resend until an ACK is received.

The service provided by UDP is an unreliable service that provides no guarantees for delivery and no protection from duplication (e.g. if this arises due to software errors within a router). The simplicity of UDP reduces the overhead from using the protocol and the services may be adequate in many cases.

 

*********

Related links:


OS Interview questions with answers

solved Interview questions in operating systems

GATE questions in system programming and operating systems

MCQ Interview questions in OS

Operating systems interview questions for competitive exams

objective type OS questions for IIT JEE entrance exam

Define marshaling

No comments:

Post a Comment

Featured Content

Multiple choice questions in Natural Language Processing Home

MCQ in Natural Language Processing, Quiz questions with answers in NLP, Top interview questions in NLP with answers Multiple Choice Que...

All time most popular contents

data recovery