Multi-core parallel programming technology (I.)

Source: Internet
Author: User

You first need to understand several concepts:
Serial: The most basic program execution mode, the entire runtime of the serial program, only one call stack and one runtime context, a single-process/single-threaded program can be considered a serial program.
Concurrency: Multi-Threading is a common way of program execution, when multithreaded programs run, there are multiple runtime contexts and corresponding multiple call stacks. Logically multiple threads occur at the same time, there is a physical operating system scheduling, the CPU is still only one thread at a time to perform the task, but an executing thread may be dispatched by the OS at any time, and the subsequent running of the thread operation of the data may be with the thread just dispatched to conflict, so there is a shared data synchronization problem.
Multi-Process If there is shared data, also meet the characteristics of concurrent programs, compared to multi-threaded concurrency, multi-process concurrent decoupling more thorough, data segmentation clearer.
In addition, the above concurrency is from the perspective of the user program, from the kernel point of view, there will be other similar scenarios, such as interrupts. There may also be a problem with shared data conflicts between interrupt handlers and programs executed before the interrupt.
Simply put, concurrency refers to multiple threads on the same hardware resourceAlternating executionThe process of all active threads in thewithin a certain period of timeWhile executing the state, but in theat a given momentOnly one thread is executing.
Parallel: Multi-core processor will become more and more common program execution mode, the physical multiple tasks can run concurrently, the concept between the operating system and architecture, from the operating system, still scheduling multiple threads/processes to CPU execution, but with multiple cpu/cores, different threads/ Processes can be bound to completely occupy a core, so from an architectural point of view, there are multiple tasks running simultaneously at the same time, others say, such as ' multiprocessor programs ' and ' multicore programs ' can be considered to be part of parallel programs.
To put it simply, parallel means that multiple threads are on different hardware resources or processing units.Simultaneous execution, which means that multiple threads areany point in timeare executed at the same time.

From the scope of the concept, parallel < concurrency, that is, parallel programs are certainly concurrency, concurrent programs are not necessarily parallel. However, whether it is logical concurrency (single processor, multi-threaded/multi-process) or physical concurrency (parallel, multiprocessor), the shared data operation consistency problem is the same, and in many cases multicore programming can be thought of as multithreaded programming.

Question: Why should microprocessors evolve from a single core to multicore?
Answer: Power issues limit the way in which a single core continues to improve performance.
Refer to the Intel official Web site for an explanation of the problem: http://blogs.intel.com/china/2007/06/03/post_5/

Multi-core parallel programming technology (I.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.