Sunday, December 13, 2015

banker’s algorithm



1.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.

2.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.
3.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<i. if no such sequence exists, then the system state is said to be unsafe.

4.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.

5.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.

6.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.




No comments:

Post a Comment