当前位置:网站首页>2020-08-29: process thread differences, in addition to the inclusion relationship, the underlying details?
2020-08-29: process thread differences, in addition to the inclusion relationship, the underlying details?
2020-11-06 21:50:00 【Fuda Dajia architect's daily question】
Fogo's answer 2020-08-29:
1. Fundamental difference
process : The minimum unit of resource scheduling .
Threads :CPU Scheduling minimum unit .
2. address space
process : The process has its own address space , Every time a process is started , The system will allocate address space to it , Create data tables to maintain code snippets 、 Stack and data segments .
Threads : Threads have no independent address space , Threads of the same process share the address space of this process .
3. Memory and files share
process : When you create a process ,mm_struct It will point to another address , Use copy-on-write replicate .
Threads : And when you create a thread ,mm_struct Will point to the same virtual memory area of the parent process , So there will be resource conflicts .
Regardless of thread and process , stay linux The creation in is very fast .
4. block
process : Process control block PCB. A process uses ProcessControlBlock On the one entry Record its basic information (pid,state,priority etc. ), The process will be allocated a logical memory address space by the operating system , That is, it has a memory space for use .
Threads : Thread control block TCB. A thread is a unit within a process that is responsible for executing a task , This unit uses ThreadControlBlock On the one entry Record its basic information (tid,state,priority,counter,register info etc. ), This unit has its own stack For mission execution .
5. overhead
process : Process execution cost is high .
Threads : Low thread execution cost .
6. Switching speed
process : Switching is relatively slow .
Threads : Switching is relatively fast .
版权声明
本文为[Fuda Dajia architect's daily question]所创,转载请带上原文链接,感谢
边栏推荐
- Nodejs中使用jsonwebtoken(JWT)生成token的场景使用
- The Interpreter pattern of behavior pattern
- Using an example to understand the underlying processing mechanism of JS function
- Application insights application insights use application maps to build request link views
- 递归、回溯算法常用数学基础公式
- The native API of the future trend of the front end: web components
- Python basic data type -- tuple analysis
- 实验一
- 打工人好物——磨炼钢铁意志就要这样高效的电脑
- Take you to learn the new methods in Es5
猜你喜欢

Detect certificate expiration script

How to start the hidden preferences in coda 2 on the terminal?

Novice guidance and event management system in game development

递归、回溯算法常用数学基础公式

ado.net and asp.net The relationship between

磁存储芯片STT-MRAM的特点

Zero basis to build a web search engine of its own

Those who have worked in China for six years and a million annual salary want to share these four points with you

Summary of common SQL statements

2020 database technology conference helps technology upgrade
随机推荐
GitHub: the foundation of the front end
ES6 learning notes (4): easy to understand the new grammar of ES6
Introduction to Huawei cloud micro certification examination
递归、回溯算法常用数学基础公式
JVM memory allocation - xms128m - xmx512m - XX: permsize = 128M - XX: maxpermsize = 512M
行为型模式之备忘录模式
C calls SendMessage to refresh the taskbar icon (the icon does not disappear at the end of forcing)
Count the number of project code lines
How to prepare for the system design interview
Using an example to understand the underlying processing mechanism of JS function
打工人好物——磨炼钢铁意志就要这样高效的电脑
MRAM高速缓存的组成
Understanding formatting principles
2020 database technology conference helps technology upgrade
大数据处理黑科技:揭秘PB级数仓GaussDB(DWS) 并行计算技术
C language I blog assignment 03
Es create a new index database and copy the old index library, practice pro test effective!
实用工具类函数(持续更新)
The essence of transaction and the principle of deadlock
Elasticsearch database | elasticsearch-7.5.0 application construction