Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is a semaphore?

Answer Posted / sagarika mishra

In computer science, a semaphore is a protected variable or
abstract data type which constitutes the classic method for
restricting access to shared resources such as shared
memory in a multiprogramming environment. A counting
semaphore is a counter for a set of available resources,
rather than a locked/unlocked flag of a single resource. It
was invented by Edsger Dijkstra. Semaphores are the classic
solution to preventing race conditions in the dining
philosophers problem, although they do not prevent resource
deadlocks.
Semaphores can only be accessed using the following
operations. Those marked atomic should not be interrupted
(that is, if the system decides that the "turn is up" for
the program doing this, it shouldn't stop it in the middle
of those instructions) for the reasons explained below.
P(Semaphore s) // Acquire Resource
{
wait until s > 0, then s := s-1;
/* must be atomic because of race conditions */
}

V(Semaphore s) // Release Resource
{
s := s+1; /* must be atomic */
}

Init(Semaphore s, Integer v)
{
s := v;
}

Is This Answer Correct ?    29 Yes 12 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How do you start up a computer?

900


Where do I find disk cleanup?

899


What is the difference between concurrency and parallelism?

927


What is the meaning of slosh login in nfs?

2512


How much memory do I need on my laptop?

942


Which processor is better amd or intel?

976


iam free downloading the KK Dictionery to my system but that is not installed yet. can anybody tell be why this happen and what the system have to install the software.

2279


Which one is the best operating system?

928


What happens when I reset my computer?

972


How can I clean up my computer?

922


What is the g in gnu?

954


What is an example of a network operating system?

874


Can kernel panic be fixed?

919


What is the most powerful computer in the world 2019?

917


what kind of operating(s)systems would be needed (and explain why) in an environment where there exist various cluster of networks which are all interconnected in different geographical areas with strong emphasis on online applicating process.

2092