当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- C and C / C + + mixed programming series 5 - GC collaboration of memory management
- [self taught unity2d legendary game development] map editor
- [learning] interface test case writing and testing concerns
- Message queue - Analysis
- Unity performance optimization
- Qt音视频开发46-视频传输UDP版
- Why is quicksort so fast?
- Vue communication and cross component listening state Vue communication
- How to make characters move
- The memorandum model of behavior model
猜你喜欢
Summary of front-end interview questions (C, s, s) that front-end engineers need to understand (2)
2020-09-03:裸写算法:回形矩阵遍历。
An article will introduce you to CSS3 background knowledge
An article takes you to understand CSS pagination examples
The legality of IPFs / filecoin: protecting personal privacy from disclosure
Take you to learn the new methods in Es5
list转换map(根据key来拆分list,相同key的value为一个list)
The 4th China BIM (digital construction) manager Summit Forum will be held in Hangzhou in 2020
Mongo user rights login instruction
es创建新的索引库并拷贝旧的索引库 实践亲测有效!
随机推荐
ORA-02292: 违反完整约束条件 (MIDBJDEV2.SYS_C0020757) - 已找到子记录
The method of local search port number occupation in Windows system
Cloudquery v1.2.0 release
How does filecoin's economic model and future value support the price of fil currency breaking through thousands
Understanding formatting principles
2020-08-19:TCP是通过什么机制保障可靠性的?
JVM memory allocation - xms128m - xmx512m - XX: permsize = 128M - XX: maxpermsize = 512M
统计项目代码行数
Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案
大数据处理黑科技:揭秘PB级数仓GaussDB(DWS) 并行计算技术
Novice guidance and event management system in game development
What the hell is fastthreadlocal? The existence of ThreadLocal!!
How much disk space does a new empty file take?
Application insights application insights use application maps to build request link views
What kind of music do you need to make for a complete game?
Small program introduction to proficient (2): understand the four important files of small program development
预留电池接口,内置充放电电路及电量计,迅为助力轻松搞定手持应用
Common syntax corresponding table of mongodb and SQL
实验一
2020-08-15:什么情况下数据任务需要优化?