critical section is the part of the program where shared resources are accessed by the processes.
for example consider 2 processes and they are sharing 1 variable
p1
process1
{
non critical section
critical section
non critical section
}
process2
{
non critical section
critical section
non critical section
}
now,
if a process enters into critical section in 1st program and it gets preempted and at the same time another process wants to enter in critical section then a problem occurs and that is called race around condition.
i.e, out put of a process depends on order of execution instructions of a process
to solve this problem we insert a piece of code before the critical section called entry section
and to insert another piece of code after critical section called exit section
by doing this we can avoid race around condition i.e, only 1 process enter in critical section and after completion of that process then only next process get into critical section