Multi-core and multi-threaded quiz

Source: Internet
Author: User

Would you like to have multi-threading a certain number of cores?
For the operating system and software, multithreading does not imply the need for multi-core CPUs, in fact, all personal PCs were single-core before 2005, but Windows NT, which was introduced in 1993, supports multithreading. The operating system uses the method of time-sharing to make multiple lines accesses tile CPU times.

Does multithreading mean that it must be executed concurrently? ' There are too many concepts on the Internet, too general, to ask the answers of the great gods ...
Not necessarily, the operating system dispatches threads based on thread affinity, synchronization, and locks. For example, two memory-locked threads read and write to each other, so they are alternately running. As explained here, concurrency and parallelism are not a concept, concurrency refers to macro-logic, and parallelism refers to the simultaneous operation of multiple CPUs. As mentioned earlier, before 2006, there were often only one processor on a PC, so it was impossible to parallelize for a single processor.

Well, what are some of the classic introductory books on multicore programming? Just get started.
This is divided into several levels, one is the mathematics, the algorithm level "parallel Computing" category of books, one is the programming language/api level of books, such as various Java books. Another is the operating system, hardware and computer architecture, such as "Operating system" computer architecture. Mastering multi-threaded programming is one thing, really writing out the algorithm that can make full use of parallel computing, and getting a good speedup is another matter. Some mathematical problems, such as the decimal for PI, have been mathematically proven to be non-parallel computing, only serial computing, but the hexadecimal pi calculation can be parallel. Like this knowledge, programming books are not going to tell you.

If you are doing multi-core programming, are there any software tools or a view of CPU usage? I went to multicore programming and wanted to see the difference between multicore programming and single core CPU performance ...
Cpuz's official website has a tool that can get CPU usage through counters inside the CPU. In addition, you can visually obtain the program's speedup by comparing the execution time of the program. Note that the diagram in Windows Task Manager is unreliable, primarily because multiprocessor environments are complex, such as a dual-core processor with Hyper-Threading technology, when two full-load threads are executed in two physical cores, when Windows Task Manager reports a usage rate of 50% , it may be true that CPU utilization is 80~90%. For example, for NUMA nodes, the Windows Task Manager does not reflect the affinity of the processor kernel well.

Multi-core and multi-threaded quiz

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.