Book exercise 3.2&3.4 (2013329600060) Version 0 |
|
👤 Author: by lyen 2015-09-27 12:29:57 |
3.2
When a context switch occurs, the Kernel saves the context of old process in its PCB and loads the saved context the new process scheduled to run.
3.6
#include<sys/types.h>
#include<stdio.h>
#include<unistd.h>
int main(){
pid_t pid;
int a,i,j,k;
scanf("%d",&a);
pid=fork();
if (pid==0){
if(a>=0){
i=0;
j=1;
k=0;
printf("0 1 ");
for(i=2;i<=a;i++){
k=i+j;
i=j