USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
Â
Semaphores-R.D.Sivakumar
1. 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
2. ï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
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 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 ( )
5. 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 ( )