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()
Since mutex locks require ___, this lock is called ___
Busy waiting, spinlock
Synchronization tool that provides more sophisticated ways for process to synchronize their activities
What operations are associated with this?
Semaphore
Wait() , signal()
A type of semaphore usage wherein int value can range over unrestricted domain
Counting semaphore
Atype of semaphore usage wherein int value can range only between 0 and 1 which is the counterpart of mutex locks
Binary semaphore
An implementation ofnthe semaphore wherein each semaphore has an assocated waiting queue
What are the data items in a waiting queue
Semaphore implementation without busy waiting
Value (int)
Pointer to next record on list
An operation in semaphore w/ no busy waiting wherein you place the process invoking the operation on the appropriate waiting queue
Block
An operation in semaphore w/ no busy waiting where you remove one process in the waiting queue and place it in the ready queue
Wakeup
Two or more processes WAITING INDEFINITELY for an event caused by ONLY ONE of the waiting processes
Deadlock
INDEFINITE BLOCKING wherein a process may NEVER BE REMOVED from the semaphore queue in which it is suspended
Starvation
A scheduling problem where LOWER PRIORITY PROCESS holds a lock needed by a HIGHER PRIORITY PROCESS
What is a solution for this?
Priority inversion
Priority inheritance protocol
High level abstraction that provides a convenient and effective mechanism for process synchronization
Monitor