Login
...or Sign up
Home
Search
Search Code Snippets
Search People
Search
Code Snippets
People
1 Code Snippet found matching sincronización procesos concurrentes
#include <stdio.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include <stdlib.h> int main() { int pid1 = 0,pid2 = 0,pid3 = 0, pid_hijo1 = 0, pid_hijo2 = 0 ,status = 0; printf("Hola "); fflush(stdout); if ((pid1 = fork()) == -1) { printf("Error al crear proceso hijo\n"); exit(1); } if (pid1 == 0) {/* Proceso Hijo */ printf("tenga "); exit(1); } else {/* Proceso Padre */ if ((pid2 = fork()) == -1) { printf("Error al crear proceso hijo.\n"); exit(1); } if (pid2 == 0) {/* Proceso Hijo */ printf("dias "); exit(1); } else { /* Proceso Padre */ printf("Buenos "); fflush(stdout); if ((pid3 = fork()) == -1) { printf("Error al crear proceso hijo\n"); exit(1); } if (pid3 == 0) {/* Proceso Hijo */ printf("y "); printf("malos "); exit(1); } else { /* Proceso Padre*/ pid_hijo1=wait(&status); pid_hijo2=wait(&status); if ((pid_hijo1 == pid3) || (pid_hijo2 == pid3)) { wait(&status); } printf("usted. "); printf("Hasta "); printf("luego "); if ((pid_hijo1!=pid3)||(pid_hijo2!=pid3)) { wait(&status); } printf("Lucas\n"); } } } return(0); }
Implementación de un grafo de precedencia
Uploaded on
2/26/2009 2:34:09 AM
Programming Language:
C
By:
josino
See more code snippets of
josino
implementación grafo precedencia
sincronización procesos concurrentes
sistemas operativos
1
Help
Help by email
What is Naslu?
|
About Naslu
|
Contact
|
Terms of Use
|
Downloads
|
Webprogramacion.com
|
Blog
|
Top
Links
Select language:
Español
|
English
© 2009 naslu.com