Wednesday, October 10, 2012
Create 5 Child for Process | Operating system
By UnknownCreate 5 child processes for a process. The processes should be executing in
Create Child Using Fork in C program | Operating System
By Unknown
Create a process. Fork to create a child process. Display pid, ppid, gid and uid in
the child process and display pid, gid and uid for the parent process
Solution:
This is small program to create process using fork() method as after call fork() it will return -1 if child creation fail,return 0 if child creation successful ,return child pid to parent.
This is small program to create process using fork() method as after call fork() it will return -1 if child creation fail,return 0 if child creation successful ,return child pid to parent.
#include<stdio.h> #include<sys/types.h> #include<unistd.h>
#include<stdlib.h>
void main()
{
pid_t pid;
pid=fork();
switch(pid)
{
case -1:printf("Child Creation Fail..!!");
exit(1);
case 0:
printf("I AM THE CHILD PROCESS\n");
printf("The Child process id is %d ppid is %d gid is %d uid id %d \n",getpid(),getppid(),getgid(),getuid());
default: printf("I AM THE PARENT PROCESS\n");
printf("The Parent process id is %d gid %d uid %d \n",getpid(),getgid(),getuid());
}
exit(0);
}
FCFS and Round Robin Schedular Implementation in C | Operating System
By Unknown
Wednesday, October 10, 2012
c program, fcfs, operating system, round robin, scheduling, structure
No comments




