|
Last change
on this file since 11 was 2, checked in by Mattia Monga, 15 years ago |
|
Importazione sorgenti
|
|
File size:
353 bytes
|
| Rev | Line | |
|---|
| [2] | 1 | #include <unistd.h>
|
|---|
| 2 | #include <stdio.h>
|
|---|
| 3 | #include <stdlib.h>
|
|---|
| 4 |
|
|---|
| 5 | int main(void){
|
|---|
| 6 | int x = fork();
|
|---|
| 7 | if (x < 0){
|
|---|
| 8 | perror("Errore nella fork:");
|
|---|
| 9 | exit(1);
|
|---|
| 10 | } else {
|
|---|
| 11 | if (x != 0){
|
|---|
| 12 | while(1) printf("Processo padre (Figlio: %d)\n", x);
|
|---|
| 13 | } else {
|
|---|
| 14 | while(1) printf("Processo figlio (%d)\n", x);
|
|---|
| 15 | }
|
|---|
| 16 | }
|
|---|
| 17 | return 0;
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.