Cirrus Logic CS485 Manual de usuario Pagina 43

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 67
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 42
CS485G Spring 2015 43
(f) The only difference is the return value. For A, it is B’s process
identifier (PID). For B, it is 0.
9. The exit() system call terminates the calling process.
(a) The return value is the status. By convention, 0 means success,
and any other value is a failure code.
(b) The program can register a cleanup function to call at exit by
using atexit(); one may register many such functions.
10. The wait() system call reaps the terminated child, collecting its ter-
mination status and freeing its space in kernel data structures.
(a) Until the parent calls wait(), the child is a zombie.
(b) If the parent terminates before reaping its children, the init
process reaps them.
(c) Ordinary wait() blocks the parent until some child terminates;
waitpid() waits for a specific PID.
(d) wait() returns an integer that can be queried by WIFEXITED
and WEXITSTATUS, among other macros.
11. A process can completely reload itself to run a different program by
using one of the exec() family of calls, such as execl().
(a) The parameters to execXX() include a string indicating the file
holding the executable object file, a list of 0 or more parameters
to that program, and, optionally, an array of pointers to strings
indicating environment values of the form var=value.
(b) The initial stack, when main() is called, contains the (1) envi-
ronment strings, (2) the command-line parameters, (3) pointers
to 1, (4) pointers to 2, (5) a pointer to 3, (6) a pointer to 4, a count
of parameters.
49 Processes in Unix
1. Process 1 is always init.
(a) Starts login on each terminal.
(b) Starts daemons to do background work.
(c) Reaps all orphaned children when they exit.
Vista de pagina 42
1 2 ... 38 39 40 41 42 43 44 45 46 47 48 ... 66 67

Comentarios a estos manuales

Sin comentarios