当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- Those who have worked in China for six years and a million annual salary want to share these four points with you
- window系统 本机查找端口号占用方法
- This project allows you to quickly learn about a programming language in a few minutes
- 迅为-iMX6ULL开发板上配置AP热点
- Understanding formatting principles
- Metersphere developer's Manual
- C calls SendMessage to refresh the taskbar icon (the icon does not disappear at the end of forcing)
- Jenkins installation and deployment process
- Unity performance optimization
- An article taught you to download cool dog music using Python web crawler
猜你喜欢
统计项目代码行数
How to play sortable JS vuedraggable to realize nested drag function of forms
[self taught unity2d legendary game development] map editor
The isolation level of transaction and its problems
Common syntax corresponding table of mongodb and SQL
Pn8162 20W PD fast charging chip, PD fast charging charger scheme
Exclusive interview with Alibaba cloud database for 2020 PostgreSQL Asia Conference: Zeng Wenjing
An article taught you to use HTML5 SVG tags
Common mathematical basic formulas of recursive and backtracking algorithms
Qt音视频开发46-视频传输UDP版
随机推荐
Vue communication and cross component listening state Vue communication
Utility class functions (continuous update)
Axios learning notes (2): easy to understand the use of XHR and how to package simple Axios
Pn8162 20W PD fast charging chip, PD fast charging charger scheme
[learning] interface test case writing and testing concerns
Some operations kept in mind by the front end foundation GitHub warehouse management
Why is the LS command stuck when there are too many files?
磁存储芯片STT-MRAM的特点
统计项目代码行数
ORA-02292: 违反完整约束条件 (MIDBJDEV2.SYS_C0020757) - 已找到子记录
Erd-online free online database modeling tool
An article will take you to understand SVG gradient knowledge
How to start the hidden preferences in coda 2 on the terminal?
Ora-02292: complete constraint violation (midbjdev2.sys_ C0020757) - subrecord found
Flink's datasource Trilogy: direct API
All the way, I was forced to talk about C code debugging skills and remote debugging
实用工具类函数(持续更新)
Bitcoin once exceeded 14000 US dollars and is about to face the test of the US election
What kind of music do you need to make for a complete game?
2020-08-15:什么情况下数据任务需要优化?