Distinction between the concept of concurrent and parallel

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.

Overall concept:

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 Programming:

"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.

分类:Tech 时间:2010-03-16 人气:209
blog comments powered by Disqus


  • Java concurrent programming practice reading notes (1) 2010-05-06

    Concurrent programming in the preparation of high-performance, scalable applications often used when a technology is a relatively advanced technology, every necessary skills to do the back-end development. This book is about Java and the contracted u

  • Practice reading notes java Introduction to concurrent programming 2010-12-07

    package cn.wtu.executor; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.concurrent.Future; import java.util.concurrent.LinkedBlockingQueue; /** * * Versi

  • Explore the concurrent programming (1 )------ operating system articles (change) 2010-08-08

    Original Address: here In multi-threaded, multi-processor or even a distributed programming environment, time, concurrency is an unavoidable problem, many programmers encounter complications of a word on the scalp tingling, including me. As in the fa

  • Java concurrent programming and tracking the implementation of complex tasks 2010-06-12

    Consider the following business scenarios (very common form of business scenarios): /** * This example shows multiple threads programmatically read n complex tasks , And in the front-end interface * This n complex task execution progress and situatio

  • Turn: java concurrent programming practice notes 2010-03-29

    Source: http://galaxystar.javaeye.com/blog/168950 1, to ensure thread safety of the three methods: a, do not cross-thread access to shared variables b, so that is the final type of shared variables c, the operation of the shared variables with synchr

  • java concurrent programming practice notes 2010-03-31

    java concurrent programming practice notes [change] From: http://kenwublog.com/java-concurrency-in-practise-note 1, ensure thread-safe three ways: a, do not cross-thread access to shared variables b, so that is the final type of shared variables c, t

  • (Transfer) Beyond Locks and Messages: The Future of Concurrent Programming 2010-08-03

    (Transfer) Beyond Locks and Messages: The Future of Concurrent Programming Posted by Bartosz Milewski under Chapel , Concurrency , Fortress , Multithreading , Parallelism , Programming , X10 [17] Comments <script src="http://s0.wp.com/wp-content/p

  • java multithreaded concurrent programming and CPU clock distribution of a small meeting 2010-08-11

    Preorder ------- more than two hours to write an article When submitted to a sudden break net, then do not come back again Saved draft is more than one hour before Two fans blowing against the side also sweat It is the people are impetuous scrambled

  • Reprinted java concurrent programming practice notes 2010-09-20

    java concurrent programming practice notes 1, to ensure thread safety of three methods: a, do not cross-thread access to shared variables b, so that is the final type of shared variables c, the operation of the shared variables with synchronization 2

  • Scala and concurrent programming 2011-01-04

    Scala language has many advantages, such as simple, powerful performance, and so forth. But I am most concerned is that it has the advantage of concurrent programming. Scala by emphasizing the invariance of the object and the use of event-based model

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 闽ICP备15018612号

processed in 0.263 (s). 10 q(s)