Posts

concurrency control

It’s the ability to run multiple processes or threads at the same time. This requires careful memory management, that is, any application running on it’s own should not interfere with other applications. It’s easy when it’s all yours but it becomes a lot harder to share with others. Then you need to be able to run 2 pieces of code together and schedule these. So that they all get their fair share of time on the CPU. There are other factors that come into play here, for example, when you receive input through something like a network device or a peripheral device like a mouse or keyboard. You have to stop what you were doing and deal with that input. All modern operating systems allow multiple programs to run at the same time. This is called concurrency. A running program is known as a process. In fact modern operating systems even allow a single program to execute different routines at the same time or to put it another way, they allow a process to execute several threads of ...

Deadlock

Image
Introduction of Deadlock in Operating System A process in operating systems uses different resources and uses resources in following way. 1) Requests a resource 2) Use the resource 2) Releases the resource Deadlock  is a situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process. Consider an example when two trains are coming toward each other on same track and there is only one track, none of the trains can move once they are in front of each other. Similar situation occurs in operating systems when there are two or more processes hold some resources and wait for resources held by other(s). For example, in the below diagram, Process 1 is holding Resource 1 and waiting for resource 2 which is acquired by process 2, and process 2 is waiting for resource 1. Deadlock can arise if following four conditions hold simultaneously (Necessary Conditions) Mutual Exclusion:  One or ...

Mutual exclusion in distributed system

Image
Mutual exclusion in distributed system Mutual exclusion  is a concurrency control property which is introduced to prevent race conditions. It is the requirement that a process can not enter its critical section while another concurrent process is currently present or executing in its critical section i.e only one process is allowed to execute the critical section at any given instance of time. Mutual exclusion in single computer system Vs. distributed system: In single computer system, memory and other resources are shared between different processes. The status of shared resources and the status of users is easily available in the shared memory so  mutual exclusion problem can be easily solved. In Distributed systems, we neither have shared memory nor a common physical clock and there for we can not solve mutual exclusion problem using shared variables. To eliminate the mutual exclusion problem in distributed system approach based on message passing is used...