answersLogoWhite

0


Best Answer

strong semaphores specify the order in which processes are removed from the queue, which guarantees avoiding starvation. Weak semaphores do not specify the order in which processes are removed from the queue.

User Avatar

Wiki User

βˆ™ 13y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

βˆ™ 17y ago

Monitors provide an easier programming technique to provide mutal exclusion, whereas the use of semaphores are tricker and more prone to programmer error.

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is weak semaphore and strong semaphore?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is sem post and sem wait functions?

The sem_wait() function locks the semaphore referenced by sem by performing a semaphore lock operation on that semaphore. If the semaphore value is currently zero, then the calling thread will not return from the call to sem_wait()until it either locks the semaphore or the call is interrupted by a signal.Upon successful return, the state of the semaphore is locked and remains locked until the sem_post() function is executed and returns successfully. The sem_wait() function is interruptible by the delivery of a signal.The sem_post() function unlocks the semaphore referenced by sem by performing a semaphore unlock operation on that semaphore.If the semaphore value resulting from this operation is positive, then no threads were blocked waiting for the semaphore to become unlocked; the semaphore value is simply incremented.If the value of the semaphore resulting from this operation is zero, then one of the threads blocked waiting for the semaphore will be allowed to return successfully from its call to sem_wait(). If the symbol _POSIX_PRIORITY_SCHEDULING is defined, the thread to be unblocked will be chosen in a manner appropriate to the scheduling policies and parameters in effect for the blocked threads. In the case of the schedulers SCHED_FIFO and SCHED_RR, the highest priority waiting thread will be unblocked, and if there is more than one highest priority thread blocked waiting for the semaphore, then the highest priority thread that has been waiting the longest will be unblocked. If the symbol _POSIX_PRIORITY_SCHEDULING is not defined, the choice of a thread to unblock is unspecified.The sem_post() interface is reentrant with respect to signals and may be invoked from a signal-catching function.


Which is a high level abstraction over semaphore?

Monitor


What is the difference between MUTEX and Semaphore?

From wikipedia:"A mutex is a binary semaphore, usually including extra features like ownership or priority inversion protection. The differences between mutexes and semaphores are operating system dependent. Mutexes are meant to be used for mutual exclusion only and binary semaphores are meant to be used for event notification and mutual exclusion."They also have a good example as to the use of a semaphore:"A thread named A needs information from two databases before it can proceed. Access to these databases is controlled by two separate threads B, C. These two threads have a message-processing loop; anybody needing to use one of the databases posts a message into the corresponding thread's message queue. Thread A initializes a semaphore S with init(S,-1). A then posts a data request, including a pointer to the semaphore S, to both B and C. Then A calls P(S), which blocks. The other two threads meanwhile take their time obtaining the information; when each thread finishes obtaining the information, it calls V(S) on the passed semaphore. Only after both threads have completed will the semaphore's value be positive and A be able to continue. A semaphore used in this way is called a 'counting semaphore.'"Basically think of a semaphore as a lock that allows multiple threads to wait in line for the resource to be free. Usually they will block and the semaphore will wake them up when it is their turn.


Can weak entity be converted into strong entity?

The primary key of a weak entity set is formed by taking the primary key of the strong entity set on which its existence depends (see Mapping Constraints) plus its discriminator. A strong entity set has a primary key. All tuples in the set are distinguishable by that key. A weak entity set has no primary key unless attributes of the strong entity set on which it depends are included. Tuples (a particular row) in a weak entity set are partitioned according to their relationship with tuples in a strong entity set. Tuples within each partition are distinguishable by a discriminator, which is a set of attributes.


What is the difference between a weak reference and a strong reference in python?

The same difference as in other languages. A weak reference is one that won't stop the garbage collector from eliminating an object.

Related questions

Is washing up liquid a weak or strong alkali?

it is weak and strong because it neutralises acids. So its strong not weak but weak not strong.


What is weak?

weak is not strong


What are opposite word for weak?

antonym comes from the greek, anti, meaning opposite, so the opposite of weak is strong.


Is a screwdriver a weak or strong magnet?

Screwdrivers can have weak or strong magnetism.


Is tomato ketchup a strong or weak acid?

weak because you can eat it


Is air pressure weak or strong at earths surface?

weak and strong,it depends


What is the oppoiste of strong?

Uh... Weak? What is the point in this question?


Does Ixora have a weak or strong stem?

Weak


Is Iron Strong or weak?

strong


Is the conjugate of a strong base is a weak acid?

No, the conjugate of a strong base is a weak acid. The conjugate base of a strong acid is weak, while the conjugate acid of a strong base is weak.


Would you describe a weak acid as a strong electrolyte?

No, a weak acid is a weak electrolyte Strong electrolytes - strong acids, bases, salts, and ionic compounds


What car class is better?

* Exotics: Strong on Tuners, but weak on Mussles * Tuners: Strong on Mussles, but weak on Exotics * Mussles: Strong on Exotics, but weak on Tuners