I am supposed to create shared variables in which multiple processes (p1 to p8) update it. Say processes p1-p4 update shared variable x1 and processes p5-p8 update shared variable x2.
how do it do it ?
is it like ?
I doubt in it because. I think second fork will create some problems as it will fork children which has childrens generated in earlier for loop..Code:main create shared variables x1 and x2 for (i=1;i<=4;i++) {pid=fork() if(pid==0) update x1; } for (j=1;j<=4;j++) {pid=fork() if(pid==0) update x2; }
I am confused how to solve it...
--------------------------------------------------------------------------------



LinkBack URL
About LinkBacks



