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

Nature’s Brush on Silk: The Secret Behind Patola Colours

Blog banner

Dental Problems That Start Small But Should Never Be Ignored

Blog banner

Video games

Blog banner

Dove’s Real Beauty Campaign- Case Study

Blog banner

CyberSecurity Color Wheel

Blog banner

COMMUNICATION

Blog banner

PERT Overview

Blog banner

"Audit" In Data Science

Blog banner

Evolution of operating system

Blog banner

IS CONVERTING AMBITION INTO PROFESSION?

Blog banner

Veg Mix Pickle

Blog banner

Cyber Attacks -- Trends Patterns and Security Countermeasures

Blog banner

EMAIL INVESTIGATION

Blog banner

Memory Management in Operating System

Blog banner

IOT- Internet Of Things

Blog banner

A Weekend at Oak Tree Hotel: The Best Hotel Experience in Arcadia, Florida

Blog banner

The IT Service Lifecycle

Blog banner

Why Seasonal Summer Foods Are Best for Your Health?

Blog banner

DEVELOPMENTS LEADING TO MODERN OPERATING SYSTEMS

Blog banner

Models of Information Security.

Blog banner

How Sleep Impacts Learning and Behaviour for Toddlers?

Blog banner

PROCESS STATE:

Blog banner

Dudhasagar waterfall ?

Blog banner

Cache memory

Blog banner

Protect yourself from System Hacking with these Simple Steps

Blog banner

21ST CENTURY PATRIARCHY

Blog banner

The Future of Cybersecurity: Trends, Challenges, and Strategies

Blog banner

Microsoft Windows Overview

Blog banner

RAID

Blog banner

Mumbai Metro 3

Blog banner

Dal Bafla Recipe

Blog banner

Social media

Blog banner

I/O Buffering

Blog banner

Mutual exclusion

Blog banner

"Games and the future"

Blog banner

TRAIN TRAVELING

Blog banner

The Role of Frontline Managers in Driving Workplace Performance and Customer Satisfaction

Blog banner

File Management In OS

Blog banner

Predictive Analytics: How Data Science Predicts Trends(Weather ,Stock Market,Sales Forecasting ).

Blog banner

BUFFER OVERFLOW_142

Blog banner

Excel records

Blog banner

SNAPCHAT

Blog banner