/* process.h */ #ifndef PROCESS_H #define PROCESS_H #include "message.h" #include "registers.h" #include "string.h" #include "types.h" // process states enum { CREATED, WAITING, RUNNING, BLOCKED, DELAYED, TERMINATED, CRASHED }; #define PROCESSES 7 #define STACK_SIZE 0x4000 typedef struct { int pid; int status; int priority; int delay_time; int wait_time; uint32_t address; char name[MAX_STR_LEN]; char input[MAX_STR_LEN]; int toggle; int supervisor_pid; message current_message; message messages[MESSAGE_QUEUE_SIZE]; registers_t regs; char stack[STACK_SIZE]; char arg_1[MAX_STR_LEN]; char arg_2[MAX_STR_LEN]; } PCB; int is_supervisor(int pid); void terminate(int pid); void init_PCB(); int new_p(char name[], char argv[2][]); void registers_memcpy(registers_t *dst, const registers_t *src); void ps(); void clear_PCB(int pid); extern PCB PCB_list[PROCESSES]; #endif