Home Common Problem The basic unit for allocating CPU

The basic unit for allocating CPU

Jul 23, 2019 pm 03:56 PM
cpu

The basic unit of allocating CPU time in Windows is the thread. A thread is the smallest unit that the operating system can perform operation scheduling. It is included in the process and is the actual operating unit in the process.

The basic unit for allocating CPU

A thread refers to a single sequential control flow in a process. Multiple threads can run concurrently in a process. Each thread Execute different tasks in parallel. (Recommended learning: PHP video tutorial)

is also called lightweight processes in Unix System V and SunOS, but lightweight processes refer more to kernel threads. thread), and the user thread (user thread) is called a thread.

Threads are the basic unit of independent scheduling and dispatch.

Threads can be kernel threads scheduled by the operating system kernel, such as Win32 threads; user threads scheduled by the user process itself, such as POSIX Thread on the Linux platform; or threads between the kernel and user processes, such as Windows 7 threads. Perform hybrid scheduling.

Threads are entities in a process. A process can have multiple threads, and a thread must have a parent process. The thread does not own system resources, only some data structures necessary for operation; it shares all resources owned by the process with other threads of the parent process. Threads can create and destroy threads to achieve concurrent execution of programs.

Generally, threads have three basic states: ready, blocked and running.

In a multi-CPU system, different threads can run on different CPUs at the same time, even when they belong to the same process. Most operating systems that support multi-processors provide programming interfaces that allow processes to control the affinity between their own threads and each processor.

Sometimes, threads are also called lightweight processes. Just like processes, threads are independent, concurrent execution paths in the program. Each thread has its own stack, its own program counter, and its own local variables. However, threads within a process are less isolated from each other than separate processes.

They share memory, file handles, and other states that each process should have.

A process can support multiple threads, which appear to execute simultaneously but are not synchronized with each other. Multiple threads in a process share the same memory address space, which means they can access the same variables and objects, and they allocate objects from the same heap.

Although this makes it easier to share information between threads, you must be careful to ensure that they do not interfere with other threads in the same process.

For more PHP-related technical articles, please visit the PHP Graphic Tutorial column to learn!

The above is the detailed content of The basic unit for allocating CPU. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What should the CPU utilization be when gaming? What should the CPU utilization be when gaming? Feb 19, 2024 am 11:21 AM

What should the CPU utilization be when gaming?

How to undervolt and overclock your CPU using Intel XTU How to undervolt and overclock your CPU using Intel XTU Feb 19, 2024 am 11:06 AM

How to undervolt and overclock your CPU using Intel XTU

How to set CPU performance to full in Win11 How to set CPU performance to full in Win11 Feb 19, 2024 pm 07:42 PM

How to set CPU performance to full in Win11

The difference between boxed and bulk cpu The difference between boxed and bulk cpu Jan 23, 2024 am 09:46 AM

The difference between boxed and bulk cpu

The operation process of WIN10 service host occupying too much CPU The operation process of WIN10 service host occupying too much CPU Mar 27, 2024 pm 02:41 PM

The operation process of WIN10 service host occupying too much CPU

144-core, 3D-stacked SRAM: Fujitsu details next-generation data center processor MONAKA 144-core, 3D-stacked SRAM: Fujitsu details next-generation data center processor MONAKA Jul 29, 2024 am 11:40 AM

144-core, 3D-stacked SRAM: Fujitsu details next-generation data center processor MONAKA

How to increase the clock frequency of your computer's CPU How to increase the clock frequency of your computer's CPU Feb 20, 2024 am 09:54 AM

How to increase the clock frequency of your computer's CPU

Leak reveals key specs of Intel Arrow Lake-U, -H, -HX and -S Leak reveals key specs of Intel Arrow Lake-U, -H, -HX and -S Jun 15, 2024 pm 09:49 PM

Leak reveals key specs of Intel Arrow Lake-U, -H, -HX and -S