PROCESS MANAGEMENT USING FORK () AND EXECL() USING C PROGRAM

AIM:
To manage the process using fork() and execl() system calls. OPERATING SYSTEM (OS) LAB IN LINUX ENVIRONMENT
ALGORITHM:
· Start program.
· System is used to call the child process.
· fork() system call is assigned to fd variable.
· if fd is equal to -1, then control is passed to main program.
· if fd is equal to 0, date and time of child process is printed.
· Stop the program.


PROGRAM SOURCE CODE

#include <stdio.h>
void syst();
main()
{
Syst("\bin\date","date");
printf("now you are with parent process");
return 0;
}
void syst(s1,s2)
char *s1,*s2;
{
int fd,x;
fd =fork();
if (fd ==0)
{
printf("now you are with current processs\n");
x=execl(s1,s2,0);
if(x==-1)
{
perror(s1);
}
}
wait();
}



CONCLUSION:
Thus the c program to perform process management using fork() and execl() was written and executed successfully.


Related post