Which of the following statement is true about semaphore? Statements: I. It…
2021
Which of the following statement is true about semaphore? Statements: I. It can be implemented using software II. It can be implemented using hardware
- A.
Only I
- B.
Only II
- C.
Both I and II
- D.
Neither I nor II
Attempted by 303 students.
Show answer & explanation
Correct answer: C
Option 3: Both I and II
Semaphores are highly versatile and can be implemented through various means:
Software Implementation: Algorithms like Dijkstra's original semaphore operations ($P$ and $V$) can be implemented entirely in software logic within the operating system kernel.
Hardware Implementation: Modern systems often use hardware-level atomic instructions, such as Test-and-Set or Compare-and-Swap, to implement semaphores efficiently and ensure that the increment/decrement operations are uninterrupted.