当前位置:网站首页>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。
边栏推荐
- Is it too late to apply for PMP now to take the September exam?Share agile full-true mock questions
- Security Thought Project Summary
- spark udf accepts and handles null values.
- OC-关于alloc和dealloc(还没开始写)
- js对数组操作移动进行封装
- PyQt5 - Drawing different types of straight lines
- paging
- MySQL installation tutorial [installation version]
- [100 Solidity Skills] 1. Contract reentrancy attack
- STM32CubeMX configuration to generate FreeRTOS project
猜你喜欢

Classes and Objects - 6 Default Member Functions

Matplotlib--plot markers

优酷VIP会员周卡只需7.5元,看《沉香如屑》用优酷视频

Security Thought Project Summary

In the robot industry professionals, Mr Robot industry current situation?

360闷声干大事获赞无数,数字安全如何保障?还得看企业安全云

Neural Network Study Notes 4 - Autoencoder (including sparse, stacked) (updated)

hcip06 ospf special area comprehensive experiment

PyQt5 - draw sine curve with pixels

鸿湖万联扬帆富设备开发板正式合入OpenHarmony主干
随机推荐
张量篇-初步
mysql分页查询倒序_【Mysql笔记】MySQL实现分页查询[通俗易懂]
360 released a future-oriented EDR to protect the security of government and enterprise user terminals in an all-round way
WARN: Establishing SSL connection without server's identity verification is not recommended when connecting to mysql
湖仓一体电商项目(一):项目背景和架构介绍
【HMS core】【Analytics Kit】【FAQ】如何解决华为分析付费分析中付款金额显示为0的问题?
idea2021+Activiti [the most complete note one (basic use)]
spark udf accepts and handles null values.
【C和指针第七章】可变参数列表
OC - Manual Reference Counting Memory Management
Drag and drop events, dataTransfer, getBoundingClientRect
XYplorer 23多语言,最好的管理软件之一
oracle 导出dmp文件类型为“故障转储文件”
jmeter接口压力测试-(二)
In the robot industry professionals, Mr Robot industry current situation?
4. yolov5-6.0 ERROR: AttributeError: 'Upsample' object has no attribute 'recompute_scale_factor' solution
[AGC] Growth Service 2 - In-App Message Example
Verilog之数码管译码
Still using Swagger?I recommend this interface management artifact with zero code intrusion
OC-ARC (Automatic Reference Counting) automatic reference counting