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

Deadlock Prevention

Blog banner

FRIENDSHIP

Blog banner

OS Assignment 3

Blog banner

Components of GIS

Blog banner

Social Engineering

Blog banner

Benefits and drawback of web security.

Blog banner

Hash password! Is it really secured?

Blog banner

INTERNET

Blog banner

Virtual Memory

Blog banner

Boxing

Blog banner

Utilizing Data-Hiding and Retrieval Techniques in Cyber Forensics

Blog banner

Technological Advancement

Blog banner

DIGITAL ECONOMY

Blog banner

PYTHON

Blog banner

Constrained Management in IT

Blog banner

Understanding Gen Z: A Generation Facing Crisis and Potential

Blog banner

Art and Culture of Rajasthan

Blog banner

Race Condition in Operating Theatre

Blog banner

IT security management

Blog banner

Carrot Pickle With Raisins (lagan Nu Achar)

Blog banner

Modern Operating System

Blog banner

SQL Injection

Blog banner

Every body is beautiful

Blog banner

Cyber Attacks -- Trends Patterns and Security Countermeasures

Blog banner

Developments in Modern Operating Systems

Blog banner

Deming’s Process

Blog banner

Street foods

Blog banner

Super Garlicky Tomato Soup with Smashed White Beans

Blog banner

10 Unsolved Mysteries all over the world

Blog banner

Security Issues

Blog banner

Deadlock and Starvation

Blog banner

Im Photographer

Blog banner

Study on cyber and network forensic in computer security management

Blog banner

Throttle engine ’Sneak peek into the future’

Blog banner

Deadlock and Starvation

Blog banner

Tools to support CSI activities

Blog banner

NETSUITE

Blog banner

Paralysis/Paralysis Stroke

Blog banner

Save Environment

Blog banner

Electronic Funds Transfer

Blog banner

Social engineering in cyber security

Blog banner

MENDELEY

Blog banner