İçeriğe geç

The biggest reason of the complexity which are faced in multithread programming is non-determinism. On a typical single threaded software, the code sections which are written by the software developer are executed step by step in an exactly same order on each running of the software. However, in a multi-threaded software, the threads are scheduled randomly and the execution order of the code sections are change in each running of the software. This situation may not lead a significant problem if there is no any interaction between the threads. However, in real software applications, the case is opposite. Generally, there are interaction between the threads. For instance, one thread waits a value which is obtained by the other threads ( dependent tasks ) or the threads modified a common variable. On the standard C++ applications, mutual exclusion ( mutex ) is used in order to avoid simultaneous access to a common variable or resources. Mutual exclusion provides a protection mechanism against data races. A data race occurs when two or more threads in a single process try to access the same memory location concurrently and at least one of the accesses is for writing.

A critical section is a section of code that is executed by multiple threads and the sequence of execution for the threads makes a difference in the result of the concurrent execution. In classical multi threading, the software developer can only avoid simultaneous access to the critical sections and the execution order of the critical sections can not be controlled. Although mutual exclusion provides a protection mechanism against to the data races, it can not solve the problems when there are dependencies between tasks.

In cybernetic thread management, the software developer can control execution order of the critical section in addition to the mutual exclusion. In the figures which are given in below, the difference between the mutual exclusion and the cybernetic thread management has been figured.