问题描述
我了解有关消息队列操作,例如msgget(),msgsnd()和msgrcv()的信息.但是,当我在堆栈溢出时搜索与消息队列相关的问题时,我才知道还有另一组消息队列操作,例如mq_open(),mq_send()和mq_receive().谁能让我知道这两种类型的消息队列之间有什么区别,以及广泛使用的是哪种类型的消息队列?
I Read about message queue operations such as msgget(), msgsnd() and msgrcv(). But when I was searching for message queue related questions on stack overflow, I came to know there is another set of message queue operations such as mq_open(), mq_send(), mq_receive(). Can any one please let me know what are the differences between these 2 types of message queues and which type of message queues are extensively being used?
推荐答案
基本上,msgget
,msgsnd
,msgrcv
是System V IPC,而mq_open
,mq_send
,mq_receive
是POSIX IPC
Basicly, msgget
, msgsnd
, msgrcv
are System V IPC, while mq_open
, mq_send
, mq_receive
are POSIX IPC.
一个很好的解释:系统V IPC与POSIX IPC
总而言之,POSIX IPC是在System V IPC之后设计的.因此,许多旧系统仅支持System V IPC,而新系统也开始支持POSIX IPC.并且,由于POSIX IPC可以从System V IPC中学习优点和缺点,因此可以更好地设计和实现POSIX IPC.一个显着的区别是所有POSIX IPC接口都是线程安全的.
In summary, POSIX IPC is designed after System V IPC. So a lot of old systems support only System V IPC while new systems begin to support POSIX IPC as well. And, because POSIX IPC can learn the advantages and disadvantages from System V IPC, POSIX IPC may be designed and implemented better. A notable difference is that all the POSIX IPC interfaces are thread safe.
这篇关于msgget()和mq_open之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!