On the current computer technology, at present most of the language to meet the concurrent execution, but now under the multi-core cpu or multi cpu started to have parallel concepts.
In the single-CPU system, the system operator at a time can only make one thread running, although there are many forms of this debugging mechanism (most of time Katawa main tour), but in any case, need to be run by continuously switching allowed to run the way the thread is called concurrency (concurrent). In multi-CPU system, two or more threads can run simultaneously, this can also allow two or more threads to run simultaneously is called parallel mode (parallel).
"Concurrent" in the implementation of the micro is not the same time, only the time into several sections, so that rapid alternation of the implementation of multiple processes, from outside the macro point of view, as if these processes are being implemented.
Use of multiple threads can help us in a single processing system to achieve higher throughput, if a program is single-threaded, this processor waiting for a synchronous I / O operation is complete, he is still free. In multi-threaded system, when a thread waiting for I / O, while the other thread can execute.
This bit spicy like a chef to do the time when so spicy chicken potato, spicy shredded chicken than do first do spicy fries speed, as it can alternately do.
Above this total is a single processor (chef) of the system processing tasks (cooking) the situation, only one chef, he was in a micro time, he can only do one thing, this is though multiple threads, but are run on the same processor.
However, multithreading is not necessarily improve the performance of programs, for example, your project manager assigned to you, 10 bug so you can change, you should be a one to change, most people will not bug to change every 5 minutes , that change End up, if so, what parts of the last change to remember. The total circumstances in which complicated and did not improve the performance of programs, but because of too much context switching introduces some additional overhead.
Therefore, under a single cpu can only achieve concurrent programs, parallel programs, but can not be achieved.
Now the era of multi-core cpu to, then the emergence of new concepts: parallel.
Is a real fine-grained parallel on the same time; both at the same time point simultaneously with multiple concurrent; more precise and simple terms: that is a program running on each cpu to reach the same point in time each cpu running a program.
Summary, the computer calculation principle is sequential; only one computer at the same time can only complete one operation; since not break this theoretical basis, then based in their development to go: to a computer built Duoge cpu , so that you can achieve true parallel.
For now, the hardware has come the era of multi-cpu, software technology has begun to follow in parallel, such as java has begun to add new virtual machines in parallel. However, the current terms, concurrent programming, or the mainstream. So what the situation continue to use concurrent programming?
For example, you have a calculation, including the calculation of cpu, network transmission, database access, io operation, if you do not use complicated, but single-threaded execution, then the cpu end computing, the program also need to wait for the next steps to complete a thorough be considered as an execution completed. If the process of implementation, but also the arrival of the new access, then wait for the completion of the last of the implementation of complete, to begin this visit. Such a large extent a waste of cpu resources; if concurrent programming using both linear programming, then the process would have described above: the first request is complete cpu calculation, the started to wait for the remaining steps of the implementation; the next requests may also be the first to complete the calculation of cpu, the remaining steps into the state; such a large extent to improve the efficiency of the process, also increased the cpu utilization, cpu full advantage of computing resources.
Therefore, if your program is only for the calculation of the cpu over, then the use of linear programming to more harm than good, because the cpu can only complete one calculation, if the calculation of an ongoing hang, start a new calculation, the new calculation of the half, was again suspended and returned to the previous calculation; we can realistically think about them: a student at the same time, can only do a homework, is currently doing language work, after doing some go, and started doing math, then open the data then have to work this, organize ideas, to find teachers of subjects such as layout, and then started; and then half-done, leaving the remaining languages of the operation started. . . . . . No need to describe anymore, right? So, just cpu calculation procedure does not require multi-threaded. But if the program includes a number of steps, of which a relatively time-consuming step, the program would like to finish one calculation, time-consuming operation to wait to return, this time have to consider the linear programming.