wisemonkeys logo
FeedNotificationProfileManage Forms
FeedNotificationSearchSign in
wisemonkeys logo

Blogs

What is semaphore in operating system?

profile
Khushi Joshi
Jul 11, 2023
2 Likes
0 Discussions
343 Reads

In operating systems, a semaphore is used to control access to shared resources. It is a variable or an abstract data type that is used to solve the critical section problem, which arises when multiple processes or threads need to access a shared resource simultaneously.

 

For example, when there are two person A and B wants to use one computer at the same time then comes the role of semaphore.

 

It indicates that the computer is free or is in use.

 

If it is free, it will set the counter as 1, and if it the counter is set to 0, it means the computer is in use.

 

The semaphore provides two main operations:

Wait (P) operation: When a process/thread wants to access the shared resource, it performs the wait operation on the semaphore. If the counter is greater than zero, the process/thread decrements the counter and continues accessing the resource. If the counter is zero, indicating that all resources are currently being used, the process/thread is put into a waiting state until a resource becomes available.

 

Signal (V) operation: After a process/thread completes its use of the shared resource, it performs the signal operation on the semaphore. This operation increments the counter, indicating that a resource has been released and is now available for other processes/threads to use. If any waiting processes/threads were blocked, one of them is awakened and allowed to proceed.


Comments ()


Sign in

Read Next

The Importance of Financial Literacy for College Students

Blog banner

Raising Emotionally Intelligent Students: The Classroom Beyond Academics

Blog banner

Email Privacy

Blog banner

The House ??of Patola Designs: Traditional Weaves with a Modern Twist

Blog banner

Digital Marketing - The new way to reach end consumer

Blog banner

virtual machine

Blog banner

Why Does Hierarchy Still matter in Organizations?

Blog banner

The Procedural Framework for Corporate High-Tech Investigations

Blog banner

GIS in Disaster Management

Blog banner

Multiple-Processor Scheduling in Operating System

Blog banner

Boxing

Blog banner

MOBILE DEVICE FORENSIC

Blog banner

Simple STEM Activities for Toddlers That Spark Curiosity

Blog banner

File management

Blog banner

Explain DBMS in Brief

Blog banner

Article on Zoho Corporation

Blog banner

RAID

Blog banner

Types of OS

Blog banner

File System

Blog banner

Odoo

Blog banner

A MODERN OPERATING SYSTEM

Blog banner

Points to consider if you're planning to visit Florida in 2026

Blog banner

The seven-step improvement process

Blog banner

Synchronization

Blog banner

Supervised and unsupervised learning

Blog banner

Life lesson

Blog banner

Benefits of yoga and meditation

Blog banner

TEAMWORK

Blog banner

Soak knowledge and level up your intellectual potential!!!

Blog banner

Mutual exclusion

Blog banner

File Organization and Access

Blog banner

BUSINESS MODELS OF E COMMERCE

Blog banner

Concurrency and memory

Blog banner

Virtual Memory - Explaination, Working, Steps

Blog banner

Precision-Recall in Data Science

Blog banner

Apple

Blog banner

Process and Threading

Blog banner

Number Guessing game --lisp

Blog banner

Access management

Blog banner

What is Brute Force Attack? How to defend against it?

Blog banner

MODERN OPERATING SYSTEM

Blog banner

Kernel in Operating System

Blog banner