Factors designating a piece of code as critical section
As of I understand, process synchronization
is employed using kernel data structures such as semaphores
, to prevent concurrent access to the critical section
of the code. In general I see definitions to be, "critical section is the piece of code that may access shared data (or) shared resources". So the questions are:
- Shared data is a user space entity. Hence it is the responsibility of the user process to ensure consistency of its access.
- I presume that concurrent access to resources by multiple processes is something that the kernel should take care. What sort of user level synchronisations are required there?
- What are the factors by which a piece of code in user space program is decided to be a critical section.