Traditional Culture Encyclopedia - Traditional customs - What is the basic unit of resource allocation and scheduling in an operating system that introduces threads? Process or thread? Why?

What is the basic unit of resource allocation and scheduling in an operating system that introduces threads? Process or thread? Why?

In an operating system that introduces threads, the basic unit of resource allocation and scheduling is the process.

Processes represent a single computer program running a set of activities, and are the basic unit of resource allocation and scheduling in a system, and are the basis of the operating system structure.

In early process-oriented computer architectures, the process was the basic execution entity of the program, and in modern computer architectures designed for threading, the process is a container for threads. A program is a description of instructions, data, and their organization, and a process is the entity of a program.

The reason why operating systems introduced the concept of a process: from a theoretical point of view, it is an abstraction of the process of a running program. From an implementation point of view, it is a data structure designed to clearly portray the inner laws of a dynamic system and to effectively manage and schedule programs that enter the main memory of the computer system to run.

Expanded:

.

The entities of a thread include the program, data, and the TCB.A thread is a dynamic concept, and its dynamic characteristics are described by the Thread Control Block (TCB).The TCB includes the following information:

1. Thread state.

2. Live resources that are saved when the thread is not running.

3. A set of execution stacks.

4. A local variable main memory area that holds each thread.

5. Access to main memory and other resources in the same process.

A set of registers and stacks used to indicate the program counter for the sequence of instructions being executed, reserved local variables, a few status parameters, return addresses, etc.

Baidu Encyclopedia-Process