A deadlock is a situation in which two computer programs sharing the same resource are effectively preventing each other from accessing the resource, resulting in both programs ceasing to function.
The earliest computer operating systems ran only one program at a time. All of the resources of the system were available to this one program. Later, operating systems ran multiple programs at once, interleaving them. Programs were required to specify in advance what resources they needed so that they could avoid conflicts with other programs running at the same time. Eventually some operating systems offered dynamic allocation of resources. Programs could request further allocations of resources after they had begun running. This led to the problem of the deadlock. Here is the simplest example:
Program 1 requests resource A and receives it.
Program 2 requests resource B and receives it.
Program 1 requests resource B and is queued up, pending the release of B.
Program 2 requests resource A and is queued up, pending the release of A.
Now neither program can proceed until the other program releases a resource. The operating system cannot know what action to take. At this point the only alternative is to abort (stop) one of the programs.
Learning to deal with deadlocks had a major impact on the development of operating systems and the structure of databases. Data was structured and the order of requests was constrained in order to avoid creating deadlocks.
Thursday, April 1, 2010
Understand Deadlock
4 comments Posted by Saurav at 7:10 AM
Labels: Deadlock, Operating System Services, Process, resources
Sunday, May 31, 2009
Concept of Process
In simple terms we can say that a process is a program in execution. A process is not only the program code which is known as text section. A process can also include the program activities which are represented by the program counter and processor’s registers. A process also includes a stack that contains the temporary data like function parameters,return addresses and local variables and a data section that contains the global variables.A process also contains a heap which is the memory that is allocated dynamically to the process during its creation and execution.
Here,one thing that you had to make very much clear in your mind is that a process can never be a program because a program is a passive entity and a process is an active entity. A program becomes a process when it is loaded into memory.The most common technique that is used for loading a program into main memory is by double clicking on that icon or you can type the name of that program on the command line.It is possible that two or more than two processes are associated with a program but this does not mean that they are different execution sequences.For instance,several users may running different copies of the same email program, or the same user may invoke different instances of the web browser.Each of these is a separate process and although the text sections are equivalent while the stack and heap sections may vary.
0 comments Posted by Saurav at 5:01 AM
Labels: Process