-
Notifications
You must be signed in to change notification settings - Fork 0
/
definitions.h
88 lines (71 loc) · 1.45 KB
/
definitions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#ifndef DEFINITIONS_H
#define DEFINITIONS_H
#define DELAY_TIMER 5
#define BUFFER_MAX 5
#define WAITING_TO_EXIT 600
#define MAX_PCB 100
#define CLOCK_DEFAULT 10
#define TIMER_DEFAULT 10
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
typedef struct {
pthread_t tid;
} identif_t;
struct parametros {
int tid;
int frec;
};
enum scheduler_m { timer, event } scheduler_flag;
typedef struct mm {
long code;
long data;
long * pgb;
} mm;
typedef struct TLB {
long virtual;
long fisica;
} TLB;
typedef struct pcb_status {
long arr_registr[16];
long IR; // ultima instruccion
long PC; // direccion virtual de IR
struct TLB TLB;
} pcb_status;
/** ESTRUCTURAS CPU **/
typedef struct PCB {
int id;
int quantum;
int prioridad; // 0..3
struct mm mm;
struct pcb_status pcb_status;
} PCB;
typedef struct Queue {
int front, rear, size;
struct PCB arr_pcb[BUFFER_MAX];
} Queue;
typedef struct core_thread
{
bool is_process;
PCB t_pcb;
long arr_registr[16];
} c_thread;
typedef struct cpu_core
{
c_thread *arr_th;
} core;
typedef struct cpu
{
core *arr_core;
} cpu_t;
struct cpu *arr_cpu;
pthread_mutex_t mutexT, mutexC, mutexPCB, mutexMemoria;
long * memoriaFisica;
int sizeMemoria, marcosDisp, marcosMax;
int clockTime, priorityTime, timer_flag;
struct Queue *queue0_ptr, queue0;
struct Queue *queue1_ptr, queue1;
struct Queue *queue2_ptr, queue2;
struct Queue *queue3_ptr, queue3;
#endif // DEFINITIONS_H