当前位置:网站首页>2020-08-29:进程线程的区别,除了包含关系之外的一些区别,底层详细信息?
2020-08-29:进程线程的区别,除了包含关系之外的一些区别,底层详细信息?
2020-11-06 21:50:00 【福大大架构师每日一题】
福哥答案2020-08-29:
1.根本区别
进程:资源调度最小单位。
线程:CPU调度最小单位。
2.地址空间
进程:进程有自己独立的地址空间,每启动一个进程,系统都会为其分配地址空间,建立数据表来维护代码段、堆栈段和数据段。
线程:线程没有独立的地址空间,同一进程的线程共享本进程的地址空间。
3.内存和files共享
进程:当创建一个进程的时候,mm_struct会指向另外一块地址,使用copy-on-write进行复制。
线程:而创建一个线程的时候,mm_struct会指向父进程的同一块虚拟内存区域,所以会有资源冲突问题。
不论线程和进程,在linux中的创建都是很快速的。
4.块
进程:进程控制块PCB。一个进程用ProcessControlBlock上的一个entry记录其基本信息(pid,state,priority等),进程会被操作系统分配一个内存逻辑地址空间,即其拥有一段内存空间供使用。
线程:线程控制块TCB。线程是进程内负责执行一项任务的单元,这个单元用ThreadControlBlock上的一个entry记录其基本信息(tid,state,priority,counter,register info等),这个单元有着自己的stack来用于任务执行。
5.系统开销
进程:进程执行开销大。
线程:线程执行开销小。
6.切换速度
进程:切换相对慢。
线程:切换相对快。
版权声明
本文为[福大大架构师每日一题]所创,转载请带上原文链接,感谢
https://my.oschina.net/u/4553401/blog/4536632
边栏推荐
- Even liver three all night, jvm77 high frequency interview questions detailed analysis, this?
- How to turn data into assets? Attracting data scientists
- GitHub: the foundation of the front end
- Filecoin has completed a major upgrade and achieved four major project progress!
- 【自学unity2d传奇游戏开发】如何让角色动起来
- This project allows you to quickly learn about a programming language in a few minutes
- What are the criteria for selecting a cluster server?
- Analysis of serilog source code -- how to use it
- Helping financial technology innovation and development, atfx is at the forefront of the industry
- The method of realizing high SLO on large scale kubernetes cluster
猜你喜欢
ES6 learning notes (5): easy to understand ES6's built-in extension objects
Look! Internet, e-commerce offline big data analysis best practice! (Internet disk link attached)
ERD-ONLINE 免费在线数据库建模工具
小游戏云开发入门
Gather in Beijing! The countdown to openi 2020
谷歌浏览器实现视频播放加速功能
Staying up late summarizes the key points of report automation, data visualization and mining, which is different from what you think
Ronglian completed US $125 million f round financing
【:: 是什么语法?】
What knowledge do Python automated testing learn?
随机推荐
2020年第四届中国 BIM (数字建造)经理高峰论坛即将在杭举办
An article taught you to download cool dog music using Python web crawler
With this artifact, quickly say goodbye to spam messages
An article will take you to understand CSS3 fillet knowledge
mongo 用户权限 登录指令
Xmppmini project details: step by step from the principle of practical XMPP technology development 4. String decoding secrets and message package
【自学unity2d传奇游戏开发】地图编辑器
Elasticsearch Part 6: aggregate statistical query
实用工具类函数(持续更新)
一路踩坑,被迫聊聊 C# 代码调试技巧和远程调试
To teach you to easily understand the basic usage of Vue codemirror: mainly to achieve code editing, verification prompt, code formatting
MongoDB与SQL常用语法对应表
Bitcoin once exceeded 14000 US dollars and is about to face the test of the US election
检测证书过期脚本
How to hide part of barcode text in barcode generation software
An article will take you to understand CSS alignment
【應用程式見解 Application Insights】Application Insights 使用 Application Maps 構建請求鏈路檢視
Summary of front-end interview questions (C, s, s) that front-end engineers need to understand (2)
JVM内存分配 -Xms128m -Xmx512m -XX:PermSize=128m -XX:MaxPermSize=512m
嘉宾专访|2020 PostgreSQL亚洲大会阿里云数据库专场:曾文旌