Operating
System
(CSA-CC-224)
Topic: Semaphores
Presented To:
Presented By:
Contents
Introduction to semaphores
Two semaphore operations
Types of semaphores
Properties of semaphores
Limitations of semaphores
Examples
References
Introduction to Semaphores
Dijkestra proposed a significant
technique for managing concurrent
processes for complex mutual
exclusion problems.
A semaphore is an integer variable
which can hold only a non-negative
Integer value, that are used to solve
the critical section problem by using
two atomic operations.
Two Semaphore Operations
The wait() operation was originally
termed P and signal() was originally called V.
The classical definitions
of wait and signal are:
■ Wait: Decrements the value of its
argument S.
■ Signal: Increments the value of its
argument S.
Types of Semaphores
Semaphores are mainly of two types:
Binary Semaphore: The value of a
binary semaphores can range only
between 0 and 1.
Counting Semaphore: The value of a
counting semaphores can range over
an unrestricted domain.
Properties of Semaphores
It's simple and
always have a
non-negative
Integer value.
Works with many
processes.
Can have many
different critical
sections with
different
semaphores.
Each critical
section has
unique access
semaphores.
Can permit
multiple
processes into
the critical
section at once,
if desirable.
Limitations of Semaphores
 Priority Inversion is a big
limitation of semaphores.
 Their use is not enforced,
but is by convention only.
 With improper use, a
process may block
indefinitely. Such a situation
is called Deadlock.
Real Life
Example of
Semaphores
Producer and consumer problem
Retrieving databases
Trains crossing a bridge
References
■ Operating System Concepts 9th
Edi by A. Silberschatz, Peter
Galvin and G. Gagne
■ https://www.tutorialspoint.com/sema
phores-in-operating-system
managed by David Meador
■ https://www.studytonight.com/operat
ing-system/introduction-to-
semaphores
THANK
YOU

Operating system

  • 1.
  • 2.
    Contents Introduction to semaphores Twosemaphore operations Types of semaphores Properties of semaphores Limitations of semaphores Examples References
  • 3.
    Introduction to Semaphores Dijkestraproposed a significant technique for managing concurrent processes for complex mutual exclusion problems. A semaphore is an integer variable which can hold only a non-negative Integer value, that are used to solve the critical section problem by using two atomic operations.
  • 4.
    Two Semaphore Operations Thewait() operation was originally termed P and signal() was originally called V. The classical definitions of wait and signal are: ■ Wait: Decrements the value of its argument S. ■ Signal: Increments the value of its argument S.
  • 5.
    Types of Semaphores Semaphoresare mainly of two types: Binary Semaphore: The value of a binary semaphores can range only between 0 and 1. Counting Semaphore: The value of a counting semaphores can range over an unrestricted domain.
  • 6.
    Properties of Semaphores It'ssimple and always have a non-negative Integer value. Works with many processes. Can have many different critical sections with different semaphores. Each critical section has unique access semaphores. Can permit multiple processes into the critical section at once, if desirable.
  • 7.
    Limitations of Semaphores Priority Inversion is a big limitation of semaphores.  Their use is not enforced, but is by convention only.  With improper use, a process may block indefinitely. Such a situation is called Deadlock.
  • 8.
    Real Life Example of Semaphores Producerand consumer problem Retrieving databases Trains crossing a bridge
  • 9.
    References ■ Operating SystemConcepts 9th Edi by A. Silberschatz, Peter Galvin and G. Gagne ■ https://www.tutorialspoint.com/sema phores-in-operating-system managed by David Meador ■ https://www.studytonight.com/operat ing-system/introduction-to- semaphores
  • 10.