You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Processes II<br />
{<br />
}<br />
char process_name[MAXLEN];<br />
char line[MAXLEN];<br />
sprintf(process_name, "parent");<br />
while (1) {<br />
printf("%s> ",process_name);<br />
fgets(line, MAXLEN, stdin);<br />
if (strcmp(line, "dir") == 0)<br />
directory(process_name);<br />
else if (strcmp(line, "start") == 0)<br />
start(process_name);<br />
else if (strcmp(line, "exit") == 0)<br />
exit(0) ;<br />
else if (strcmp(line, "") == 0)<br />
continue;<br />
else<br />
printf("<strong>the</strong>re is no help yet\n");<br />
}<br />
directory(char *pname)<br />
{<br />
int fd, nread,size;<br />
char *dname,*path;<br />
static struct dirent dlink;<br />
getpath(pname, path);<br />
}<br />
if ((fd=open(path, 0)) == -1) {<br />
fprintf(stderr, "no such directory\n");<br />
exit(1);<br />
}<br />
dlink.d_name[DIRSIZ] = '\0';<br />
size = sizeof(struct dirent);<br />
while((nread=read(fd, &dlink, size)) == size)<br />
if (dlink.d_ino != 0){}<br />
Interprocess Communication<br />
- IPC between two processes on a single system<br />
user<br />
process<br />
user<br />
process<br />
kernel<br />
- IPC between two processes on different systems<br />
user<br />
process<br />
user<br />
process<br />
kernel<br />
kernel<br />
There are several ways to implement IPCs:<br />
- Pipes<br />
- FIFOs<br />
- message queues<br />
- semaphores<br />
- shared memory<br />
132