X-Git-Url: https://gapil.gnulinux.it/gitweb/?p=gapil.git;a=blobdiff_plain;f=prochand.tex;h=1e3b69e106f0bc133269877ebda5682c024c9d08;hp=5fe5845314eab353f3866216f577efe4110fc74a;hb=a051e3c3d3b403ee210274d8c2ec7d756c531a21;hpb=faea6309c25cc36f5552f9998f357cef6d3ae7c8 diff --git a/prochand.tex b/prochand.tex index 5fe5845..1e3b69e 100644 --- a/prochand.tex +++ b/prochand.tex @@ -126,13 +126,14 @@ struttura, alla cui base c' processi. Il kernel mantiene una tabella dei processi attivi, la cosiddetta -\textit{process table}; per ciascun processo viene mantenuta una voce nella -tabella dei processi costituita da una struttura \struct{task\_struct}, che -contiene tutte le informazioni rilevanti per quel processo. Tutte le strutture -usate a questo scopo sono dichiarate nell'header file \file{linux/sched.h}, ed -uno schema semplificato, che riporta la struttura delle principali informazioni -contenute nella \struct{task\_struct} (che in seguito incontreremo a più -riprese), è mostrato in \figref{fig:proc_task_struct}. +\textit{process table}; per ciascun processo viene mantenuta una voce, +costituita da una struttura \struct{task\_struct}, nella tabella dei processi +che contiene tutte le informazioni rilevanti per quel processo. Tutte le +strutture usate a questo scopo sono dichiarate nell'header file +\file{linux/sched.h}, ed uno schema semplificato, che riporta la struttura +delle principali informazioni contenute nella \struct{task\_struct} (che in +seguito incontreremo a più riprese), è mostrato in +\figref{fig:proc_task_struct}. \begin{figure}[htb] \centering @@ -263,7 +264,7 @@ prototipi sono: \bodydesc{Entrambe le funzioni non riportano condizioni di errore.} \end{functions} \noindent esempi dell'uso di queste funzioni sono riportati in -\figref{fig:proc_fork_code}, nel programma di esempio \file{ForkTest.c}. +\figref{fig:proc_fork_code}, nel programma \file{ForkTest.c}. Il fatto che il \acr{pid} sia un numero univoco per il sistema lo rende un candidato per generare ulteriori indicatori associati al processo di cui @@ -349,53 +350,11 @@ sempre un solo padre (il cui \acr{pid} pu che non è il \acr{pid} di nessun processo. \begin{figure}[!htb] - \footnotesize - \begin{lstlisting}{} -#include /* error definitions and routines */ -#include /* C standard library */ -#include /* unix standard library */ -#include /* standard I/O library */ -#include /* string functions */ - -/* Help printing routine */ -void usage(void); - -int main(int argc, char *argv[]) -{ -/* - * Variables definition - */ - int nchild, i; - pid_t pid; - int wait_child = 0; - int wait_parent = 0; - int wait_end = 0; - ... /* handling options */ - nchild = atoi(argv[optind]); - printf("Test for forking %d child\n", nchild); - /* loop to fork children */ - for (i=0; i