You can do it why not set in Visual Studio, because C + + has no mechanisms to automatically distribute your calculations on multiple threads. I know not whether you actually have is a programming language. So you have to manually create threads and fill them with useful code. The one with the "critical sections" is probably because you read a thread data while you write with the other thread data in the same memory space.To prevent the semaphores are often used to set a variable for other threads to block. Read out the wiki article about deadlocks through before you program further.