Linux共享内存进程间通信

2009-08-09 20:12 / no comment / 79 views /

shared-memory.tar.gz

这是我写的共享内存通信的程序,用了两个信号量,可以保证信息一条一条的发。

用下面两条命令编译和运行:

make -f makefile
./create_shm

这是我运行的结果:

jan@Jan:~$ make -f makefile
rm create_shm opr_shm print_shm
gcc create_shm.c -o create_shm
gcc opr_shm.c -o opr_shm
gcc print_shm.c -o print_shm
jan@Jan:~$ ./create_shm

create_shm:seccessfully created segment : 5341209

opr_shm:Segment attached at 0xb804f000

print_shm:segment attached at 0xb7ef1000

print:1 message send to print_shm

print:2 message send to print_shm

print:3 message send to print_shm

opr_shm:Segment detached

print:4 message send to print_shm

print_shm:Segment detached

jan@Jan:~$

Related Posts

  1. Linux下Socket通信、共享内存和信号量混合使用的例子
  2. How to build hadoop
  3. Linux, Iometer / Dynamo usage
  4. Linux内核编译安装
  5. 用户态文件系统框架FUSE
  6. 统计代码行数
  7. Why and How to Use Netlink Socket
  8. 汇编语言中段的定义
  9. Makefile学习教程
  10. minix masterboot解读

Get a Trackback link

No Comments Yet

You can be the first to comment!

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>