Critical section problems in concurrent programming

Asked

Viewed 577 times

0

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

1 answer

2


So that there is no impasse when it comes to critical section, one must look beyond the Progresso to Exclusão mútua e Espera Limitada.

Mutual exclusion - If the Pi process is running in its critical section, then no other process can 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 can not be postponed indefinitely.

Limited waiting - There needs to 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 request is granted: Suppose each process runs at a speed other than zero No assumptions regarding the relative speed of the N processes.

If these three factors occur, it will cause in Deadlock. To ensure that Deadlock does not occur, just ensure that one of these factors never occurs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.