Process Synchronization Flashcards

1
Q

Explain why there is a need for process synchronization.

A
  • When a process or thread share certain sections of memory and access/modify that section of memory concurrently, there is often a need to synchronize access to that memory section.
  • This is because processes will have to read those memory into local registers, make modifications there before pushing that new data back to memory. When processes/threads run concurrently, there is a chance that two processes/threads may read the same memory section into local registers at the same time, make indepedent modifications and write them out, overriding each other and giving invalid data in memory.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe some approaches to solving synchronization problem.

A
  • Software only solution called peterson’s solution. Not guaranteed to work on modern hardware and not used anymore.
  • Synchronization hardware where hardware implements a way to test and set or compare and set some variable atomically, that is only one process or thread is guanranteed to be executing these functions at a time. Often used as a way to implement constructs available to application developers.
  • Mutex lock or mutual exclusion lock. Process/threads loop (busy wait) until a lock becomes available, acquire it, and run critical section before releasing.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly