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

Characteristics of Etherum

Blog banner

Google classroom

Blog banner

Simple Ways of Avoiding Basic Mistakes in Smart Phone Security

Blog banner

USES OF WHATSAPP

Blog banner

Disk Scheduling

Blog banner

File management

Blog banner

Types of threads

Blog banner

Memory Management

Blog banner

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

Blog banner

ARTICAL ON MANAGEMENT SYSTEM

Blog banner

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

Blog banner

Microsoft Word

Blog banner

Why Should You Schedule Tweets on Twitter?

Blog banner

How to make Pancakes

Blog banner

Blockchain Security Technique

Blog banner

Developments in Modern Operating Systems

Blog banner

Memory management

Blog banner

Race condition

Blog banner

Travel: Everything Everywhere!

Blog banner

The Peephole

Blog banner

Elegant fashion style

Blog banner

AN EVENT-BASED DIGITAL FORENSIC INVESTIGATION

Blog banner

Memory management

Blog banner

Advantage of freedom

Blog banner

Wedding photographer

Blog banner

Buffering

Blog banner

Process State

Blog banner

Why Festivals Are the Best Classrooms for Young Minds?

Blog banner

Starvation

Blog banner

EID UL FITR

Blog banner

Evolution of operating systems

Blog banner

INTRANET

Blog banner

Smart Homes | Zigbee Alliance

Blog banner

Digital Forensics Challenges and Tools

Blog banner

Supervised and unsupervised learning

Blog banner

How India made the GIS its Own, and its Use in Infrastructural Developments

Blog banner

Why Mumbai Professionals Are Switching Back to Home-Style Tiffin Meals

Blog banner

Yoga in INDIA and ABROAD

Blog banner

GIS Topography

Blog banner

Stay Close To Adventure In Arcadia, Florida At Oak Tree Hotel

Blog banner

Functions of operating system

Blog banner

Operating system

Blog banner