Number of threads vs. multi-core CPUs, the setting of the number of cores in VMware

Source: Internet
Author: User
  • The concept of number of CPUs , number of cores,number ofprocessor
    • CPU number
      • The independent central processing Unit, which is represented on the motherboard, is the number of CPU Slot Position
    • cpu cores
      • in each cpu core Each core has a separate alu , FPU , cache cpu 4 core 8 kernel in thread)
    • processor
      • Each physical core can simulate multiple logical cores , the "Hyper-threading" technique is to simulate the logical kernel as a physical hyper-thread by using special instructions, which is the processor. is a data processing channel, pipeline. It can be understood as a logical kernel (such as what we often call 4 core 8 thread in thread)
    • View the computer's processor number (virtual number of cores)
      • in linux top then enter 1 cpu0 to cpun shows the cpu virtual core number ( processor )

    • View physical number of cores
      • in the Linux Input in cat/proc/cpuinfo you'll see CPU Cores and the Processor the concept

  • about processes and threads
    • Process
      • is a CPU basic unit of dispatch and distribution
    • Thread
      • is the operating system for resources, including CPU , memory, disk IO ) The smallest unit assigned
    • Relationship
      • Open, the browser is a process, a process may have multiple subtasks, such as receiving information, sending information, these subtasks are threads
      • The process cannot share resources and communicate with each other. But the threads can communicate, sharing the resources of the process
      • Open a process, is to call a software, consumes more resources. But line threads will save a lot of resources when compared with the process.
    • switching between threads
      • Timeshare
        • Distribute time evenly, with each thread taking turns
      • Seize
        • High-priority threads have a large chance of grabbing resources
    • Thread Overhead
      • Context switches, saves the execution environment of the current thread, and restores the environment to which the thread is to be executed.
      • Overhead of thread creation and extinction
      • Threads need to be saved to maintain thread local stack, which consumes memory
      • when a thread is a certain amount, it slows down the performance of the system, because a multi-threaded switchover requires resources. So the number of threads should be 90% in the performance bottleneck .

  • selection of multi-core thread number
    • master-worker mode
      • Span style= "font-family: Italic" > for multitasking, we usually take the master-worker model. master responsible for assigning tasks, worker responsible for performing the task. If worker hang it, master responsible for re-scheduling. hadoop cluster even so namenode management datanode. This is the switch from thread to node.

           

    • COMPUTE-intensive
      • The procedure is mainly complex logic judgment and complex operation. Like our common machine learning and the like.
      • CPU using the high, should not open too many threads. Because too many threads can waste resources because of thread context switching.
      • The number of simultaneous tasks in a computationally intensive task should be equal to CPU the number of cores ( Processo count, virtual kernel also count)
    • IOIntensive
      • program is mainly io operation, such as disk io and network io hadoop MR
      • because IO The operation will block the thread, CPU A lot of time is waiting IO the completion of the operation, so CPU The utilization rate is not high, can be multi-thread, when IO switch to another ready thread when blocking, improving CPU the utilization
      • if the disk IO performance exceeds the capacity of the bus, the bottleneck at this point is IO and no longer be CPU , it doesn't make sense to open more threads. Because the bus is full, the data does not come.

  • about setting up the number of CPU cores for VMware virtual machines
    • machine settings: e5-2660 V2 two, each. Ten Nuclear, - Threads
    • VMware Setup Interface

    • View VMware a variety of situations in ( Note: This shows the number of IDs , not the number )
      • CPU number Cat/proc/cpuinfo | grep "Physical ID"
      • CPU Core Cat/proc/cpuinfo | grep "Core ID"
      • CPU Processor Cat/proc/cpuinfo | grep "Processor"
    • Contrast

Set up

vmcpu number

VMCPU Core

VMCPU processor

Conclusion

number of processors: 1

number of cores per Processor: 4

1

4

4

1u4 Nuclear 4 Threads

number of processors: 2

number of cores per Processor: 2

2

2

4

2u1 Nuclear 2 Threads

number of processors: 4

number of cores per Processor: 2

4

2

8

4U2 Nuclear 2 Threads

Visible: VMware in: Number of processors ( P ) actually represents the virtual machine's CPU number

the number of cores per processor ( C ) actually represents a virtual machine. CPU of the Core

  • VMwareBest practices for setting the number of cores
      • of the virtual machine CPU the number of settings should be less than the number of physical machines. number of processors * number of cores per processor < physical machine processor
      • if the virtual machine's Processor number greater than the physical machine Processor number, the virtual machine management system is first rotated by time slices, and then if there are any remaining physical CPU resources, it is given to the virtual CPU

    • Reference "Thank you for your efforts, Let me make progress. "
      • http://blog.guoyb.com/2018/08/18/cpu-cores/?hmsr= Toutiao.io&utm_medium=toutiao.io&utm_source=toutiao.io
      • http://www.cnblogs.com/-new/p/7234332.html
      • http://www.cnblogs.com/52mm/p/p2.html
      • www.liaoxuefeng.com/wiki/ 001374738125095c955c1e6d8bb493182103fac9270762a000/001397567993007df355a3394da48f0bf14960f0c78753f000

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.