当前位置:网站首页>并发,并行,异步,同步,多线程,互斥的概念
并发,并行,异步,同步,多线程,互斥的概念
2022-06-27 09:58:00 【沉默小管】
并发:同一时间段有几个程序都处于已经启动到运行完毕之间,并且这几个程序都在同一个处理机上运行,并发的两种关系是同步和互斥;
互斥:进程之间访问临界资源时相互排斥的现象;
同步:进程之间存在依赖关系,一个进程结束的输出作为另一个进程的输入。具有同步关系的一组并发进程之间发送的信息称为消息或者事件;
并行:单处理器中进程被交替执行,表现出一种并发的外部特征;在多处理器中,进程可以交替执行,还能重叠执行,实现并行处理,并行就是同事发生的多个并发事件,具有并发的含义,但并发不一定是并行,也就是说事件之间不一定要同一时刻发生;
多线程:多线程是进程中并发运行的一段代码,能够实现线程之间的切换执行;
异步:和同步相对,同步是顺序执行,而异步是彼此独立,在等待某个事件的过程中继续做自己的事,不要等待这一事件完成后再工作。线程是实现异步的一个方式,异步是让调用方法的主线程不需要同步等待另一个线程的完成,从而让主线程干其他事情。
异步和多线程:不是同等关系,异步是目的,多线程只是实现异步的一个手段,实现异步可以采用多线程技术或者交给其他进程来处理
边栏推荐
- Your brain is learning automatically when you sleep! Here comes the first human experimental evidence: accelerate playback 1-4 times, and the effect of deep sleep stage is the best
- 前馈-反馈控制系统设计(过程控制课程设计matlab/simulink)
- 用户认证技术
- Quartz(定时器)
- leetcode:522. Longest special sequence II [greed + subsequence judgment]
- C language learning day_ 04
- Xiaobai can also understand how the basic network 03 | OSI model works (classic push)
- R语言plotly可视化:可视化多个数据集归一化直方图(historgram)并在直方图中添加密度曲线kde、设置不同的直方图使用不同的分箱大小(bin size)、在直方图的底部边缘添加边缘轴须图
- 手把手带你玩摄像头模组
- C語言學習-Day_04
猜你喜欢

Installation and use of SVN version controller

导师邀请你继续跟他读博,你会不会立马答应?

Record in detail the implementation of yolact instance segmentation ncnn

Bluetooth health management device based on stm32

视频文件太大?使用FFmpeg来无损压缩它

C# Any()和AII()方法

Installation and usage of source insight tool

如何获取GC(垃圾回收器)的STW(暂停)时间?

反编译jar包,修改后重新编译为jar包

prometheus告警流程及相关时间参数说明
随机推荐
Quartz (timer)
基于STM32设计的蓝牙健康管理设备
torch. utils. data. Randomsampler and torch utils. data. Differences between sequentialsampler
The R language uses the preprocess function of the caret package for data preprocessing: Center all data columns (subtract the average value from each data column), and set the method parameter to cen
[system design] proximity service
leetcode:968. 监控二叉树【树状dp,维护每个节点子树的三个状态,非常难想权当学习,类比打家劫舍3】
多线程实现 重写run(),怎么注入使用mapper文件操作数据库
LVI Sam summary
C apprentissage des langues - jour 12.
Use aspese Cells convert Excel to PDF
详细记录YOLACT实例分割ncnn实现
JS array splicing "suggested collection"
Une compréhension facile de la simplicité de la classification bayésienne du lissage laplacien
leetcode:522. 最长特殊序列 II【贪心 + 子序列判断】
借助原子变量,使用CAS完成并发操作
C语言学习-Day_06
Location and solution of network connection failure of primary online mobile terminal Report
一次线上移动端报表网络连接失败问题定位与解决
巴基斯坦安全部队开展反恐行动 打死7名恐怖分子
使用Aspose.cells将Excel转成PDF