当前位置:网站首页>What is the difference between concurrency and parallelism?
What is the difference between concurrency and parallelism?
2022-07-27 23:36:00 【Hua Weiyun】
What's the difference between concurrency and parallelism ?
Concurrency is in a period of time , Multiple tasks will be processed ; But at some point , There is only one task in progress . A single core processor can achieve concurrency . For example, there are two processes A and B,A After running a time slice , Switch to B,B After running a time slice, switch to A. Because the switching speed is fast enough , So the macro performance is that it can run multiple programs at the same time in a period of time .
Parallel is at the same time , There are multiple tasks in progress . This requires a multi-core processor to complete , At the micro level, multiple instructions can be executed at the same time , Different programs are run on different processors , It's a physical process that's going on at the same time .
What's the difference between a big kernel and a microkernel ?
Big kernel , It is to put all the functions of the operating system into the kernel , Including scheduling 、 file system 、 The Internet 、 Device driver 、 Storage management and so on , Form a tightly connected whole . The advantage of a large kernel is high efficiency , But it's hard to locate bug, Poor expansibility , Every time you need to add new features , You have to recompile the new code and the original kernel code .
Microkernels are different from monolithic kernels , Microkernel just adds the core function of operation to the kernel , Include IPC、 Address space allocation and basic scheduling , These things are all running in kernel mode , Other functions are called by the kernel as modules , And it's running in user space . Microkernel is easier to maintain and expand , But efficiency may not be high , Because you need to switch between kernel mode and user mode frequently .
What's the difference between a time-sharing system and a real-time system ?
Time sharing system (Sharing time system) It's the system that puts CPU Time is divided into very short time slices , Assign to multiple assignments in turn . Its advantage is that it can guarantee fast enough response time for multiple jobs of multiple users , And effectively improve the utilization of resources .
Real time systems (Real-time system) It's information that the system inputs from the outside , Be able to ( deadline ) Deal with it and react . It has the advantage of being able to process and respond in a centralized and timely manner , high reliability , Security .
Usually computers use time sharing , It's multiple processes / Sharing between users CPU, Realize multi task from the situation . Individual users / Scheduling between processes is not particularly accurate , If a process is locked , You can give it more time . The real-time operating system is different , Software and hardware must comply with strict time limits , Processes that exceed the time limit may be terminated directly . In such an operating system , Every time you lock, you need to think about it carefully .
What's the difference between static linking and dynamic linking ?
Static linking is during compilation , Static libraries are integrated into applications by compilers and connectors , And make it into target files and executable files that can operate independently . A static library is a collection of external functions and variables .
Static libraries are very convenient , But if we just want to use a function in the library , And still have to link everything in . A more modern approach is to use shared libraries , Avoid a lot of duplication of static libraries in files .
Dynamic links can be executed on the first load , It can also be done at the beginning of the program . This is done by the dynamic linker , Like standard C library (libc.so) It's usually dynamically linked , So all programs can share the same library , It doesn't have to be packaged separately .
What are the stages of compilation ?
Pretreatment stage : Deal with # The preprocessing command at the beginning ;
Compile phase : Translate into assembly file ;
Assembly stage : Translate assembly files into relocatable target files ;
Link phase : The target file and... Will be relocatable printf.o Wait for separate precompiled target files to merge , Get the final executable target file .
What are the states of the process ?
In the five state model , There is a total of 5 Medium state , They are to create 、 be ready 、 function 、 End 、 Blocking .
The running state is that the process is CPU Up operation . In a single processor environment , At most one process is running at any one time .
Ready state means that the process is ready to run , That is, the process obtains the division of CPU All the resources you need , Once you get it CPU You can run .
A blocking state is when a process is waiting for an event to stop running , For example, waiting for a resource to be available or waiting for I/O complete . Even if CPU Free , The process can't run either .
Running state → Blocking state : It's often due to waiting for peripherals , Waiting for the allocation of resources such as main memory or waiting for manual intervention .
Blocking state → The ready state : The condition of waiting has been met , Just assign it to the processor and run .
Running state → The ready state : It's not for your own reasons , Instead, the process in running state gives up the processor for external reasons , Now it's ready . For example, the time slice runs out , Or a higher priority process to preempt the processor .
The ready state → Running state : The system selects a process in the ready queue to occupy the processor according to a certain policy , At this point, it becomes the running state .
边栏推荐
- Disable caching with meta HTML tags in all browsers
- [signal processing] weak signal detection in communication system based on the characteristics of high-order statistics with matlab code
- Pentium fast system call learning
- Nature综述:微生物群落形成过程中的优先效应
- 【JS 逆向百例】某公共资源交易网,公告 URL 参数逆向分析
- ZCMU--1720: 死亡如风,我要装逼
- C#委托用法--控制台项目,通过委托实现事件
- 进制转换方法
- 三次握手的Socket交互流程
- 数据中台的那些“经验与陷阱”
猜你喜欢

【GNN报告】加拿大蒙特利尔唐建:Geometric Deep Learning For Drug Discovery

真的很难理解?RecyclerView 缓存机制到底是几级缓存?

迪赛智慧数——其他图表(平行坐标图):家庭未来资产配置意愿

2022夏暑假每日一题(五)

强化学习——PyTorch 实现 Advantage Actor-Critic (A2C)

他山之石 | 蚂蚁超大规模知识图谱构建及应用

远程调试 idea配置remote debug、在远程服务器的程序中,添加JVM启动参数-Xdebug

Excel VBA finds out the maximum and minimum values of a column of time, and repeatedly pastes multiple values according to the actual situation

WWW 2019 | HAN:异质图注意力网络

Huawei Hongmeng 3 was officially released, and this security feature has solved a major pain point
随机推荐
苹果发布新款iPhone SE:搭载A13仿生处理器,售价3299元起
四次挥手的Socket交互流程
QT with OpenGL(Shadow Mapping)(平行光篇)
Interviewer: let's talk about the specific process of network data transmission
2019年全球十大半导体厂商:英特尔重回第一,苹果逆势大涨
Simple and practical data visualization cases
Common Taylor expansion
Blender plug-in of 2022
How to quickly view the API properties and usage of the h.265 video player easyplayer?
Security-001
常用泰勒展开
怎么使用xshell免费版
How to use xshell Free Edition
华为鸿蒙 3 正式发布,这个安全功能解决了一大痛点
Figure basic knowledge code
My annual salary is 1million, and I don't have clothes more than 100 yuan all over my body: saving money is the top self-discipline
Winform怎么使用FTP实现自动更新
Blood spitting finishing nanny level series tutorial - playing Fiddler bag capturing tutorial (5) - detailed explanation of fiddler monitoring panel
ZCMU--1720: 死亡如风,我要装逼
Www 2019 | Han: heterograph attention network