1 / 11

Procesos

Procesos. Karina Figueroa. Gesti ón de procesos en unix. Usando fork. Valor de regreso Padre &lt;- ID hijo Hijo &lt;- 0. main ( ) { int f = fork ( ); if (f== -1 ) { printf ( “ Error – proc . no creado <br>”) exit (1) ; } if (f== 0 ){

acton
Télécharger la présentation

Procesos

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Procesos Karina Figueroa

  2. Gestión de procesos en unix

  3. Usando fork • Valor de regreso • Padre <- ID hijo • Hijo <- 0 main ( ) { int f = fork (); if(f== -1){ printf( “ Error – proc. nocreado \n”) exit (1) ; } if(f== 0){ printf ( “ Soyel hijo, mi PID es %d y mi PPID es %d\n", getpid(), getppid()); exit (1) ; } if ( f != 0){ printf( Soy el padre, mi PID es %d y el PID de mi hijoes %d\n", getpid(), pid); exit (1) ;} }

  4. exit

  5. wait

  6. Waitpid • Un proceso puede esperar por un hijo en particular sin esperar por todos los hijos. • no bloqueante -> un proc puede checar periodicamente por un hijo sin bloquearse indefinidamente. • Parámetros entrada: • pididenticador del proceso que se espera; • statlocapuntador para el regreso del status de terminacion del proceso esperado; • optionsbanderas WHOHANG, WCONTINUED, WNOWAIT y WUNTRACED.

  7. EXEC • Execl • Reemplaza proceso actual por uno nuevo • Inicia ejecución en su funcion principal • »Return -1 ifan error; elseno returnifsuccessful • Varias formas para exec(execv, execle, execve) • l - formato lista de argumentos; • v - formato vector • e - el ambiente pasa también como un vector

More Related