Process Synchronization Flashcards
Processes can execute concurrently and may be interrupted at any time, partially completing execution
Process synchronization
A solution to the Producer Consumer problem
Have a counter initially set to zero
counter++ whenever producer produces new buffer
counter- - whenever consumer consumes the buffer
A scenario wherein there is data inconsistencies because of accessing the counter at the same time
Race condition
A scenario wherein a process must ask permission to enter the critical section in ___, and may follow critical section with__, then ___
Critical section problem
Entry section, exit section, remainder section
A solution to the critical section problem wherein if process p is executing in the critical section, no other processes can execute in their critical sections
Mutual exclusion
A solution to critical section problem wherein if no process is in the critical section and a process wants to enter the critical section, then the selection of that process to enter cannot be postponed
Progress
A solution to the critical section problem wherein a bound must exist on the number of times other processes can enter the critical section after a request has been made to enter the critical process and before the request is granted
bounded waiting
A critical section handling approach wherein preemption is allowed when running inkernel mode
Preemptive approach
A critical section handling approach wherein running is allowed until EXIT KERNEL MODE, BLOCK OR VOLUNTARILY YIELD CPU
- free of RACE CONDITIONS
Non-preemptive approach
A two process solution which assumes that load and store are atomic and cannot be interrupted
What are the two variables used by this solution?
Peterson’s solution
int turn (indicated whose turn it is) Boolean flag array (indicates if process is READY [true] to enter critical section)
Hardware support for implementing critical section code via locks
Locking
A processor that could disable interrupts
Uniprocessors
Atomic / non-interruptable instruction wherein it is
-executed atomically
-returns ORIGINAL VALUE of passed parameter
-set new value of passed parameter to TRUE
SHARED BOOLEAN LOCK INITIALIZED TO FALSE
Test and set instruction
Atomic/non-interruptable instruction wherein
-executed atomically
-return ORIGINAL VALUE of passed parameter
-if value == expected, value = new value (swap only if value is equa; to the expected)
SHARED LOCK INITIALIZED TO 0
Compare and swap instruction
Simplest solution to critical section problem
System calls associated with this solution are?
Mutex locks
Acquire() , release()