zajecia10

This commit is contained in:
Jakub Adamski 2018-12-17 16:58:53 +01:00
parent 20d277ffcf
commit 8861a640e7
4 changed files with 27 additions and 0 deletions

BIN
zajecia10/lab_fork Executable file

Binary file not shown.

14
zajecia10/lab_fork.c Normal file
View File

@ -0,0 +1,14 @@
#include <stdio.h>
int main(){
int res = fork();
if(res>0){
printf("Jestem rodzicem [%d] [%d]\n", res, getpid());
res=wait(NULL);
printf("Zakonczono proces [%d]\n", res);
}
else if (res == 0){
printf("Jestem potomkiem [%d] [%d]\n", res, getpid());
}
return 0;
}

BIN
zajecia10/lab_orphan Executable file

Binary file not shown.

13
zajecia10/lab_orphan.c Normal file
View File

@ -0,0 +1,13 @@
#include <stdio.h>
int main(){
int res = fork();
if(res == 0){
sleep(100);
}
else{
printf("Parent\n");
sleep(10);
}
return 0;
}