0

Does the programmer require to include code in his/her program to ensure solution to Critical Section Problem or is it taken care by the Operating system itself??

Moreover, if the programmer is the person who is writing code to solve critical section problem, then as per peterson's solution the entry section of this code uses shared variables themselves. These shared variables should then also be critical sections and we would need to restrict access to them as well. So how is this enforced?

  • 1
    Operating system just takes care of running the processes , but what ever is done in the process its the Process's duty to take care of all these Synchoronisation issues . For eg: If you write any code then it will be running under some process so its programmers duty to take care of all these items.This is why languages like C# provides lock , mutex , semaphore etc so that developers will make use of this and accomplish what they need. Whats is perterson's solution , can you take us to the link ? – srsyogesh Oct 27 '13 at 16:54
  • http://en.wikipedia.org/wiki/Peterson's_algorithm – sdanzig Oct 27 '13 at 17:06
  • Thanks for the link. Yes , indeed as you said the variables should also be in a critical section , but it might be hard to achieve this . If i would want to implement this behavior i would rather use Mutex instead of these variables . i come from .Net world so i talk about Mutex , eg is given here http://stackoverflow.com/questions/229565/what-is-a-good-pattern-for-using-a-global-mutex-in-c – srsyogesh Oct 27 '13 at 17:23

0 Answers0