当前位置:网站首页>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]所创,转载请带上原文链接,感谢
边栏推荐
- 2020-09-03:裸写算法:回形矩阵遍历。
- 意外的元素..所需元素..
- The isolation level of transaction and its problems
- An article takes you to understand CSS3 picture border
- To solve the problem that the data interface is not updated after WPF binding set
- What grammar is it? ]
- How much disk space does a file of 1 byte actually occupy
- 2020-09-09:裸写算法:两个线程轮流打印数字1-100。
- Summary of front-end interview questions (C, s, s) that front-end engineers need to understand (2)
- Call analysis of start method in JNI thread and callback analysis of run method
猜你喜欢

image operating system windows cannot be used on this platform

JVM memory allocation - xms128m - xmx512m - XX: permsize = 128M - XX: maxpermsize = 512M

Summary of common SQL statements

Using an example to understand the underlying processing mechanism of JS function

#JVM 类加载机制

Points to be considered when deleting mapping field of index in ES

Windows 10 蓝牙管理页面'添加蓝牙或其他设备'选项点击无响应的解决方案
![[forward] how to view UserData in Lua](/img/3b/00bc81122d330c9d59909994e61027.jpg)
[forward] how to view UserData in Lua

Unexpected element.. required element

What is the tensor in tensorflow?
随机推荐
Basic usage of Vue codemirror: search function, code folding function, get editor value and verify in time
Countdown | 2020 PostgreSQL Asia Conference - agenda arrangement of Chinese sub Forum
Markdown tricks
Novice guidance and event management system in game development
How about small and medium-sized enterprises choose shared office?
ado.net and asp.net The relationship between
2020-08-18:介绍下MR过程?
GitHub: the foundation of the front end
git远程库回退指定版本
The 4th China BIM (digital construction) manager Summit Forum will be held in Hangzhou in 2020
Common syntax corresponding table of mongodb and SQL
With this artifact, quickly say goodbye to spam messages
Flink's datasource Trilogy: direct API
The method of local search port number occupation in Windows system
Why is quicksort so fast?
Es create a new index database and copy the old index library, practice pro test effective!
【涂鸦物联网足迹】物联网基础介绍篇
Application insights application insights use application maps to build request link views
An article will take you to understand CSS3 fillet knowledge
An article taught you to use HTML5 SVG tags