computer
IPC 기법
유순이
2021. 7. 6. 22:01
pipe
int fd[2], pid, nbytes;
parent에서 write (fd[1], msg, MSGSIZE)
child에서 nbytes = read (fd[0], buf, MSGSIZE)
message queue
FIFO
msqid = msgget (key, msgflg) //key는 int, msgflg는 option
: message queue 생성
msgsnd(msqid, $sbuf, buf_length, IPC_NOWAIT) // block mode : 0
: message send
msgrcv(msqid, *msgp, msgsz, msgtype, msgflg)
: message receive
ftok()
: key 생성 함수
key_t ftok(const char *path, int id)
key = ftok("keyfile", 1);