ALL > Computer and Education > courses > university courses > undergraduate courses > Operating System > classbefore2015 >
3.2&3.6_2013329620033 Version 0
👤 Author: by 2013329620033yellow 2015-09-30 07:01:10
3.2

Save the context of the old processes in its PCB and load the saved context of the new process scheduled to run.

3.6

#include<sys/types.h>

#include<stdio.h>

#include<unistd.h>

int main(){

pid_t pid;

pid=fork();

int num=0,a1=0,a2=1,a3;

while(num<=0){scanf("%d",&num);}

if(pid<0)exit(-1);

else if(pid==0)

{

for(num;num>0;num--){

printf("%d",a1);

a3=a1;a1=a2;a2=a1+a3;

}

}

else{

wait(NULL);

printf("
%d n

Please login to reply. Login

Reversion History

Loading...
No reversions found.