what do u mean by Semaphore..when v wil go for using
this..explain about hat.what is the difference
betw..binary ,,counting and mutex semphores
Answer Posted / preeti.j
Semaphore is a mechanism is an RTOS to serialize access to
a resource/resources for all the threads in the system.
There are 2 types of semaphore
1. counting semaphore - this is used when a set of
resources have to be shared between many threads. The
semaphore is initialized with the number of resources. Each
time a thread tries to access the semaphore, its value gets
decremented until it becomes 0. After this any try to
access the semaphore will block the calling thread.
2. binary semaphore - this is used to serialize access to a
single resource i.e the semaphore has only two values 0 and
1.
A mutex is similar to a binary semaphore except that it has
an owner i.e the thread where it was created. A mutex can
be freed only by this thread. This is not the case for
binary semaphore which can be freed by any thread.
Is This Answer Correct ? | 37 Yes | 6 No |
Post New Answer View All Answers
No New Questions to Answer in this Category !! You can
Post New Questions
Answer Questions in Different Category