当前位置:网站首页>Multiprocess programming (V): semaphores
Multiprocess programming (V): semaphores
2022-07-03 00:22:00 【HDD615】
Reference link : Semaphore
The difference of communication mode between processes
1、 First of all, the simplest is the pipe , Pipelines are divided into anonymous pipelines and famous pipelines
Anonymous pipes can only be used for interprocess communication with kinship , One way transmission ; If you want two-way communication , We need to set up two pipelines ; Hide Name pipeline is a special kind of file , There are buffers in the kernel , The transmission data is unformatted byte stream data , Size is limited .
And famous pipeline , By creating files in the file system , It solves the problem that anonymous pipes can only be used for the communication of processes with kinship problem , Thus, unrelated processes can also communicate .
2、 Message queue , It is actually a message linked list in the kernel , It overcomes the problem that the pipeline communication data is an unformatted byte stream . But the communication speed of message queue is not timely , Because every time data is written and read, it must be copied in user mode and kernel mode
3、 Shared memory , By allocating a shared memory space directly in memory , Solved the problem of data copy , Multiple processes can Through the address To directly access this shared memory space , However, data disorder may occur when multiple processes compete at the same time
Shared memory is the most efficient way
4、 Semaphore , It is a means of process synchronization , It can be used to protect shared resources , Ensure that only one process is accessing shared resources at any one time .
Usually used with shared memory , That is, after obtaining the lock , Then operate on the shared memory ( Write / read )
边栏推荐
- 来自数砖大佬的 130页 PPT 深入介绍 Apache Spark 3.2 & 3.3 新功能
- LeedCode1480.一维数组的动态和
- Go custom sort
- RTP 接发ps流工具改进(二)
- Returns the size of the largest binary search subtree in a binary tree
- Additional: token; (don't read until you finish writing...)
- Is there a specific format for English papers?
- 洛谷_P1149 [NOIP2008 提高组] 火柴棒等式_枚举打表
- 国外的论文在那找?
- 秒杀系统设计
猜你喜欢
Feature Engineering: summary of common feature transformation methods
Chapter 3 of getting started with MySQL: database creation and operation
開源了 | 文心大模型ERNIE-Tiny輕量化技術,又准又快,效果全開
QT 如何将数据导出成PDF文件(QPdfWriter 使用指南)
130 pages of PPT from the brick boss introduces the new features of Apache spark 3.2 & 3.3 in depth
Should you study kubernetes?
Which websites can I search for references when writing a thesis?
67 page overall planning and construction plan for a new smart city (download attached)
What are the recommended thesis translation software?
【单片机项目实训】八路抢答器
随机推荐
Realization of mask recognition based on OpenCV
Andorid 获取系统标题栏高度
Which websites can I search for references when writing a thesis?
Slf4j + logback logging framework
直击产业落地!飞桨重磅推出业界首个模型选型工具
来自数砖大佬的 130页 PPT 深入介绍 Apache Spark 3.2 & 3.3 新功能
Luogu_ P2010 [noip2016 popularization group] reply date_ Half enumeration
Bigder: how to deal with the bugs found in the 32/100 test if they are not bugs
[shutter] open the third-party shutter project
大学生课堂作业2000~3000字的小论文,标准格式是什么?
洛谷_P2010 [NOIP2016 普及组] 回文日期_折半枚举
写论文可以去哪些网站搜索参考文献?
[Chongqing Guangdong education] audio visual language reference materials of Xinyang Normal University
Feature Engineering: summary of common feature transformation methods
Chinatelecom has maintained a strong momentum in the mobile phone user market, but China Mobile has opened a new track
MFC gets the current time
NC24840 [USACO 2009 Mar S]Look Up
Is the multitasking loss in pytoch added up or backward separately?
Bloom filter
LeedCode1480.一维数组的动态和