当前位置:网站首页>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-08-17:详细说下数据倾斜怎么解决?
- An article taught you to use HTML5 SVG tags
- Utility class functions (continuous update)
- Zero basis to build a web search engine of its own
- 实验一
- To solve the problem that the data interface is not updated after WPF binding set
- 2020-09-09:裸写算法:两个线程轮流打印数字1-100。
- What kind of music do you need to make for a complete game?
- What the hell is fastthreadlocal? The existence of ThreadLocal!!
- File download manager realized by electron
猜你喜欢
ES6 learning notes (4): easy to understand the new grammar of ES6
How much disk space does a new empty file take?
Exclusive interview with Alibaba cloud database for 2020 PostgreSQL Asia Conference: Zeng Wenjing
A small goal in 2019 to become a blog expert of CSDN
Summary of front-end performance optimization that every front-end engineer should understand:
Markdown tricks
list转换map(根据key来拆分list,相同key的value为一个list)
The method of local search port number occupation in Windows system
The Interpreter pattern of behavior pattern
How to start the hidden preferences in coda 2 on the terminal?
随机推荐
实验一
Small program introduction to proficient (2): understand the four important files of small program development
How does filecoin's economic model and future value support the price of fil currency breaking through thousands
The role of theme music in games
To solve the problem that the data interface is not updated after WPF binding set
Js数组-数组的用法全在这里(数组方法的重构、数组的遍历、数组的去重,数组的判断与转换)
ado.net and asp.net The relationship between
2020-08-30:裸写算法:二叉树两个节点的最近公共祖先。
Introduction to Huawei cloud micro certification examination
2020-08-19:TCP是通过什么机制保障可靠性的?
[self taught unity2d legendary game development] map editor
Exclusive interview of guests at | 2020 PostgreSQL Asia Conference: Wang Tao
递归、回溯算法常用数学基础公式
To teach you to easily understand the basic usage of Vue codemirror: mainly to achieve code editing, verification prompt, code formatting
2020-08-14:数据任务的执行引擎用的哪些?
Count the number of project code lines
Flink's datasource Trilogy: direct API
细数软件工程----各阶段必不可少的那些图
File download manager realized by electron
image operating system windows cannot be used on this platform