ppos

Usermode educational operating system.
Log | Files | Refs

tcb.h (1445B)


      1 // GRR20235159 Gabriel Gioia de Brito
      2 // PingPongOS - PingPong Operating System
      3 // © Prof. Carlos A. Maziero, DINF UFPR
      4 // Versão 2.1 -- 06/2026
      5 
      6 // Este arquivo PODE/DEVE ser alterado.
      7 
      8 // Descritor de tarefas (TCB - Task Control Block).
      9 
     10 #ifndef __PPOS_TCB__
     11 #define __PPOS_TCB__
     12 
     13 #include "ctx.h"
     14 
     15 #include <queue.h>
     16 #include <stdbool.h>
     17 
     18 #define PPOS_STACK_SIZE (4096 * 16)
     19 
     20 typedef enum {
     21     TaskStatusReady,
     22     TaskStatusRunning,
     23     TaskStatusWaiting,
     24     TaskStatusSleeping,
     25     TaskStatusFinished
     26 } TaskStatus;
     27 
     28 // Task Control Block (TCB), infos sobre uma tarefa
     29 struct task_t {
     30     struct ctx_t    context; // contexto da tarefa
     31     char*           name; // nome da tarefa
     32     struct task_t*  parent;
     33     struct queue_t* waiting_queue;
     34     struct queue_t* waiting_on_queue; // tarefas esperando por essa.
     35     unsigned long   wall_start; // wall time de quando ela começou
     36     // wall time da última vez que ela ganhou a cpu, ou o wall time total caso
     37     // ela já tenha finalizado
     38     unsigned long wall_last_grab;
     39     unsigned long cpu_time; // tempo em que ela passou com a cpu
     40     unsigned long activations;
     41     int           id; // identificador da tarefa
     42     int           valgrind_id;
     43     int           exit_code;
     44     int           nice;
     45     int           prio;
     46     int           quantum;
     47     int           wake_on;
     48     TaskStatus    status;
     49     bool          is_system;
     50 };
     51 
     52 #define PPOS_CONCURRENT_TASKS (1024)
     53 
     54 #endif