Machine-translated by Google. Questions are authored in English.
Top

Discussion

What is the main disadvantage of Peterson's solution for mutual exclusion ?

  • A.It does not ensure progress
  • B.It fails on modern multi-core CPUs
  • C.It causes external fragmentation
  • D.It requires high memory access time

Answer: B

The main disadvantage is that it fails on modern multi-core CPUs.

Peterson's algorithm for two processes uses a flag array and a turn variable, and in theory it guarantees mutual exclusion, progress and bounded waiting. But the proof assumes that every read and write to memory happens in program order and is seen at once by the other processor. Modern multi-core CPUs and compilers reorder memory operations and buffer stores, so both processes can see the other's flag as false and enter the critical section together. It works on such machines only with explicit memory barriers, which is why real systems use atomic hardware instructions instead.

Option A is false: ensuring progress is one of the algorithm's proven properties. External fragmentation is a memory-allocation problem, and high memory access time is not its characteristic weakness.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.