Today I was reading about synchronization. I am a bit confused after reading that the Peterson solution for critical-section problem is a software-based solution.
Now my question is: what does it mean “software-based solution” ?
Today I was reading about synchronization. I am a bit confused after reading that
Share
To solve problem of critical section and enforce mutual exclusion there are several approaches :
First is software based solutions. This solutions have based on algorithms like Peterson algorithm, Dekker’s algorithm and Lamport’s bakery algorithm ( for more than one process ) to protect the critical section. these solution only assume elementary mutual exclusion at memory access level. Beyond this no support in the hardware, OS or programming language is assumed.
The main problem software approches is their high process overhead and the risk of logical error ( based on OS internals by Stallings )
Beside software solutions, we also have hardware solutions like Interrupt disabling, Compare&Swap instruction and Exchange instruction. These solution employ busy waiting and there’s possibility of starvation and deadlock .
Another paradigm to enforce mutual exclusion is to use Semaphores and Monitors which are mechanism implemented by OS and programming languages.