Video Lecture and E-Content Created by
R.D.SIVAKUMAR,M.Sc.,M.Phil.,M.Tech.,
Assistant Professor of Computer Science &
Assistant Professor and Head, Department of M.Com.(CA),
Ayya Nadar Janaki Ammal College,
Sivakasi – 626 124.
Mobile: 099440-42243
e-mail : sivamsccsit@gmail.com website: www.rdsivakumar.blogspot.in
SEMAPHORES
It is a synchronization tool.
It deal with n-process critical section problem
It was proposed by Dijkstra.
It is an integer value used for signaling among processes.
SEMAPHORES
Wait ( ) – To use a resource.
Signal ( ) – To release a resource.
 To transmit a signal via semaphore S, a process executes the primitive
semsignal (s).
To receive a signal via semaphore S, a process executes the primitive semwait (s).
Semaphores can be used to control access to a given resource.
SEMAPHORES FUNCTIONS
Semaphore is initialized to the number of resources available.
Each process that wishes to use a resource performs a wait ( )
operation.
wait (s)
{
while (s<=0)
// no operation
s--;
WAIT ( )
When a process releases a resource, if performs a signal ( )
operation.
Signal (s)
{
s++;
}
When the count for the semaphores goes to 0, resources
are being used.
After that, processes that with to use a resource will block
until the count becomes > 0.
SIGNAL ( )
Semaphores-R.D.Sivakumar

Semaphores-R.D.Sivakumar

  • 1.
    Video Lecture andE-Content Created by R.D.SIVAKUMAR,M.Sc.,M.Phil.,M.Tech., Assistant Professor of Computer Science & Assistant Professor and Head, Department of M.Com.(CA), Ayya Nadar Janaki Ammal College, Sivakasi – 626 124. Mobile: 099440-42243 e-mail : sivamsccsit@gmail.com website: www.rdsivakumar.blogspot.in SEMAPHORES
  • 2.
    It is asynchronization tool. It deal with n-process critical section problem It was proposed by Dijkstra. It is an integer value used for signaling among processes. SEMAPHORES
  • 3.
    Wait ( )– To use a resource. Signal ( ) – To release a resource.  To transmit a signal via semaphore S, a process executes the primitive semsignal (s). To receive a signal via semaphore S, a process executes the primitive semwait (s). Semaphores can be used to control access to a given resource. SEMAPHORES FUNCTIONS
  • 4.
    Semaphore is initializedto the number of resources available. Each process that wishes to use a resource performs a wait ( ) operation. wait (s) { while (s<=0) // no operation s--; WAIT ( )
  • 5.
    When a processreleases a resource, if performs a signal ( ) operation. Signal (s) { s++; } When the count for the semaphores goes to 0, resources are being used. After that, processes that with to use a resource will block until the count becomes > 0. SIGNAL ( )