当前位置:网站首页>spin lock和mutex使用场景的差异
spin lock和mutex使用场景的差异
2022-07-30 10:38:00 【a Explorer】
在单核CPU下,spin lock没有意义,只会影响正常线程响应;使用mutex虽然会在“挂起”和“运行”两个队列间切换,但提高了系统整体的响应比。
多核CPU下,spin lock在多个和核心上的轮询时间是可以忽略的,使用spin lock避免了因为队列切换导致的时间消耗。
现代操作系统的做法,多核的环境中,在实现mutex时,如果lock操作后,进行断在的轮询(spin lock),超过这段时间后,使用传统的mutex阻塞(加入挂起队列)。如果程序可预测的中阻塞的时间较短,可以主动使用spin lock。
边栏推荐
- In the robot industry professionals, Mr Robot industry current situation?
- wsl操作
- JCL learning
- Drools 规则引擎一文读懂
- Beyond Stream Processing !第四届实时计算 Flink 挑战赛启动,49 万奖金等你来拿!
- Re20:读论文的先例:普通法的信息理论分析
- 神经网络学习笔记4——自动编码器(含稀疏,堆叠)(更新中)
- log4j中appender的简介说明
- Nacos configuration in the project of battle
- Understanding of deadlock
猜你喜欢

【C和指针第七章】可变参数列表

STM32CubeMX configuration to generate FreeRTOS project

MFCC to audio, the effect should not be too funny >V

现在报PMP还来得及参加9月的考试吗?分享敏捷全真模拟题

阿里云OSS对象存储

208. 实现 Trie (前缀树)

还在用Swagger?我推荐这款零代码侵入的接口管理神器

360 released a future-oriented EDR to protect the security of government and enterprise user terminals in an all-round way

ABP学习资源整理

log4js入门
随机推荐
Log4j additivity属性简介说明
第3章 信息收集
Meikle Studio - see the actual combat notes of Hongmeng device development 4 - kernel development
AIX shell获取前几个月时间
PanGu-Coder: 函数级的代码生成模型
MySQL installation tutorial [installation version]
vscode中写markdown格式笔记的配置过程和相关语法
WebAPI 复习
[Deep Learning] (Problem Record)
- Linear Regression - Small Batch Stochastic Gradient Descent MFCC to audio, the effect should not be too funny >V
Still using Swagger?I recommend this interface management artifact with zero code intrusion
AB test summary
【HMS core】【FAQ】HMS Toolkit典型问题合集1
JSP 语法简介说明
Scrapy爬虫之网站图片爬取
mysql与redis 区别
Re17: Read the paper Challenges for Information Extraction from Dialogue in Criminal Law
【AGC】增长服务2-应用内消息示例
加密和安全
定制.NET 6.0的依赖注入