Aim: Program to Demonstrate the creation and destruction of processes under Linux
Source Code:
Output:
Comment bellow for your Query and Feedback
Source Code:
#include <stdio.h>
#include "shmlib.h"
#include <stdlib.h>
int main()
{
int id, s;
printf("Enter number of process:");
scanf("%d",&s);
id = create_process(s);
if (id>0)
{
printf("Parallel execution strats \n");
printf("\n o/p from child %d: My id %d \n",id,id);
}
else if(id==0)
{
printf("o/p from paralle process:My id= %d", id,id);
join_process(s,id);
printf("\nSequential execution is Finish");
printf("\n Bye Bye");
}
}
#include "shmlib.h"
#include <stdlib.h>
int main()
{
int id, s;
printf("Enter number of process:");
scanf("%d",&s);
id = create_process(s);
if (id>0)
{
printf("Parallel execution strats \n");
printf("\n o/p from child %d: My id %d \n",id,id);
}
else if(id==0)
{
printf("o/p from paralle process:My id= %d", id,id);
join_process(s,id);
printf("\nSequential execution is Finish");
printf("\n Bye Bye");
}
}
Output:
Comment bellow for your Query and Feedback
how we run this programs in ubuntu os
ReplyDelete