linux 消息队列使用1
来源:互联网 发布:python ..日期时间 编辑:程序博客网 时间:2024/05/23 20:41
本来以为使用多线程处理队列就可以了,但是带我的人说这样做意义不大,最好是写个进程来处理队列,这样就要用到了进程间通信,这边我们使用的是linux的消息队列。
使用linux消息队列有很多限制,比如每个队列中的消息数量,每个消息的大小,以及系统中的队列的个数。这边来小结下这些参数的设置。
msg_max:max number of messages in the queue(0-32768)
msgsize_max:max byte size of a message in the queue(0-INT_MAX)
queue_max:max number of queue in the system(0-INT_MAX)
we can change the paramters directly in the /pro/sys/fs/mqueue/.
e.g. echo "100" > /proc/sys/fs/mqueue/msg_max
we also can change these parameters in the /etc/sysctl.conf
Add these lines in the /etc/sysctl.conf
****************************************************
fs.mqueue.msg_max=100#max number of message in the queue
fs.mqueue.msgsize_max=8192#max size of message in the queue
fs.mqueue.queues_max = 100;#max number of queue in the system
*******************************************************
we aslo need change the default max size of memory used in the mqueue
we should add the following line in the /etc/security/limits.conf
#(user) (type) (item) (value)
#**************************************************
* - msgqueue unlimited
#**************************************************
we can use sysctl -p to make the change in the sysctl.conf take
effect
we can use ulimit -q to check the value of max memory size of mqueue
in the system
After reboot these parameters are still available
If we set the attribute of the mqueue in the code which exceeds the ceiling of these parameters set in the sysctl.conf or /proc/sys/fs/mqueue,mqueue can not be created and error code will be set in the errno.
- linux 消息队列使用1
- linux 消息队列使用
- linux 使用消息队列
- linux下消息队列使用
- linux 消息队列使用经验
- Linux消息队列的使用
- linux 共享内存消息队列使用
- linux c 消息队列的使用
- 关于linux中消息队列的使用
- Linux下的消息队列的使用
- 【Linux】Linux进程间通信——使用消息队列
- Linux消息队列编程
- linux消息队列
- linux消息队列操作
- linux IPC-消息队列
- linux消息队列函数
- Linux消息队列操作
- linux 消息队列
- Hibernate学习手记(4)--自定义查询
- 理解 通过ApplicationDomain类获得被加载应用程序域
- 【其他】【RQNOJ】生化危机
- 使用VC创建Office 应用程序自动化项目
- ModelSim 6.5 安装
- linux 消息队列使用1
- 系统钩子函数问题 SetWindowsHookEx 不能运行的问题
- 手动建立mingw+opengl开发环境
- select, poll和epoll的区别
- Linux中errno使用
- 《BREW进阶与精通——3G移动增值业务的运营、定制与开发》连载之61-BREW 开发商的注册
- WINAPI和CALLBACK这两个宏有什么区别呢?
- 在一个MFC工程中调用Word ActiveX自动化
- 测试