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

Zomato (Income Sources)

Blog banner

SMARTSHEET MANAGEMENT SOFTWARE

Blog banner

RAID

Blog banner

Cyber Security in Data Breaching

Blog banner

The Truth Behind Viral DIY Dental Hacks

Blog banner

Impact of social media on the human life

Blog banner

The Right way of cooking

Blog banner

The application udemy

Blog banner

Memory management

Blog banner

Mumbai

Blog banner

Privacy in Social Media and Online Services

Blog banner

Mumbai Metro 3

Blog banner

Modern Operating System

Blog banner

An Approach To Spyware Detection And Removal

Blog banner

Ethical Issues in Data Science and Role of Data Science in Smart Cities

Blog banner

Vulnerabilities in OnePlus Devices

Blog banner

Virtual memory

Blog banner

Zomato's Secret Digital Marketing Techniques!

Blog banner

Direct Memory Access

Blog banner

Operating system

Blog banner

Direct Memory Access

Blog banner

Security issues in Sensor Networks and gathering admissible evidence in Network Forensics

Blog banner

Lemon and Chilli Pickle (Limbu Mirchi Achar)

Blog banner

My First Dream Bike

Blog banner

Fault Tolerance

Blog banner

"Life as a Part-time Student"

Blog banner

Cyber Security Control

Blog banner

Network Security Risks

Blog banner

clock

Blog banner

What is a Malware ?

Blog banner

Navigation With Indian Constellation(NavIC) by ISRO in Geographic Information Systems

Blog banner

Inventory management software system

Blog banner

Top 3 Places To Stay In Vienna

Blog banner

TEAMWORK

Blog banner

Introduction to Data Science: Life Cycle & Applications

Blog banner

Os(Computer security threats)

Blog banner

Bulk E-mail software

Blog banner

Virtual machine

Blog banner

Sage business cloud accounting

Blog banner

The Right way of cooking

Blog banner

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

Blog banner

Data Mapping

Blog banner