Home >Common Problem >What are processes and threads

What are processes and threads

清浅
清浅Original
2019-05-06 13:38:5554780browse

Process is the basic unit of resource allocation. It is an instance of program execution and is created when the program is running. Thread is the smallest unit of program execution and is an execution flow of the process. One thread consists of multiple threads. consist of.

What are processes and threads

What is a process

A process is the basic unit of resource (CPU, memory, etc.) allocation, it is a program An instance at execution time.

When the program is running, the system will create a process, allocate resources to it, and then put the process into the process ready queue.

When the process scheduler selects it, it will allocate CPU to it. time, the program starts to actually run.

What are processes and threads

What is a thread

A thread is the smallest unit of program execution. It is an execution flow of the process and a CPU scheduler. and assigned basic units.

A process can be composed of many threads. All resources of the process are shared between threads. Each thread has its own stack and local variables.

Threads are scheduled and executed independently by the CPU, allowing multiple threads to run simultaneously in a multi-CPU environment. Similarly, multi-threading can also implement concurrent operations, and each request is assigned a thread to process.

What are processes and threads

The above is the detailed content of What are processes and threads. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:What is 127.0.0.1?Next article:What is 127.0.0.1?