Warning: Undefined array key "view" in /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php on line 2

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php on line 47

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php on line 48

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php on line 50

Warning: Cannot modify header information - headers already sent by (output started at /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php:2) in /var/www/html/wp-content/uploads/classes/so/1920/lab-examples/index.php on line 51
/** * un padre che crea 2 processi figli */ #include #include #include int main() { pid_t pid; int i; pid = fork(); // creo un primo figlio if (pid == 0) { // processo figlio n.1 for (i = 0; i < 20; i++) { sleep(rand() % 2); printf("Sono il FIGLIO 1.\n"); } exit(0); } pid = fork(); // creo un secondo figlio if (pid == 0) { // processo figlio n.2 for (i = 0; i < 20; i++) { sleep(rand() % 2); printf("Sono il FIGLIO 2.\n"); } exit(0); } // processo padre for (i = 0; i < 20; i++) { sleep(rand() % 2); printf("Sono il PADRE.\n"); } exit(0); }