当前位置:网站首页>PV operation primitive
PV operation primitive
2022-06-28 01:39:00 【AdamShyly】
" Atomic manipulation (atomic operation) You don't need to synchronized", This is a cliche of multithreaded programming . Atomic operation means that it will not be Thread scheduling The mechanism interrupts the operation ; Once this operation begins , It runs until the end , There won't be any context switch [1] ( Switch to another thread ).
Atomic operations are mostly implemented in assembly language , because c Language can't do this .
Atomicity cannot be guaranteed by software alone -- Must be supported by hardware , So it's architecture related . stay x86 On the platform ,CPU Provides the ability to Means of bus locking .CPU There's a lead on the chip #HLOCK pin, If you prefix an instruction in an assembly language program "LOCK", The assembled machine code makes CPU In executing this command, put #HLOCK pin The potential of the current is lowered , Continue until the end of this command release , To lock the bus , So other things on the same bus CPU You can't access the memory through the bus for the time being , This ensures the atomicity of this instruction in a multiprocessor environment .
—— From baidu baike
And the reason why the operating system passes PV Operation to access semaphores can be used to achieve process mutually exclusive synchronization , It is also because PV Primitives are non interruptible , It's atomic manipulation . According to the introduction to atomic operation in Baidu Encyclopedia above , In single processor mode , When multiple processes access critical resources concurrently ,P Operation primitives can put the process that first executes to the primitive code in a non interruptible state , At this time, other concurrent processes cannot pass CPU Interrupt the process and preempt CPU resources , To enter block state , Wait until the process executes v After operation primitive , Wake up one of the blocked processes and resume ready state .
边栏推荐
- 怎样能低成本构建一个电商平台
- 如何在您的Shopify商店中添加实时聊天功能?
- 攻击队攻击方式复盘总结
- 独立站卖家都在用的五大电子邮件营销技巧,你知道吗?
- Squid proxy server (Web cache layer for cache acceleration)
- Web mouse click special effects case collection (red heart in live broadcast room)
- 无人机专用滑环定制要求是什么
- Official announcement! Apache Doris graduated from the Apache incubator and officially became the top project of Apache!
- Huawei partners and Developers Conference 2022 | Kirin software cooperates with Huawei to jointly build the computing industry and create a digital intelligence future
- Li Kou today's question -522 Longest special sequence
猜你喜欢

Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)

Réseau neuronal pour la solution détaillée Multi - diagrammes de fondation zéro

Chapitre 4: redis

【嵌入式基础】内存(Cache,RAM,ROM,Flash)

Adobe Premiere基础-编辑素材文件常规操作(脱机文件,替换素材,素材标签和编组,素材启用,便捷调节不透明度,项目打包)(十七)

【牛客讨论区】第四章:Redis

Download, configuration and installation of MySQL

独立站卖家都在用的五大电子邮件营销技巧,你知道吗?

What problems should be evaluated before implementing MES management system

What is a through-hole conductive slip ring?
随机推荐
自监督学习与药物发现
评价——秩和比综合评价
【说明】Jmeter乱码的解决方法
What is digitalization? What is digital transformation? Why do enterprises choose digital transformation?
Deep parsing of kubernetes controller runtime
面试官问:JS的继承
The contents of the latex table are left, middle and right
MySQL十种锁,一篇文章带你全解析
Collection de cas d'effets spéciaux en cliquant sur la souris de la page Web
FB、WhatsApp群发消息在2022年到底有多热门?
Ai+ clinical trial patient recruitment | massive bio completed round a financing of $9million
向excel中导入mysql中的数据表
Comprehensive evaluation of free, easy-to-use and powerful open source note taking software
Réseau neuronal pour la solution détaillée Multi - diagrammes de fondation zéro
SQL Server 2016 detailed installation tutorial (with registration code and resources)
【嵌入式基础】内存(Cache,RAM,ROM,Flash)
手机股票开户安全吗,买股票在哪开户?
Huawei partners and Developers Conference 2022 | Kirin software cooperates with Huawei to jointly build the computing industry and create a digital intelligence future
Qu'est - ce que la numérisation? Qu'est - ce que la transformation numérique? Pourquoi les entreprises choisissent - elles la transformation numérique?
. Mp4 video test address