Núcleo de un Sistema Operativo
Núcleo de un Sistema Operativo
Núcleo de un Sistema Operativo
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
3.4 Definiciones y estructuras <strong>de</strong> datos<br />
Se refieren a la estructura <strong>de</strong>l PCB y a las colas que mo<strong>de</strong>lan el f<strong>un</strong>cionamiento <strong>de</strong>l núcleo.<br />
Aparecen en la Figura 7. Existe a<strong>de</strong>más <strong>un</strong>a serie <strong>de</strong> <strong>de</strong>finiciones <strong>de</strong> símbolos para los estados<br />
<strong>de</strong> los procesos, dispositivos, etc, que no se muestran en la figura.<br />
#<strong>de</strong>fine NUM_PCBS … /* numero maximo <strong>de</strong> PCB */<br />
#<strong>de</strong>fine TAM_PILA … /* tamaño <strong>de</strong> la pila <strong>de</strong> <strong>un</strong> proceso */<br />
struct pcb {<br />
struct item elemento_cola;<br />
int id_proceso;<br />
int ax;<br />
int dx;<br />
int far *pila;<br />
int quantum;<br />
long cpu_time;<br />
int status;<br />
};<br />
struct pcb proc[NUM_PCBS];<br />
int pilas[NUM_PCBS][TAM_PILA];<br />
struct info_proc {<br />
int quantum;<br />
int prioridad;<br />
long t_cpu;<br />
int status;<br />
};<br />
struct cola libres,<br />
ready,<br />
r<strong>un</strong>,<br />
teclado,<br />
disco,<br />
retardo,<br />
lectura_ls,<br />
escritura_ls;<br />
int ntr = 0; /* numero <strong>de</strong> ticks <strong>de</strong> reloj */<br />
#<strong>de</strong>fine NSEM … /* semáforos */<br />
struct semaforo {<br />
struct cola s;<br />
int cont;<br />
};<br />
struct semaforo sem[NSEM];<br />
Figura 7. Definiciones f<strong>un</strong>damentales <strong>de</strong>l núcleo<br />
Otro conj<strong>un</strong>to <strong>de</strong> <strong>de</strong>finiciones (que tampoco se muestran aquí) especifican la configuración <strong>de</strong><br />
la máquina concreta (direcciones <strong>de</strong> pantalla, mapa <strong>de</strong> teclado, etc).<br />
3.5 Primitivas <strong>de</strong>l núcleo<br />
Las primitivas <strong>de</strong>l núcleo constituyen el conj<strong>un</strong>to <strong>de</strong> rutinas visibles <strong>de</strong>s<strong>de</strong> el nivel superior.<br />
Se <strong>de</strong>finen en C y utilizan las rutinas <strong>de</strong>pendientes <strong>de</strong>l hardware y a las rutinas auxiliares<br />
introducidas anteriormente. Las diferenciaremos <strong>de</strong>nominándolas con el sufijo _nuc. Se<br />
pue<strong>de</strong>n dividir en los siguientes grupos:<br />
UPV/EHU ATC Laboratorio <strong>de</strong> <strong>Sistema</strong>s <strong>Operativo</strong>s 7