Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
1.3k views
in Computer by (106k points)
closed by

Semaphores are used to solve the problem of

(i) race condition

(ii) process synchronization

(iii) mutual exclusion

(iv) none of the above 


1. (i) and (ii) 
2.

(ii) and (iii)


3. All of the above 
4. None of the above

1 Answer

0 votes
by (103k points)
selected by
 
Best answer
Correct Answer - Option 3 : All of the above 

Concept:

Semaphores are used to solve the problem of race condition, mutual exclusion, and process synchronization.

A semaphore is a variable that has an integer value upon which two operations are defined wait and signal, which helps in solving the critical section problem.

Hence the correct answer is option 3.

Race Condition: 

A section of code where if multiple threads/processes execute it the final outcome is undefined and depends upon the order in which they execute. Thus some sort of mutual exclusion is required to avoid this condition

Mutual exclusion: 

A mutual exclusion (mutex) is a program object that prevents simultaneous access to a shared resource.

Process Synchronization:

Process Synchronization means sharing system resources by processes in a such a way that, Concurrent access to shared data is handled thereby minimizing the chance of inconsistent data 

Wait operation:

It decrements the semaphore value. If the value becomes negative, then the process executing the wait is blocked.

Pseudocode : 

wait(s)

{

while (s <=0)

s= s-1

}

Signal operation: 

It increments the semaphore value. If value is not positive, then a process blocked by wait operation is unblocked.

Pseudocode:

signal(s)

{

 s= s+1

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...