28.01.2015 Views

Процеси - Elsys

Процеси - Elsys

Процеси - Elsys

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Създаване на процес<br />

Създаване на процес: UNIX<br />

1 #i n c l u d e < stddef .h ><br />

2 #i n c l u d e < stdlib .h ><br />

3 #i n c l u d e < stdio .h ><br />

4 #i n c l u d e < unistd .h ><br />

5 #i n c l u d e <br />

6 #i n c l u d e <br />

7<br />

8 i n t main () {<br />

9 i n t status ;<br />

10 pid_t pid ;<br />

11 pid = fork ();<br />

12 i f ( pid < 0) {<br />

13 /* The fork failed . Report failure . */<br />

14 status = -1;<br />

15 printf (" Unsuccessful ␣ fork ...\ n" );<br />

16 } e l s e i f ( pid == 0){<br />

Л. Чорбаджиев (ELSYS) Процеси 13 май 2009 г. 19 / 28

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!