Serial, parallel, concurrent

    We assume here that three events A, B, C used in the following examples.

A serial

    There will be two concepts in the concept of the serial:

  • Serial (Serial) and parallel (Parallel) corresponds, when we refer to a particular job step to a step of FIG.
  • Serial communication means. Serial communication means using a data line, the data sequentially transmitted bit by bit, each bit of data occupies a fixed length of time.

     Serial and parallel communication among the words, and there multiplexing situation.
    Multiplexing means at the same transmission medium (lines) carry multiple signals to communicate. All signals sent in the previous transmission medium, basis having certain rules is modulated, the modulated signal transmitted facilitate the brightest in a medium, not confounding, so that the signal is transmitted to the other party at the time of having sufficient energy, and can be used for reverse modulation a method to distinguish, restored to the original signal. Commonly used methods of multiplexing frequency division multiplexing and time division multiplexing, code division multiplexing is also expanding.
Here Insert Picture Description
    The system assigns a thread, step by step implementation of event A, B, C.

Advantage : As the task, so the functions are not thread-safe in case there is a thread of execution, there would be no problem critical areas.
Drawback : You can not make good use of cpu (contemporary multi-core, multi-cpu hardware case) the resources to improve the processing advantages.

Second, concurrent

    When there are multiple concurrent threads in operation, if the system is only one CPU, then it simply can not be true at the same time more than one thread, it can only CPU time is divided into several periods, then the period of time allocated to each a thread of execution, a thread of code running period, the other thread is in a suspended state. This way we call concurrent (Concurrent).
Here Insert Picture Description
    The event A is assigned to the thread 1, the thread assigned to the event B 2, C assigned to the thread 3 event. But the system is only one CPU, so two threads can not be performed simultaneously. At the same time you can only execute one thread.

Third, parallel

    When the system has more than one CPU, then it is possible to operate the thread non-concurrent. When a CPU executes a thread, the other CPU can execute another thread, two threads and do not seize the CPU resources, may be performed simultaneously, we call such a manner parallel (Parallel).
Here Insert Picture Description
    We will assign to the event A thread 1, thread 2 assigned to B event, the event is assigned to the thread C 3. Because this time we have more CPU, so we can execute simultaneously.

Advantages : As the task, so that execution speed is a function of the N threads, high efficiency CPU (contemporary multi-core, multi-cpu hardware case) and also by high.
Drawback : there is thread-safe situation, which is a critical problem area data is not accurate, unsafe, dirty data will appear.

    I.e. concurrency and parallelism are two similar but distinct concepts, refer to two or more parallel events occur at the same time; and refers to two or more concurrent events occurring at the same time interval. In a multiprogramming environment, concurrency refers to a period of time in a plurality of programs run simultaneously macroscopically, but in a single processor system, but each time there is only one program execution, it is only these programs microscopically sharing can be alternately performed. If a plurality of processors in a computer system, these programs can execute concurrently can be assigned to a plurality of processors, parallel execution, i.e., the use of each processor to a processing program can be executed concurrently, so that multiple programs can be executed simultaneously.

Published 25 original articles · won praise 7 · views 2132

Guess you like

Origin blog.csdn.net/qq_41506111/article/details/102836371