Write a program to execute ls command in child process. Parent process must wait for child termination.
#include
#include
#include
main()
{
int pid,w,Status;
printf("PRENT PROCESS PORTION \n");
pid=fork();
if(pid==0)
{
printf("child process part \n ");
execl("/bin/ls","ls",0);
}
sleep(3);
w = wait(&Status);
printf("parent process after child execution \n ");
}
#include
#include
main()
{
int pid,w,Status;
printf("PRENT PROCESS PORTION \n");
pid=fork();
if(pid==0)
{
printf("child process part \n ");
execl("/bin/ls","ls",0);
}
sleep(3);
w = wait(&Status);
printf("parent process after child execution \n ");
}
Comments
Post a Comment