c program for inter-process communication using double pipe (with algorithm)
aim : to implement inter-process communication using double pipe
algorithm :
step 1 : start
step 2 : declare p1,p2,buff1[25],buff2[25],pid
step 3 : call system calls pipe(p1),pipe(p2)
step 4 : call the fork and initialize pid
step 5 : check if pid==0 then goto step 6 else goto step 11
step 6 : read the message to parent and store on buff1
step 7 : write the message to child using pipe p1
step 8 : call sleep()
step 9 : read the message from parent using pipe p2 and store in buff1
step 10 : print the message from parent
step 11 : read the message from child using pipe p1
step 12 : print the message from child
step 13 : read the message from child
step 14 : write the message to child using pipe2
step 15 : stop
aim : to implement inter-process communication using double pipe
algorithm :
step 1 : start
step 2 : declare p1,p2,buff1[25],buff2[25],pid
step 3 : call system calls pipe(p1),pipe(p2)
step 4 : call the fork and initialize pid
step 5 : check if pid==0 then goto step 6 else goto step 11
step 6 : read the message to parent and store on buff1
step 7 : write the message to child using pipe p1
step 8 : call sleep()
step 9 : read the message from parent using pipe p2 and store in buff1
step 10 : print the message from parent
step 11 : read the message from child using pipe p1
step 12 : print the message from child
step 13 : read the message from child
step 14 : write the message to child using pipe2
step 15 : stop
No comments:
Post a Comment