Skip to content

Create many processes accept number of processes from user

Aim: Create many processes accept number of processes from user, assign task for each, and kill the process.
MSc IT Parallel Processing Practical No. 1
Index of all Practicals ~ Click Here

Code:

#include<stdio.h>
#include”shmlib.h”
int main()
{
int n,id,i;
printf(“Enter the number of processes: “);
scanf(“%d”,&n);
id=create_process(n-1);

for(i=0;i<n;i++)
{
if(id==i)
{
printf(“n Process number: %d”,id);
}
}

join_process(n,id);

return 0;
}


Output:

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!