critical sections code example
Example: critical section
The critical section is a code segment where the shared
variables can be accessed.
An atomic action is required in a critical section
i.e. only one process can execute in its critical
section at a time. All the other processes have to wait
to execute in their critical sections.