Last active
August 29, 2015 14:27
-
-
Save Dietr1ch/78ef64eb93ef840262b5 to your computer and use it in GitHub Desktop.
IIC2333: 0 - forks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <unistd.h> | |
// Output posible para "./programName banner dame ramos" | |
/** | |
1234: Creando 3 subprocesos... | |
4444: ramos | |
5555: banner | |
6666: dame | |
1234: (= | |
*/ | |
int main(int N, char* args) { | |
int i = 0; | |
printf("%d: Creando %d subprocesos...\n", getpid(), N-1); | |
/** | |
* TODO: Crear N-1 subprocesos usando fork(). | |
* Cada uno debería imprimir un argumento (i=1..N) | |
*/ | |
// hijo i: | |
printf("%d: %s\n", getpid(), args[i]); | |
// proceso padre | |
printf("%d: (=\n", getpid()); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment