SMP Analysis of multi-threading and multi-core processors

Source: Internet
Author: User

First analyze the advantages of the thread: 1, improve the concurrency of the program (thread-level parallelism, rather than instruction-level parallelism);
2. All threads in a process share all resources;
3, the cost of switching threads;
4. Interactive program can improve the response time through multi-threading method.


How to implement Multithreading:
1, the program adopts multi-threaded design scheme;
2, multi-core processor for a single single-threaded program provides a good platform for parallel optimization, is to absorb the implementation of better programs to run the effect.


When a multithreaded design program runs on an SMP platform, multithreading in the process is distributed across multiple cores of the CPU in parallel execution. If the execution process between threads is independent, then the degree of parallelism of the process at this time is the largest, if there is a competition between the resources or need synchronization and communication, its process of parallelism <1. If the structure of multiple threads is a sequential structure and the number of critical resources is 1 o'clock, the multithreaded design is degraded to single-threaded design mode, and its program efficiency is greatly compromised.


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.