SOP k1 05 2

SOP k1 05 2



}

for(i = 1; i < 4; i++) if (wait(0) == -1) {

perror("Error in wait"); return 1;

>

return 0;


3. (10 p.) You are given a program:

int main ()

{

pid_t pid; int i;

for (i =    4; 1++)-

switpłf^Cpid = fork()) { case -1:

perror("Error in fork"); return 1; case 0:

execlp("pwd","pwd",0); perror("Error in execM); exit(1) ; default:

printf("pid = %d", pid);

>

Mark correct answers (correct answer is worth +2p, while incorrect answer yields

—2p.

(a)    The program creates:

i.    a linę of processes (father, son, grandson etc.),

ii.    a bunch of processes (father and a number of sons),

iii.    a treę of processes,

iv.    one ęhild process.

(b)    The program creates:

i. /l child process,

ii.    3 child processes,

iii.    4 child processes,

iv.    7 child processes.

(c)    Can there appear zombies?

i.    Yes

ii.    No

(d) Which processes output their identi-fiers?

i.    the parent process,

ii.    the child process(es),

iii.    both,

iv.    nonę.

(e) The parent process:

i.    does not wait for the termina-tion of its children,

ii.    waits for the termination of all its children,

iii.    waits for the termination of one child (but not all).


Wyszukiwarka

Podobne podstrony:
SOP k1 05 2 } for(i = 1; i < 4; i++) if (wait(0) == -1) { perror("Error in wait"); retu
SOP k1 05 2 } for(i = 1; i < 4; i++) if (wait(0) == -1) { perror("Error in wait"); retu
} for(i = 1; i < 4; i++) if (wait(0) == -1) { perror("Error in wait"); return 1; > r
SOP k1 05 1 SOP — second test D Name: .... Index no: .... Gruop: 1. (10 p.) Dostępna jest pamięć wie
skanuj0133 (14) 144 PHP i MySQL dla każdego if($_FILES[ plikl ][,error ] — UPL0A0_ERR_0K){ $new_name
05 (102) If[ gfetttijkFsjftt l -2 j O; i SłeĄ WLtzit MSups fiiT.if Ć3 pi ki J llaui HI rrit.1 i / bf
boolean czyPoprawne(int x, int y) { int i, j; //czy jest w tym samym wierszu? for (j = 0; j < 8;
1A4(1) o o o o4G ure 12.6. In (a) s. = O for 4G. Wc can changc s. in iwo ways: (b)if nil thc spccimc
1A5(1) Figurę 1Ł8. In (a) *. = O for 4G. We can change *, in iwo w*ys: (b) if wetihlhe ipf n— Uwoogh
1A5 a) b) c) Figurę 12.6. In (a)s? = O for 4G. Wc can change a, in two ways: (b) if we till thc spec

więcej podobnych podstron