What Are Different Types Of Semaphores?


3 Answers

Tatu Lois Profile
Tatu Lois answered
Semaphores, sometimes referred to as semaphores, is used in a multithreaded environment, a facility which is responsible for coordinating the various threads in order to ensure that they can correct and reasonable use of public resources. What is the semaphore (Semaphore0 Semaphore is divided into two kinds of single and multiple values, the former can only be obtained by a thread, which can be a number of threads available. To the operation of a parking lot is an example. For simplicity, assume that parking lot only three parking spaces, the first three parking spaces are empty. Then came the five cars if both doorman to allow unimpeded access to three of them, and then lay down car stopped, the rest of the car you must import wait, the later cars had to wait at the entrance. At this time, a car left the parking lot, the porter, after that, open the car stopped, put one, two if they leave, then they can put two, and so forth. In the parking system, parking is a public resource, each vehicle is like a thread, from the gatekeeper role is the semaphore. Furthermore, the amount of signal characteristics are as follows: Semaphore is a non-negative integer (number of parking spaces), all through its thread (vehicles) are the integer minus one (by which of course is to use the resources), when the integer value is zero, all trying to thread through it will be in a wait state. The amount of the signal, we define two operations: Wait (wait) and Release (release). When a thread calls Wait (wait) operation, it is either the signal minus one by then, or a self-wait until the semaphore greater than one or timeout. Release (release) is actually performed on the amount of increase in signal operation, corresponding to the vehicle left the parking lot, the reason why the operation is called "release" is to be released for the add operation is in fact the amount by the signal protect resources....
Anonymous Profile
Anonymous answered
Semaphore -- a system
A semaphore -- a device or apparatus

Semaphore is a kind of system that is used to signal or convey information. Semaphore is often understood to be the system in which a person holds one flag in each hand, communicating letters or numbers by the position of the flags.

However, a semaphore is a device or apparatus that signals information, often using lights. A stoplight, for example, is a kind of semaphore as evidenced by the Spanish word "semaforo", which means "stoplight". Green means go, red means stop, but yellow (depending on the person as well as multiple other variables) can mean slow down, speed up, or continue doing what you were doing :) (These colors and meanings are based on the US stoplight system).

Answer Question