0
0
Operating Systemsknowledge~5 mins

Peterson's solution in Operating Systems - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is Peterson's solution used for in operating systems?
Peterson's solution is a method to ensure mutual exclusion, allowing two processes to share a single-use resource without conflicts or interference.
Click to reveal answer
beginner
Which two key variables does Peterson's solution use to control access?
It uses a 'flag' array to indicate if a process wants to enter the critical section and a 'turn' variable to decide which process's turn it is to enter.
Click to reveal answer
intermediate
How does Peterson's solution prevent both processes from entering the critical section at the same time?
By setting its own flag to true and giving the turn to the other process, a process waits if the other wants to enter and it is the other’s turn, ensuring only one enters at a time.
Click to reveal answer
intermediate
What are the three main properties Peterson's solution guarantees?
Mutual exclusion (only one process in critical section), progress (no process waits forever if the critical section is free), and bounded waiting (each process gets a chance eventually).
Click to reveal answer
advanced
Why is Peterson's solution mostly of theoretical interest today?
Because it requires strict assumptions like sequential consistency of memory operations, which modern processors and compilers may not guarantee, making it less practical for real systems.
Click to reveal answer
What does the 'turn' variable in Peterson's solution represent?
AThe total number of processes waiting
BThe number of times a process has entered the critical section
CThe priority level of a process
DWhich process's turn it is to enter the critical section
How many processes can Peterson's solution handle simultaneously?
AAny number of processes
BOnly two processes
CExactly three processes
DOnly one process
Which property ensures that no process waits forever in Peterson's solution?
ABounded waiting
BProgress
CMutual exclusion
DDeadlock
What happens if both processes set their flags to true and the turn variable is set to one process?
AThe process that set its flag first enters
BBoth processes enter simultaneously
CThe process whose turn it is enters the critical section
DNeither process enters
Why might Peterson's solution fail on modern processors?
ABecause modern processors reorder instructions affecting memory consistency
BBecause it uses too much memory
CBecause it only works with three or more processes
DBecause it requires special hardware
Explain how Peterson's solution uses the 'flag' array and 'turn' variable to achieve mutual exclusion.
Think about how a process signals it wants to enter and how it respects the other process's turn.
You got /3 concepts.
    Describe the main limitations of Peterson's solution in practical operating systems.
    Consider hardware and system behavior differences from the original assumptions.
    You got /3 concepts.