- Recursive
locks: In such locks, only one thread can pass through it. Any other
threads or processes entering the lock need to wait for the initial one to
pass through after its task is finished.
- Non
– recursive locks: Here only once a thread can enter the lock. If the same
thread again tries to enter the lock without unlocking it, a deadlock can
occur.
Wednesday, June 5, 2013
Explain the various techniques for Deadlock Prevention
Posted by
Sunflower
at
6/05/2013 01:46:00 PM
0
comments
Labels: Algorithms, Conditions, Data, Deadlock Prevention, Deadlocks, Distributed, Environment, Multiprocessing, Multitasking, Operating System, Performance, Prevention, Processes, Resources, System, Wait
|
| Subscribe by Email |
|
Tuesday, June 4, 2013
Explain briefly Deadlock Avoidance and Detection?
What is Deadlock Avoidance?
- Avoiding a deadlock is possible only if certain information regarding the processes is available with the operating system.
- This information has to be made available to the OS just before the resources are allocated to the processes.
- These are the processes that are to be consumed by the process in its lifetime.
- For every resource request made by the process, any potential threats are checked by the system i.e., whether granting the request of the process will send it in to an unsafe zone or not.
- If it is so then there are possibilities that the system could enter a deadlock.
- Therefore, only those requests are granted by the process that will ensure a safe state of the process.
- It is important for the system to determine whether the next level of the process will be safe or unsafe.
- There are 3 things that the operating system must know at any before or after the execution of the process:
1. The currently available resources.
2. The resources currently allocated to the processes.
3. Resources to be required and released in the future by these processes.
- It is possible that a process might be in an unsafe state but still may not cause a deadlock.
- By the notion of the safe and unsafe state of the process we refer to the system’s ability of entering in to a deadlock.
An example will make it clearer:
- Consider a resource A requested by a process which would make the process state unsafe.
- At the same time it releases another resource say B preventing the circular wait of the resources.
- In such a situation, the system is said to be in an unsafe state though not necessarily in a deadlock.
- There are various algorithms that have been designed for deadlock avoidance and one such is the banker’s algorithm.
- To use this algorithm knowledge about the resource usage limit is required in advance.
- It is impossible for most of the systems to know what a process will request for in advance.
- This only implies that the deadlock avoidance is also not possible here.
- There are other two algorithms for achieving this task namely wound/ wait and wait/ die algorithms.
- Each of them makes use of a symmetry breaking technique.
What is Deadlock Detection?
- Deadlocks are free to occur under the implementation of this concept.
- Then through the state of the system, the occurrence of the deadlock is confirmed and subsequently mended.
- Here, the resource allocation activities are tracked along with the process states by certain algorithms.
- After this, the algorithm is used for removing the deadlock.
- Deadlock detection is quite easy since the OS scheduler knows about the resources that have been locked by the processes.
- Model checking is one of the techniques used for deadlock detection.
- In this a finite state model is created up on which a progress analysis of the process is carried out and all the terminal sets of the model are found.
- Each of these stands for a deadlock.
- Correction of the deadlock can be done by any of the below mentioned methods after the deadlock has been detected:
1. Process termination: This is about aborting one or more of the processes that cause the deadlock thus ensuring a certain and speedy removal of the deadlock. But this method might prove to be a little expensive because of the loss of the partial computations.
2. Resource preemption: This is about a successive preemption of the allocated resources until the breakdown of the deadlock.
Posted by
Sunflower
at
6/04/2013 01:54:00 PM
0
comments
Labels: Algorithms, Avoid, Conditions, Deadlock Avoidance, Deadlock Prevention, Deadlocks, Detect, Operating System, OS, Processes, Requests, Resources, Safe, Scheduler, States, System, Unsafe, Wait
|
| Subscribe by Email |
|
Thursday, May 30, 2013
What are the various Desk Scheduling methods?
About Disk Scheduling
- User processes: The functions
of this layer including making I/O calls, formatting the I/O and spooling.
- Device independent software: Functions are naming, blocking, protection, allocating and buffering.
- Device drivers: Functions
include setting up the device registers and checking their status.
- Interrupt handlers: These
perform the function of waking up the I/O drivers up on the completion of
the I/O.
- Hardware: Performing the I/O
operations.
Algorithms for Scheduling Disk Requests
Ways to attach to a disk
Posted by
Sunflower
at
5/30/2013 01:09:00 PM
0
comments
Labels: Algorithms, device, Disk, Disk Drive, Disk Scheduling, Hardware, Input, Interrupts, Layers, Logical, Methods, Output, Performance, Process, Requests, Scheduling, Software, Time, User, Wait
|
| Subscribe by Email |
|
Saturday, May 11, 2013
What is meant by Deadlock? List the necessary conditions for arising deadlocks?
Conditions for a Deadlock to arise
- Mutual exclusion: There has
to be at least one resource that cannot be shared. So that only one
process would use at any given time.
- Resource holding (or hold
and wait): There should be at least one resource held by a process that in
turn should be request more resources that are being held by other
processes.
- No preemption: Once the
resources have been allocated, they should not de-allocated by the
operating system. The condition is that the process holding the resource
must release it voluntarily.
- Circular wait: A circular
chain of processes must be formed as explained in the earlier example.
- Ignoring deadlock
- Detection
- Prevention
- Avoidance
Posted by
Sunflower
at
5/11/2013 09:48:00 PM
0
comments
Labels: Actions, Approaches, Arise, Avoid, Compete, Conditions, Deadlock, Detection, Operating System, OS, Preemption, Processes, Resources, Situation, System, Threads, Wait, Waiting
|
| Subscribe by Email |
|
Saturday, January 9, 2010
Introduction to Monitors
Monitors :
- Consist of private data and operations on that data.
- It can contain types, constants, variables and procedures.
- Only the procedures explicitly marked can be seen outside the monitor.
- The monitor body allows the private data to be initialized.
- The compiler enforces mutual exclusion on a particular monitor.
- Each monitor has a boundary queue, and processes wanting to call a monitor routine
join this queue if the monitor is already in use.
- Monitors are an improvement over conditional critical regions because all the code
that accesses the shared data is localized.
To allow a process to wait within the monitor, a condition variable must be declared, as: condition x,y.
Condition variable can only be used with the operations wait and signal.
The operation x.wait()means that the process invoking this operation is suspended until another process invokes. Also called delay function.
The operation x.signal()resumes exactly one suspended process. If no process is suspended, then the signal operation has no effect.Also called resume function.
Monitor Implementation using Semaphores
- For each condition variable x, we have:
semaphore x-sem; // (initially = 0)
int x-count = 0;
- The operation x.wait can be implemented as:
x-count++;
if (next-count > 0)
signal(next);
else
signal(mutex);
wait(x-sem);
x-count--;
- The operation x.signal can be implemented as:
if (x-count > 0)
{
next-count++;
signal(x-sem);
wait(next);
next-count--;
}
Posted by
Sunflower
at
1/09/2010 03:53:00 PM
0
comments
Labels: Monitors, Operating Systems, Operations, Semaphores, Signal, Variables, Wait
|
| Subscribe by Email |
|