What is the difference between the multi-threaded program running efficiency in multi-core CPU and single-core CPU?

Source: Internet
Author: User

ArticleSource: http://topic.csdn.net/u/20080429/17/689d07f9-1199-4c8f-b7b7-60b24609270f.html

Depends on how the OS schedule threads to CPUs, and how applications set their threads 'processor affinity

In Windows, the operation system does the allocation for you based on CPU usage. you can set the affinity but, it will not determine which processor you run on. on the Xbox 360, the affinity is needed otherwise the 360 will not allocate your thread
A seperate processor at all.

In Mac, threads with default affinity policy will be scheduled freely on any processor. These threads will be preferentially migrated to run on an idle processor. Threads with affinity tags will tend to remain in place.

In Linux, you can force the thread to migrate on the other CPU, by calling * _ setaffinity () with different mask.

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.