Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef _UTIL_H_
- #define _UTIL_H_
- /*
- * Detecta Teclazos
- */
- int kbhit( void );
- /*
- * Compara el comando verificando los implementados
- */
- int compc( char [] );
- int compaux( char [] );
- /*
- * Va armando el comando
- */
- int com(char *, char, int, char *, int *);
- /*
- * Definiciones
- */
- typedef struct proceso PROCESO;
- typedef struct lista LISTA;
- /*
- * Constructor de lista
- */
- int inicial( LISTA * );
- /*
- * Inserta un nodo al final de la lista
- */
- void ins_list(PROCESO *,LISTA *);
- /*
- * Eliminar un nodo de la lista
- */
- int elim_list(int, LISTA *, LISTA *, LISTA *, LISTA *, LISTA *);
- /*
- * Identifica y mata el proceso
- */
- int mata(int, LISTA *, LISTA *, LISTA *, LISTA *, LISTA *, int, int **, char **, int *, int *);
- /*
- * Levanta los procesos
- */
- PROCESO *levanta_proceso(char *, int *, int, int *);
- /*
- * Levanta procesos hijo
- */
- PROCESO *levanta_hijo(char *,int *, int, LISTA *, LISTA *, int *, LISTA *, LISTA * );
- /*
- * Divide argumentos del comando fork
- */
- void div_fork(char *,int *,int *);
- /*
- * Busca el proceso padre para levanta hijo
- */
- PROCESO *busca_padre(int ,LISTA *);
- /*
- * Planificadores
- */
- int planifica( LISTA *, LISTA *, LISTA *,unsigned long long *, unsigned long long *, unsigned long long *, unsigned long long *, int, float);
- /*
- * Ejecuta el siguiente ciclo de timer
- */
- int ejecuta( unsigned long long *AX, unsigned long long *BX, unsigned long long *CX, unsigned long long *DX, LISTA *, int, LISTA *, float, int, char **, int **, LISTA *, LISTA *, int, int *, int *);
- /*
- * Actualiza la variable grupo de los procesos hermanos e hijos
- */
- void grupo( PROCESO * );
- /*
- * Función para imprimir el monitor de procesos
- */
- int imprime(LISTA *, LISTA *, LISTA*, LISTA *, LISTA *, LISTA*);
- /*
- * Función para imprimir la RAM
- */
- void ram_print( char** );
- /*
- * Función para imprimir la RAM
- */
- void tmm_print( int ** );
- void tmp_print( LISTA * );
- /*
- * Función que verifica si existen marcos libres en la RAM basado en la tmm
- */
- int free_frame( int ** );
- /*
- * Función para leer la instrucción indicada
- */
- char *lee_ins( FILE *, int );
- /*
- * Función que saca un proceso del frente de la lista origen y lo pone al final de la lista destino
- */
- int swap( LISTA *, LISTA * );
- /*
- * Función para traducir direcciones virtuales a físicas
- */
- int traduce( int, int);
- /*
- * Libera la memoria RAM usada de un proceso
- */
- void libera( PROCESO *, int **, char **);
- /*
- * Checar si el proceso mandado tiene sus 3 frames ocupados o no
- */
- int lleno( PROCESO *, int * );
- /*
- * Intercambia marcos, uno nuevo por el más viejo del mismo proceso
- */
- int switch_frame( PROCESO *, int**, char**, int*, int );
- /*
- * Saca una página vieja de un proceso y mete una nueva de otro
- */
- int switch_other( PROCESO *, int **, char ** );
- /*
- * Esta es una operación con registros pero usa definiciones de util.h
- */
- int get( int *, int *, char *, char *, char *, char *, LISTA *, LISTA *);
- /*
- * Función para verificar marcados en banquero
- */
- int suma_marc_pend( int *, int *, int);
- /*
- * Buscar marcados
- */
- int marcado( int, int *, int);
- /*
- * Finje un uso de recursos
- */
- int use( PROCESO *, char *, char *, char *, char *);
- /*
- * Decrementar random de bloqueados y sacar si es necesario
- */
- void bloqueadoschk( LISTA *, LISTA *);
- /*
- * Función para liberar recursos utilizados
- */
- int fre( PROCESO *, char *, char *, char *, char *, int *);
- /*
- * Estructuras
- */
- struct proceso{
- int fp, lineas, pid, PC, ppid, proceso, grupo, **tmp, fork, *recs, *recAs, bloqueo;
- float prioridad;
- unsigned long long AX,BX,CX,DX;
- char *nombre;
- FILE *instrucciones;
- PROCESO *siguiente, *hermano;
- LISTA *hijos;
- };
- struct lista{
- int num;
- PROCESO *inicio,*fin;
- };
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement