#include
main()
{
clock_t st,en;
int a[2],i,b[2],c[2],s[]={1,2,3,4,5,6,7,8,9,10},temp=0;
int p,res=0,res1=0,n;
printf("Enter The Total Elements\n");
scanf("%d",&n);
printf("Enter All Elements One By One\n");
for(i=0;i
scanf("%d",(s+i));
//st=clock();
//printf("\nSTART IS :%d",st);
if(n%2==1)
{
n++;
*(s+i)=0;
}
pipe(a);
pipe(b);
p=fork();
for(i=0;i
if(p>0)
{
write(a[1],(s+i),1);
read(b[0],&temp,1);
res=res+temp;
}
else
{
read(a[0],&res1,1);
res=*(s+i+1)+res1;
write(b[1],&res,1);
}
printf("\nRES :%d",res);
en=clock();
printf("\nTOTAL TIME IS : %d ",(en-st));
}
ShoutBox
Blog Archive
- 
▼ 
2010
            (22)
          
- 
▼ 
January
            (22)
          
- Linklist Node delete program in C
 - Link List program in c
 - Assembler program in C
 - Accessing array in C using pipe
 - Fork IPC program in C
 - Executing another program in C
 - Time program in C
 - Sorting Program in C using fork and pipe
 - Use of vfork in Unix C program
 - Fork and Wait in Unix IPC C program
 - Pipes in Unix IPC
 - Complete sum program in Unix IPC
 - Sort program in C using Unix IPC fork and pipe
 - Shared memory in Unix C program
 - Sum of N numbers program in C using Fork and Pipe IPC
 - Inter process communication with fork and pipe
 - Fork and Pipe program in C
 - Fork with Pipe Program in C
 - Another Fork program in C
 - Simple Fork Program in Linux/Unix C
 - Recursive File System Search Program in C
 - Assembler Program in C
 
 
 - 
▼ 
January
            (22)
          
 
Join With Me...
3:11 AM
Subscribe to:
Post Comments (Atom)


0 comments:
Post a Comment