当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- ES中删除索引的mapping字段时应该考虑的点
- [learning] interface test case writing and testing concerns
- Junit测试出现 empty test suite
- Utility class functions (continuous update)
- 非易失性MRAM存储器应用于各级高速缓存
- ES6 learning notes (2): teach you to play with class inheritance and class objects
- 迅为iMX6开发板-设备树内核-menuconfig的使用
- An article takes you to understand CSS gradient knowledge
- 2020-09-03:裸写算法:回形矩阵遍历。
- Novice guidance and event management system in game development
猜你喜欢
消防器材RFID固定资产管理系统
With this artifact, quickly say goodbye to spam messages
超高频RFID医疗血液管理系统应用
What kind of music do you need to make for a complete game?
STM32F030K6T6兼容替换灵动MM32F031K6T6
【涂鸦物联网足迹】物联网基础介绍篇
2020-09-04:函数调用约定了解么?
How about small and medium-sized enterprises choose shared office?
Some operations kept in mind by the front end foundation GitHub warehouse management
What is the meaning of sector sealing of filecoin mining machine since the main network of filecoin was put online
随机推荐
What grammar is it? ]
实用工具类函数(持续更新)
How to play sortable JS vuedraggable to realize nested drag function of forms
上海巨微专用蓝牙广播芯片
移动端像素适配方案
Visual rolling [contrast beauty]
Stickinengine architecture 12 communication protocol
A small goal in 2019 to become a blog expert of CSDN
Interviewer: how about shardingsphere
Axios learning notes (2): easy to understand the use of XHR and how to package simple Axios
Novice guidance and event management system in game development
To teach you to easily understand the basic usage of Vue codemirror: mainly to achieve code editing, verification prompt, code formatting
NAND FLASH的接口控制设计
Can you do it with only six characters?
【涂鸦物联网足迹】涂鸦云平台全景介绍
Utility class functions (continuous update)
With this artifact, quickly say goodbye to spam messages
es创建新的索引库并拷贝旧的索引库 实践亲测有效!
Nodejs中使用jsonwebtoken(JWT)生成token的场景使用
Unity performance optimization