CPU and core and process and thread understanding

CPU and core

Physical core

Number of physical cores = cpu number (number of CPUs loaded on the machine) * number of cores per cpu

Virtual core

The so-called 4-core 8 thread, 4 core refers to the physical core. Through Hyper-Threading Technology, two virtual cores are simulated with one physical core, two threads per core, for a total of eight threads.

It appears to the operating system to be 8 cores, but is actually 4 physical cores.

Hyper-threading technology enables a single physical core to implement thread-level parallel computing, but not as good as two physical cores.

Single core cpu and multicore cpu

Are all a cpu, the difference is the number of cores on each cpu

Multi-core CPU is an alternative to multiple single-core CPUs. Multi-core CPUs reduce the size and power consumption.

A core can only execute one thread at the same time

Process and thread

understanding

A process is the smallest unit allocated by the operating system for resources (including cpu, memory, disk IO, etc.).

Thread is the basic unit of cpu scheduling and allocation

We open WeChat, the browser is a process

A process may have multiple subtasks, such as WeChat to accept messages and send messages. These subtasks are threads.

Resources are allocated to processes, and threads share process resources.

Compared

Thread switching

The cpu allocates a time slice (that is, the time allocated to the thread) to the thread, and switches to another thread after the time slice is executed.

The state of the thread is saved before switching, and the current state is known when the next time slice is given to this thread.

From the state of saving thread A to switching to thread B, the process of reloading the state of thread B is called context switching.

Up and down switching will consume a lot of cpu time.

Thread overhead

Context switch consumption

Thread creation and extinction overhead

Threads need to be saved to maintain the thread local stack, which will consume memory

Serial, concurrent and parallel

Serial

Multiple tasks, one execution after execution and another.

Metaphor: After dinner, watch the game.

Concurrent

Multiple threads run on a single core, one thread runs at the same time, the system keeps switching threads, and it looks like it is running at the same time. In fact, the threads keep switching.

Metaphor: I will go to the food hall to eat, and then I will go to the living room to watch the game.

parallel

Each thread is assigned to a separate core, and the threads run simultaneously.

Metaphor: Watching the game while eating.

Multi-core thread number selection

Compute-intensive

Programs are mainly complex logic judgments and complex operations.

The utilization of cpu is high, there is no need to open too many threads, and opening too many threads will waste resources because of switching context when the thread switches.

IO intensive

The program is mainly IO operations, such as disk IO (read file) and network IO (network request).

Because IO operations will block threads, cpu utilization is not high, you can open more threads, you can switch to other ready threads when blocking, improve cpu utilization.

to sum up

One way to improve performance: increase hardware level, processing speed or number of cores.

Another way: According to the scene, the number of threads is reasonably set, and the CPU utilization is improved on the software.

YOOZ Vape

Yooz Pod has 38 fruit flavors, Yooz Kit has ordinary solid color, gradual color, illustration Kit, disposable yooz, small and light


Hot Selling Original Yooz Vape Kit ZERO2 Essential Device

Looking for Vape Kit? We provide you with the most cost-effective Yooz Vape kit, so that customers can enjoy a better new smoking experience at the most affordable price.Yooz Vape Kit ZERO 2 Device is the Replaceable Vape rechargeable battery part of the YOOZ ZERO 2 Vape Pod System Vape Kit, featuring a double leak proof structure design, lightweight and no fire button design. The battery capacity of the device is 350mAh. It allows about 300 puffs with the battery fully charged. Middle of the device is an intelligent [Y" shaped LED battery life indicator, it will let you know when you need to charge.


Main Features:

1. Creates extremely dedicated atomized and fume oil enriched taste nicotin salt brings you stronger throat experience.

2. Patented double leak proof structure design pod.

3. 30 minutes charging provide you with 24 hours heavy use.

YOOZ Vape kit

Specifications:

Brand: YOOZ Vape

Battery Capacity: 350mAh

Full Charge:30 minutes

Size: 88.5x21x11.5mm

Package Contents:

1* YOOZ ZERO 2 Device

1* Micro USB Charging cable

1* User Manual

Rechargeable Vape YoozRechargeable Vape Yooz


YOOZ Vape,YOOZ Disposable Vape,YOOZ Pod Premium Ingredients,YOOZ Mini Pod Kit,YOOZ Vape Pod

TSVAPE Wholesale/OEM/ODM , https://www.tsecigarette.com