Critical section problems in concurrent programming

1

I'm implementing in C ++ a system with threads using semaphores. I am with a doubt, if I treat the progress situation, will I guarantee 100% that my implementation will not occur any impasse? Or do I need to be careful about something else?

    
asked by anonymous 12.11.2014 / 13:54

1 answer

1

In order to avoid any impasse when it is a critical section, you must consider beyond Progresso to Exclusão mútua e Espera Limitada .

Mutual Exclusion - If the process Pi is running in its critical section, then no other process may be running in its critical sections.

Progress - If no process is running in your critical section and there are some processes that want to enter your critical section then the selection of processes that will enter the critical section next can not be postponed indefinitely .

Limited wait - There must be a limit on the number of times other processes are allowed to enter your critical sections after a process has made a request to enter your critical section and before that such request be granted: Suppose each process runs at a nonzero speed No assumptions about the relative speed of N processes.

If these three factors occur, it will lead to DeadLock. To ensure DeadLock does not occur, just make sure one of these factors never happens.

    
12.11.2014 / 14:24