当前位置:网站首页>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 .
边栏推荐
- The flutter slivereappbar is fully parsed. All the effects you want are here!
- Meituan dynamic thread pool practice idea has been open source
- . Mp4 video test address
- 数据人面试指南 | 准备好这几点做到有备无患!
- What is the application scope and function of the conductive slip ring of single crystal furnace
- 模块化开发
- Overview of drug discovery-01 overview of drug discovery
- Ai+ clinical trial patient recruitment | massive bio completed round a financing of $9million
- 【牛客討論區】第四章:Redis
- How to build an e-commerce platform at low cost
猜你喜欢

零基礎多圖詳解圖神經網絡
![The number of nodes of a complete binary tree [non-O (n) solution > Abstract dichotomy]](/img/56/768f8be9f70bf751f176e40cbb1df2.png)
The number of nodes of a complete binary tree [non-O (n) solution > Abstract dichotomy]

如何在您的Shopify商店中添加实时聊天功能?

数据库的新选择 Amazon Aurora

什么是数字化?什么是数字化转型?为什么企业选择数字化转型?

Taro--- day2--- compile and run

How to optimize the "message" list of IM

评价——秩和比综合评价

Cloud assisted privacy collection intersection (server assisted psi) protocol introduction: Learning

Deepmind | pre training of molecular property prediction through noise removal
随机推荐
How to build an e-commerce platform at low cost
数据库查询优化:主从读写分离及常见问题
Arrays. Aslist() pit
【MySQL】-【函数】
Lodash realizes anti shake and throttling functions and native implementation
The practice of dual process guard and keeping alive in IM instant messaging development
Download, configuration and installation of MySQL
评价——灰色关联分析
完全二叉树的节点个数[非O(n)求法 -> 抽象二分]
Chapitre 4: redis
现在网上开股票账户安全吗?选择上市券商,最快8分钟开户成功
万字长文看懂商业智能(BI)|推荐收藏
Taro--- day2--- compile and run
【嵌入式基础】内存(Cache,RAM,ROM,Flash)
美团动态线程池实践思路已开源
大尺寸导电滑环市场应用强度如何
Flutter SliverAppBar全解析,你要的效果都在这了!
为什么要选择不锈钢旋转接头
Comprehensive evaluation of free, easy-to-use and powerful open source note taking software
Is it safe to open an account for mobile stocks? Where can I open an account for buying stocks?