Operating System Short Question And Answer Set-3

PropellerAds

1.Define deadlock.
A process requests resources; if the resources are not available at that time, the process enters a wait state. Waiting processes may never again change state, because the resources they have requested are held by other waiting processes. This situation is called a deadlock.

2.What is the sequence in which resources may be utilized?
Under normal mode of operation, a process may utilize a resource in the following sequence:

  • Request: If the request cannot be granted immediately,then the requesting process must wait until it can acquire the resource.
  • Use: The process can operate on the resource.
  • Release: The process releases the resource.

3.What are conditions under which a deadlock situation may arise?
A deadlock situation can arise if the following four conditions hold simultaneously in a system:
a. Mutual exclusion
b. Hold and wait
c. No pre-emption

4.What is a resource-allocation graph?
Deadlocks can be described more precisely in terms of a directed graph called a system resource allocation graph. This graph consists of a set of vertices V and a set of edges E. The set of vertices V is partitioned into two different types of nodes; P the set consisting of all active processes in the system and R the set consisting of all resource types
in the system.

5.Define request edge and assignment edge.
A directed edge from process Pi to resource type Rj is denoted by PiàRj; it signifies that process Pi requested an instance of resource type Rj and is currently waiting for that resource. A directed edge from resource type Rj to process Pi is denoted by RjàPi, it signifies that an instance of resource type has been allocated to a process Pi. A directed edge PiàRj is called a request edge. A directed edge RjàPi is called an assignment edge.

6.What are the methods for handling deadlocks?
The deadlock problem can be dealt with in one of the three ways:
a. Use a protocol to prevent or avoid deadlocks, ensuring that the system will never enter a deadlock state.
b. Allow the system to enter the deadlock state, detect it and then recover.
c. Ignore the problem all together, and pretend that deadlocks never occur in the system.

7.Define deadlock prevention.
Deadlock prevention is a set of methods for ensuring that at least one of the four necessaryconditions like mutual exclusion, hold and wait, no preemption and circular wait cannot hold. By ensuring that that at least one of these conditions cannot hold, the occurrence of a deadlock can be prevented.

8.Define deadlock avoidance.
An alternative method for avoiding deadlocks is to require additional information about how resources are to be requested.Each request requires the system consider the resources currently available, the resources currently allocated to each process, and the future requests and releases of each process, to decide whether the could be satisfied or must wait to avoid apossible future deadlock.

9.What are a safe state and an unsafe state?
A state is safe if the system can allocate resources to each process in some order and still avoid a deadlock. A system is in safe state only if there exists a safe sequence. A sequence of processes <P1,P2,….Pn> is a safe sequence for the current allocation state if, for each Pi, the resource that Pi can still request can be satisfied by the current available
resource plus the resource  held by all the Pj, with j system state is said to be unsafe.

10.What is banker’s algorithm?
Banker’s algorithm is a deadlock avoidance algorithm that is applicable to a resource-allocation system with multiple instances of each resource type.The two algorithms used for its implementation are:
a. Safety algorithm: The algorithm for finding out whether or not a system is in a safe state.
b. Resource-request algorithm: if the resulting resourceallocation is safe, the transaction is completed and process Pi is allocated its resources. If the new state is unsafe Pi must wait and the old resource-allocation state is restored.

11.Define logical address and physical address.
An address generated by the CPU is referred as logical address. An address seen by the memory unit that is the one loaded into the memory address register of the memory is commonly referred to as physical address.

12.What is logical address space and physical address space?
The set of all logical addresses generated by a program is called a logical address space; the set of all physical addresses corresponding to these logical addresses is a physical address space.

13.What is the main function of the memory-management unit?
The runtime mapping from virtual to physical addresses is done by a hardware device called a memory management unit (MMU).

14.Define dynamic loading.
To obtain better memory-space utilization dynamic loading is used. With dynamic loading, a routine is not loaded until it is called. All routines are kept on disk in a relocatable load format. The main program is loaded into memory and executed. If the routine needs another routine, the calling routine checks whether the routine has been loaded. If not, the relocatable linking loader is called to load the desired program into memory.

15.Define dynamic linking.
Dynamic linking is similar to dynamic loading, rather that loading being postponed until execution time, linking is postponed. This feature is usually used with system libraries,such as language subroutine libraries. A stub is included in the image for each library-routine reference. The stub is a small piece of code that indicates how to locate the
appropriate memory-resident library routine, or how to load the library if the routine is not already present.

16.What are overlays?
To enable a process to be larger than the amount of memory allocated to it, overlays are used. The idea of overlays is to keep in memory only those instructions and data that are needed at a given time. When other instructions are needed, they are loaded into space occupied previously by instructions that are no longer needed.

17.Define swapping.
A process needs to be in memory to be executed. However a process can be swapped temporarily out of memory to a backing store and then brought back into memory for continued execution.This process is called swapping.

18.What are the common strategies to select a free hole from a set of available holes?
The most common strategies are
a. First fit
b. Best fit
c. Worst fit

19.What do you mean by best fit?
Best fit allocates the smallest hole that is big enough. The entire list has to be searched, unless it is sorted by size. This strategy produces the smallest leftover hole.

20.What do you mean by first fit?
First fit allocates the first hole that is big enough.Searching can either start at the beginning of the set of holes or where the previous first-fit search ended. Searching can be stopped as soon as a free hole that is big enough is found.