































Prepara tus exámenes y mejora tus resultados gracias a la gran cantidad de recursos disponibles en Docsity
Gana puntos ayudando a otros estudiantes o consíguelos activando un Plan Premium
Esta página no es visible en la vista previa
¡No te pierdas las partes importantes!
































1. GENERALIDADES SOBRE PROCESOS, HILOS Y PLANIFICACIÓN
El kernel almacena la lista de procesos como una lista circular doblemente enlazada llamada lista de tareas (task list): Cada elemento en la task list es un descriptor de proceso de tipo struct task_struct (definido en </include/linux/sched.h>):
pid_t pid; pid_t tgid; #ifdef CONFIG_CC_STACKPROTECTOR /* Canary value for the - fstack-protector gcc feature / unsigned long stack_canary; #endif /
/* ipc stuff / struct sysv_sem sysvsem; #endif / CPU-specific state of this task / struct thread_struct thread; / filesystem information */ struct fs_struct fs; / open file information */ struct files_struct files; / namespaces */ struct nsproxy nsproxy; / signal handlers */ struct signal_struct *signal; struct sighand_struct sighand; sigset_t blocked, real_blocked; sigset_t saved_sigmask; / To be restored with TIF_RESTORE_SIGMASK / struct sigpending pending; unsigned long sas_ss_sp; size_t sas_ss_size; int (notifier)(void *priv); void *notifier_data; sigset_t *notifier_mask; #ifdef CONFIG_SECURITY void *security; #endif struct audit_context audit_context; seccomp_t seccomp; / Thread group tracking */ u32 parent_exec_id;
u32 self_exec_id; /* Protection of (de-)allocation: mm, files, fs, tty, keyrings / spinlock_t alloc_lock; / Protection of the PI data structures: / spinlock_t pi_lock; #ifdef CONFIG_RT_MUTEXES / PI waiters blocked on a rt_mutex held by this task / struct plist_head pi_waiters; / Deadlock detection and priority inheritance handling */ struct rt_mutex_waiter pi_blocked_on; #endif #ifdef CONFIG_DEBUG_MUTEXES / mutex deadlock detection */ struct mutex_waiter *blocked_on; #endif #ifdef CONFIG_TRACE_IRQFLAGS unsigned int irq_events; int hardirqs_enabled; unsigned long hardirq_enable_ip; unsigned int hardirq_enable_event; unsigned long hardirq_disable_ip; unsigned int hardirq_disable_event; int softirqs_enabled; unsigned long softirq_disable_ip; unsigned int softirq_disable_event; unsigned long softirq_enable_ip; unsigned int softirq_enable_event; int hardirq_context; int softirq_context;
ALGUNOS CONTENIDOS DE task_struct:
2.2 Estados de un proceso [Mau08 2.3] La variable state de task_struct especifica el estado actual del proceso. Valores: (son constantes que resuelve el preprocesador definidas en <sched.h>) TASK_RUNNING : proceso ejecutable, tanto si está actualmente ejecutándose o está esperando a que se le asigne CPU. Si el proceso se está ejecutando puede estar tanto en ejecución en el espacio de usuario como en el espacio del kernel. TASK_INTERRUPTIBLE : proceso bloqueado o durmiendo; la tarea no está lista para ejecutarse porque espera un evento; cuando el kernel notifique al proceso (mediante una señal) que el evento ha ocurrido se calificará en el estado TASK_RUNNING y podrá reanudar su ejecución cuando el planificador le asigne la CPU TASK_UNINTERRUPTIBLE : estado idéntico al anterior excepto que el proceso no despierta si recibe una señal;
2.3 Estructura interna de un proceso en linux
2.4 Contexto de un proceso [Lov10 pag. 29]