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 I clean up my computer to make it run faster?

1003


How many goroutines are in a core?

976


Can a laptop have both ssd and hdd?

1085


Explain about memory management in operating system.

1016


Can I factory reset my laptop without a recovery disc?

934


What is a file in computer terms?

1026


How many bytes we can send to apple push notification server in iOS operating system?

1032


What are Odm Commands.

1125


Which one is the first operating system?

961


What os is used at google?

1040


How do I compare plugins in notepad ++?

982


How To Convert A Normal Vg To Big & Scalable Vg And Also Big To Scalable Vg?

1035


Is microsoft coming out with a new operating system?

908


What is the shortcut key to refresh laptop?

951


How do I combine multiple folders on a mac?

969