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:
Output:
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;
}
#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:
0 comments:
Confused? Feel free to ask
Post a Comment