当前位置:网站首页>Mode of interprocess communication
Mode of interprocess communication
2022-04-23 18:03:00 【OceanKeeper1215】
The ways of inter process communication are :
One 、 The Conduit
The Conduit , Usually refers to the unnamed pipe , yes UNIX System IPC The oldest form .
characteristic :
It's half duplex ( That is, data can only flow in one direction ), It has fixed read end and write end .
It can only be used for communication between related processes ( It's also between parent-child processes or sibling processes ).
It can be seen as a special document , For its reading and writing, you can also use ordinary read、write Such as function . But it's not a normal document , It doesn't belong to any other file system , And it only exists in memory .
Two 、FIFO
FIFO, Also called named pipe , It's a file type .
1、 characteristic
FIFO Data can be exchanged between unrelated processes , It's different from anonymous pipes .
FIFO There is a pathname associated with it , It exists in the file system as a special device file .
3、 ... and 、 Message queue
Message queue , It's a linked list of messages , Stored in the kernel . A message queue consists of an identifier ( That's the queue ID) To mark .
characteristic
Message queuing is record oriented , The message has a specific format and a specific priority .
Message queuing is independent of the sending and receiving processes . When the process terminates , Message queues and their contents are not deleted .
Message queue can realize random query of messages , Messages don't have to be read in first in first out order , It can also be read by the type of message .
Four 、 Semaphore
Semaphore (semaphore) With what has been introduced IPC Different structure , It's a counter . Semaphores are used to achieve mutual exclusion and synchronization between processes , Instead of storing interprocess communication data .
characteristic
Semaphores are used for inter process synchronization , To transfer data between processes, you need to combine shared memory .
Semaphores are based on the PV operation , The operation of the program on semaphores is atomic operation .
Every time the semaphore is PV The operation is not limited to adding... To the semaphore value 1 Or minus 1, And you can add and subtract any positive integer .
Support semaphore group .
5、 ... and 、 Shared memory
Shared memory (Shared Memory), Refers to two or more processes sharing a given store .
characteristic
Shared memory is the fastest IPC, Because processes access memory directly .
Because multiple processes can operate at the same time , So you need to synchronize .
Semaphore + Shared memory is usually used in combination , Semaphores are used to synchronize access to shared memory .
版权声明
本文为[OceanKeeper1215]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230545105007.html
边栏推荐
- 极致体验,揭晓抖音背后的音视频技术
- Reptile efficiency improvement method
- Go file operation
- Examination question bank and online simulation examination of the third batch (main person in charge) of special operation certificate of safety officer a certificate in Guangdong Province in 2022
- Tell the truth of TS
- [UDS unified diagnostic service] v. diagnostic application example: Flash bootloader
- 2022 Jiangxi Photovoltaic Exhibition, China distributed Photovoltaic Exhibition, Nanchang solar energy utilization Exhibition
- Go的Gin框架学习
- How to read literature
- [UDS unified diagnostic service] IV. typical diagnostic service (4) - online programming function unit (0x34-0x38)
猜你喜欢
Theory and practice of laser slam in dark blue College - Chapter 2 (odometer calibration)
C# 的数据流加密与解密
k8s之实现redis一主多从动态扩缩容
2022 Shanghai safety officer C certificate operation certificate examination question bank and simulation examination
Calculation of fishing net road density
Batch export ArcGIS attribute table
re正则表达式
2022 Jiangxi energy storage technology exhibition, China Battery exhibition, power battery exhibition and fuel cell Exhibition
Nat Commun|在生物科学领域应用深度学习的当前进展和开放挑战
Auto.js 自定义对话框
随机推荐
C1 notes [task training part 2]
Excel opens large CSV format data
Flash - Middleware
Operators in C language
Format problems encountered in word typesetting
Gaode map search, drag and drop query address
Realsense selection comparison d455 d435i d415 t265 3D hardware comparison
Implementation of image recognition code based on VGg convolutional neural network
Detailed deployment of flask project
Summary of floating point double precision, single precision and half precision knowledge
2022 tea artist (primary) examination simulated 100 questions and simulated examination
Utilisation de la liste - Ajouter, supprimer et modifier la requête
cartographer_ There is no problem compiling node, but running the bug that hangs directly
Click Cancel to return to the previous page and modify the parameter value of the previous page, let pages = getcurrentpages() let prevpage = pages [pages. Length - 2] / / the data of the previous pag
Vite configure proxy proxy to solve cross domain
Use of list - addition, deletion, modification and query
journal
Transfer learning of five categories of pictures based on VGg
re正則錶達式
mysql自动启动设置用Systemctl start mysqld启动