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

Cache memory

Blog banner

KASHMIR TRIPS

Blog banner

Ola

Blog banner

TOGETHER WE CAN CONQUER #team

Blog banner

RAID

Blog banner

Article on Team Work

Blog banner

Business Engineering

Blog banner

Puri Jagannath temple

Blog banner

The New Rules of UI/UX Design Every Website Must Follow in 2026

Blog banner

Partnership in Learning: How Parent Involvement Shapes a Child’s Early Education

Blog banner

DATA BREACH CAUSES CHALLENGES PREVENTION AND FUTURE DIRECTIONS

Blog banner

Mumbaicha Dabbawalla

Blog banner

From Loom to Luxury: How Patola Elevates Modern Wardrobes

Blog banner

Online Games

Blog banner

TOP 5 GAMING GADGETS (2024)

Blog banner

How Does Preschool Help Children Become Better Decision Makers?

Blog banner

'Positivity in life'

Blog banner

KEAP MANAGEMENT SYSTEM

Blog banner

What do you mean by online marketing and why do you need to know about it

Blog banner

Understanding E-mail Servers

Blog banner

TRELLO

Blog banner

Digital Marketing

Blog banner

Deadlock

Blog banner

POVERTY:Causes and solutions to problems

Blog banner

In the world of Technology...

Blog banner

IOT Hacking Techniques

Blog banner

Types of Hackers.

Blog banner

Data Mapping

Blog banner

SECURITY RISKS OF REMOTE WORKING

Blog banner

Cache memory

Blog banner

Malware Detection Techniques for Mobile Devices

Blog banner

Hacking of web server and application

Blog banner

Functions Of Operating Systems

Blog banner

Social engineering in cyber security

Blog banner

DEVELOPMENTS LEADING TO MODERN OPERATING SYSTEMS

Blog banner

Human Error: The weakest link in Cybersecurity

Blog banner

Skills An Ethical Hacker Must Have

Blog banner

Deadlock

Blog banner

The Art Of Getting What You Want In Life....

Blog banner

Assignment 2

Blog banner

Install Ubuntu Easily

Blog banner

Blockchain Transactions

Blog banner