Beej's Guide to Unix IPC

时间:2016-04-17 06:24:27
【文件属性】:

文件名称:Beej's Guide to Unix IPC

文件大小:429KB

文件格式:PDF

更新时间:2016-04-17 06:24:27

UNIX

You know what's easy? fork() is easy. You can fork off new processes all day and have them deal with individual chunks of a problem in parallel. Of course, its easiest if the processes don't have to communicate with one another while they're running and can just sit there doing their own thing. However, when you start fork()'ing processes, you immediately start to think of the neat multiuser things you could do if the processes could talk to each other easily. So you try making a global array and then fork()'ing to see if it is shared. (That is, see if both the child and parent process use the same array.) Soon, of course, you find that the child process has its own copy of the array and the parent is oblivious to whatever changes the child makes to it. How do you get these guys to talk to one another, share data structures, and be generally amicable? This document discusses several methods of Interprocess Communication (IPC) that can accomplish this, some of which are better suited to certain tasks than others.


网友评论