Professional Documents
Culture Documents
MMMMM
MMMMM
Lab Assignment – 2
Faculty: Thamizharasan S
Slot: L55+56
Name: Lanka Nishanth George
Reg No: 21BCE3017
21BCE3017 Lanka Nishanth George L55+56
Output:
Output:
21BCE3017 Lanka Nishanth George L55+56
b:Zombie process:
Code:
#include <stdlib.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
int main()
{
int a, b, c;
pid_t pid = fork();
if (pid > 0)
{
printf("Parent process is going to sleep\n");
sleep(10);
printf("Parent process is resumed\n");
}
else if (pid == 0)
{
printf("Child process executing\n");
printf("Child terminates\n");
exit(0);
}
else
{
printf("Fork failed\n");
return 1;
}
return 0;
}
21BCE3017 Lanka Nishanth George L55+56
Output:
Output:
21BCE3017 Lanka Nishanth George L55+56
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
printf("Executing 'date' command:\n");
system("date");
printf("\nExecuting 'ls' command:\n");
system("ls");
return 0;
}
21BCE3017 Lanka Nishanth George L55+56
Output:
Output: