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

Cyber Security Standards

Blog banner

Emerging threats in cyber Forensics

Blog banner

Process State

Blog banner

Cache memory

Blog banner

A-B-C of Networking: Part-1 (Basics)

Blog banner

Body Image and Low Self Esteem: Understanding the Emotional Impact Beyond Appearance

Blog banner

Human factor, a critical weak point in the information security of an organization’s IOT

Blog banner

Brain wash of social media

Blog banner

How to write a cover letter

Blog banner

Deadlock and Starvation

Blog banner

Mariana Trench: The deepest depths

Blog banner

S-Tool : Steganography

Blog banner

Service design process in ITSM

Blog banner

Zero-Day Attack

Blog banner

Decoding the Weave — How to Identify Original Patola Art on a Fabric

Blog banner

Study of Backdoor and Trojan tools

Blog banner

Supervised and unsupervised learning

Blog banner

Pandas Matrix Applications

Blog banner

Beautiful and stunning natural phenomena worth to see

Blog banner

Music

Blog banner

Mumbai Metro 3

Blog banner

Security Issues

Blog banner

Dudhasagar waterfall ?

Blog banner

"Mahakali cave"

Blog banner

To travel is to live

Blog banner

Social media

Blog banner

LinkedIn: Watch out for these 7 upcoming updates in 2023

Blog banner

POSITIVE ATTITUDE IN LIFE

Blog banner

Efficiency of SQL Injection Method in Preventing E-Mail Hacking

Blog banner

Deadlocks in Operating Systems

Blog banner

Shoulders

Blog banner

Cloud Technology and its Implications for Entrepreneurship

Blog banner

Memory management

Blog banner

MACHINE LEARNING

Blog banner

How To Invest In Indian Stock Market @ BSE & NSE ~ Tutorial 3

Blog banner

Fitness regime by Deepesh

Blog banner

Virtual Machine

Blog banner

Linux

Blog banner

USPS mail

Blog banner

Soak knowledge and level up your intellectual potential!!!

Blog banner

Beyond the Track: Why the Best Hotel in Arcadia, Florida, Completes Your IMSA Sebring Getaway

Blog banner

Different types of e-commerce platforms or advantages and disadvantages

Blog banner