Showing posts with label OS. Show all posts
Showing posts with label OS. Show all posts

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

Thursday, June 18, 2020

Two mark questions/Interview questions in Operating Systems

Two Mark Questions in Operating Systems / Interview Questions in Operating Systems


1. What is the difference between Swapping and Paging?

Swapping: Whole process is moved from the swap device to the main memory for execution. Process size must be less than or equal to the available main memory. It is easier to implementation and overhead to the system. Swapping systems does not handle the memory more flexibly as compared to the paging systems.

Paging: Only the required memory pages are moved to main memory from the swap device for execution. Process size does not matter. Gives the concept of the virtual memory. It provides greater flexibility in mapping the virtual address space into the physical memory of the machine. Allows more number of processes to fit in the main memory simultaneously. Allows the greater process size than the available physical memory. Demand paging systems handle the memory more flexibly.

2. What is major difference between the Historic Unix and the new BSD release of Unix System V in terms of Memory Management?

Historic Unix uses Swapping - entire process is transferred to the main memory from the swap device, whereas the Unix System V uses Demand Paging - only the part of the process is moved to the main memory. Historic Unix uses one Swap Device and Unix System V allow multiple Swap Devices.

3. What is the main goal of the Memory Management?
  1. It decides which process should reside in the main memory,
  2. Manages the parts of the virtual address space of a process which is non-core resident,
  3. Monitors the available main memory and periodically write the processes into the swap device to provide more processes fit in the main memory simultaneously.
4. What is a Map?

A Map is an Array, which contains the addresses of the free space in the swap device that are allocatable resources, and the number of the resource units available there.
Address Units
      1     10,000
This allows First-Fit allocation of contiguous blocks of a resource. Initially the Map contains one entry - address (block offset from the starting of the swap area) and the total number of resources.
Kernel treats each unit of Map as a group of disk blocks. On the allocation and freeing of the resources Kernel updates the Map for accurate information.

5. What scheme does the Kernel in Unix System V follow while choosing a swap device among the multiple swap devices?

Kernel follows Round Robin scheme choosing a swap device among the multiple swap devices in Unix System V.

6. What is a Region?

A Region is a continuous area of a process's address space (such as text, data and stack). The kernel in a "Region Table" that is local to the process maintains region. Regions are sharable among the process.




Friday, August 29, 2014

Inter Process Communication in Operating System

Operating System Inter Process Communication / IPC in OS / What is Inter Process Communication? / Inter Process Communication Lecture Slides and Notes / Exercises and Worked Out Examples in Inter Process Communication / Links to useful Inter Process Communication Resources online



What is Inter Process Communication?


IPC is a concept which allows the communication and synchronization between processes. Through a set of programming interfaces, it helps a programmer to organize and exchange the information between different processes.

"In computing, inter-process communication (IPC) is a set of methods for the exchange of data among multiple threads in one or more processes. Processes may be running on one or more computers connected by a network. IPC methods are divided into methods for message passing, synchronization, shared memory, and remote procedure calls (RPC)" - Wikipedia.

Lecture Notes and Slides


Exercises and Problems Solved

Inter Process Communication (IPC) through Shared Memory, Race Conditions, Mutual Exclusion, Peterson's Algorithms etc.





Sunday, August 3, 2014

Distributed Operating System

Distributed Operating System / What is Distributed Operating System? / Types of Distributed Operating System / Distributed Shared Memory / Distributed OS lecture notes, questions, exams, and other materials / Example of Distributed OSs


Distributed OS


With the advent of computer networks, in which many computers are linked together and are able to communicate with one another, distributed computing became feasible. A distributed computation is one that is carried out on more than one machine in a cooperative manner. A group of linked computers working cooperatively on tasks, referred to as a distributed system, often requires a distributed operating system to manage the distributed resources. Distributed operating systems must handle all the usual problems of operating systems, such as deadlock. Distributed deadlock is very difficult to prevent; it is not feasible to number all the resources in a distributed system. Hence, deadlock must be detected by some scheme that incorporates substantial communication among network sites and careful synchronization, lest network delays cause deadlocks to be falsely detected and processes aborted unnecessarily. Interprocess communication must be extended to processes residing on different network hosts, since the loosely coupled architecture of computer networks requires that all communication be done by message passing. Important systems concerns unique to the distributed case are workload sharing, which attempts to take advantage of access to multiple computers to complete jobs faster; task migration, which supports workload sharing by efficiently moving jobs among machines; and automatic task replication at different sites for greater reliability. 


List of Distributed Operating Systems



l. IRIX operating system; was the operating system developed by Silicon Graphics, Inc. (SGI) to run natively on their MIPS workstations and servers
2.  AIX (Advanced Interactive eXecutive) is a series of proprietary Unix operating systems developed and sold by IBM for several of its computer platforms.
3.  Solaris operating system; Solaris is a Unix operating system originally developed by Sun Microsystems. It superseded their earlier SunOS in 1993. Oracle Solaris, as it is now known, has been owned by Oracle Corporation since Oracle's acquisition of Sun in January 2010for SUN multiprocessor workstations.
4.  Mac OS is a multi-threading and multitasking UNIX compatible operating system;




 

Wednesday, July 30, 2014

Interprocess Communication in Linux

Operating System Concepts

All Operating Systems Questions with Clear Answers / Operating Systems Exercises Solved / Solutions for Exercises in Operating Systems / Operating Systems selected Questions with Answers / Operating Systems Notes / Index for various online materials on Operating Systems


Operating System Concepts

1. Processes and Threads

2. Inter-process Communication

3. Inter-process Communication in Linux

4. Scheduling Algorithms

5. Process Scheduling in Linux

6. Process Synchronization

7. Deadlocks

8. Memory Management

9. Paging and TLB

9. Memory Management in Linux

10. File System Concepts

11. File System Implementation

12. File System in Linux

13. File System in Windows

 

Advanced Concepts in Operating System

1. Distributed OS

2. Distributed Deadlock Handling

3. Distributed Shared Memory

4. Multiprocessor OS


Questions and Answers



Paging and TLB in OS

Paging and TLB in Operating System /  Online resources for Paging and TLB / Operating System materials - Notes and Slides / Exercises and Problems with solutions in Paging and TLB topics.

This post lists useful online resources about the concept Paging in OS.

Paging and TLB

Lecture Notes and Slides


Exercises





Memory Management in Operating System

Operating System Memory Management /  Online resources for Memory Mangement Basics and Exercies / Operating System materials - Notes and Slides / Exercises and Problems with solutions in Memory Management topic.

This post lists useful online resources about the concept Memory Management in OS.

Memory Management

Lecture Notes and Slides


Exercises


Quizzes





Operating Systems - Processes and Threads

Operating System Processes and Threads /  Online resources for Processes and Threads / Operating System materials - Notes and Slides / Exercises and Problems with solutions in Processes and Threads topic.

This post lists useful online resources about the concepts Processes and Threads in OS.

Processes and Threads

Lecture Notes and Slides


Exercises





Scheduling Algorithms in Operating Systems

Operating System Process Scheduling Algorithms /  Online resources for Process Scheduling Algorithms / Operating System materials - Notes and Slides / Exercises and Problems with solutions on Scheduling Algorithms topic.

This post lists useful online resources about the various Scheduling Algorithms in OS.


Scheduling Algorithms Materials, Lecture Notes and Slides


Exercises





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