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

Functions of operating system

Blog banner

Why is online marketing is important in current scenario

Blog banner

How to grow followers on Instagram business account?

Blog banner

The Rich Heritage Of Patola Sarees: Gujarat’s Timeless Weaving Art

Blog banner

Famous Indian dishes that where misunderstood to be Indian

Blog banner

Service Design Model

Blog banner

EID UL FITR

Blog banner

Electronic Evidence in Cyber Forensics

Blog banner

TEAMWORK

Blog banner

Cryptanalysis tool

Blog banner

10 Reasons to date your best friend

Blog banner

Smartsheet

Blog banner

Assignment 2

Blog banner

Why Are So Many Adults Getting Diagnosed with ADHD?

Blog banner

Os(Computer security threats)

Blog banner

Top 5 Benefits of Artificial Intelligence

Blog banner

THREADS (assignment 1)

Blog banner

Direct Memory Access

Blog banner

The Role of cryptography in cyber security

Blog banner

Heart Fulness Meditation

Blog banner

Malware

Blog banner

memory cache

Blog banner

Are Social Media Paid Campaigns Worth It?

Blog banner

Service Strategy principles

Blog banner

Deadlock in operating system

Blog banner

Video games

Blog banner

Kernel Memory Allocation In Linux.

Blog banner

Virtual memory in Operating System

Blog banner

Personalized Movie Recommendations with Data Science

Blog banner

Ransomware

Blog banner

Crypto tax evasion

Blog banner

Service Design Principles

Blog banner

Southern Turkey Earthquake: Causes and Consequences of a Tragic Natural Disaster

Blog banner

OS PROCESS DESCRIPTION AND CONTROL-SARVAGYA JALAN

Blog banner

E-mail security

Blog banner

RAID

Blog banner

HUBSPOT

Blog banner

Modern Operating Systems.

Blog banner

?How long does wisdom tooth pain last?

Blog banner

VIRTUAL MACHINES

Blog banner

Data Science in Predictive Analytics: Transforming Business Decision-Making

Blog banner

SQL Injection

Blog banner