Discussion
Which of the following ensures mutual exclusion in concurrent processes ?
Answer: B
Mutual exclusion is ensured by atomic test-and-set instructions.
A test-and-set instruction reads a lock variable and sets it to 1 in a single, indivisible hardware operation. A process enters its critical section only if the old value was 0; any other process that tries at the same moment sees 1 and must wait. Because no other process can slip in between the read and the write, only one process can hold the lock, which is the basis of spinlocks.
Unbuffered I/O only changes how data reaches a device. Environment variables and command-line arguments pass settings to a process when it starts. None of them coordinates access to shared data between running processes.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development