Home  >  Article  >  In an operating system, what is the smallest unit of resource allocation?

In an operating system, what is the smallest unit of resource allocation?

(*-*)浩
(*-*)浩Original
2019-12-10 13:24:1110336browse

In an operating system, what is the smallest unit of resource allocation?

#Process is the basic unit for resource allocation and scheduling in the system.

The process is also the scheduling unit that preempts the processor. It has a complete virtual address space.                                                                                                                                                                       (Recommended learning: web front-end video tutorial)

When a process is scheduled, different processes have different virtual address spaces, and different threads within the same process share the same address space.

Corresponding to the process, the thread has nothing to do with resource allocation. It belongs to a certain process and shares the resources of the process with other threads in the process.

Threads only consist of relevant stack (system stack or user stack) registers and thread control table TCB. Registers can be used to store local variables within a thread, but cannot store variables related to other threads.

Usually a process can contain several threads, which can utilize the resources owned by the process. In operating systems that introduce threads, processes are usually regarded as the basic unit of resource allocation, and threads are regarded as the basic unit of independent operation and independent scheduling. Since a thread is smaller than a process, it basically does not own system resources;

therefore the overhead paid for its scheduling will be much smaller, which can more efficiently increase the degree of concurrent execution among multiple programs in the system. , thereby significantly improving system resource utilization and throughput. Therefore, general-purpose operating systems launched in recent years have introduced threads to further improve the concurrency of the system, and regard it as an important indicator of modern operating systems.

In an operating system, what is the smallest unit of resource allocation?

#Thread entities include programs, data and TCB. Thread is a dynamic concept, and its dynamic characteristics are described by Thread Control Block (TCB).

TCB includes the following information:

(1) Thread status.

(2) On-site resources that are saved when the thread is not running.

(3) A set of execution stacks.

(4) Store the local variables of each thread in the main memory area.

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

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

The above is the detailed content of In an operating system, what is the smallest unit of resource allocation?. 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