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
347 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

Delhi city

Blog banner

Data Exfiltration

Blog banner

Virtual memory

Blog banner

Caching windows

Blog banner

I/O Management and Disk Scheduling

Blog banner

ADD A SPICE TO YOUR LIFE.

Blog banner

EMAIL INVESTIGATION

Blog banner

How to Compare Schools Before an Admission Decision

Blog banner

Oracle Corporation

Blog banner

LISP - Library Management System

Blog banner

Microsoft powerpoint presentation

Blog banner

Cloud Computing

Blog banner

Evolution of Operating system

Blog banner

The Procedural Framework for Corporate High-Tech Investigations

Blog banner

Tracking Emails & Email Crimes

Blog banner

Different types of e-commerce platforms or advantages and disadvantages

Blog banner

Introduction my self

Blog banner

?What Your Dentist Notices The Moment You Sit In The Chair

Blog banner

Modern Operating System - Khush Bagaria

Blog banner

Why Mumbai Professionals Are Switching Back to Home-Style Tiffin Meals

Blog banner

Concept and definition of m-commerce

Blog banner

How to kiss

Blog banner

Patola Outfits for the Modern Wardrobe: Reviving Indian Handloom in Style

Blog banner

Hot Mango Pickle (Methiyu)

Blog banner

Firewall

Blog banner

Virtual memory

Blog banner

Getting started with Android Studio

Blog banner

Sleep Matters: The Science Behind Toddler Naps

Blog banner

How to insert contacts in zoho crm using php

Blog banner

Gen Z buys by seeing things online, and why you, as a new company, need to be online

Blog banner

Royal enfield

Blog banner

What is the point of living if we can die at any moment of our lives ?

Blog banner

ADIDAS

Blog banner

Google classroom

Blog banner

What is Vishing?

Blog banner

About myself

Blog banner

Benefits of yoga and meditation

Blog banner

Deadlocks in Operating Systems

Blog banner

Expressing and Measuring Risk (Risk Management)

Blog banner

Understanding the 'Ambiverts'

Blog banner

Artificial Intelligence (AI)

Blog banner

Data Visualization in Decision-Making

Blog banner