-
Notifications
You must be signed in to change notification settings - Fork 0
/
PCB.h
63 lines (38 loc) · 1.16 KB
/
PCB.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
// File: thread.h
#ifndef _pcb_h_
#define _pcb_h_
#include "List.h"
enum Status { NEW, READY, RUNNING, BLOCKED, TERMINATED};
//#include "Thread.h"
//#include "Kernel.h" //mozda ne mora ovde
typedef unsigned int Time; // time, x 55ms
typedef unsigned long StackSize;
typedef void interrupt (*pInterrupt)(...);
typedef int ID;
//Time - unsigned int, StackSize - unsigned long, ID - int
class Thread;
class PCB {
public:
friend class Thread;
static ID nextID; //sledeca nit
unsigned * stack; //pok na stek
unsigned ss, sp, bp; //ss - stek segment, sp - njegov offsetni, moze i bp biti
char deblockedBySignal;
Time timeSlice;
//Time timeRemaining;
//Time timeToWait;
StackSize stackSize;
Status status;
ID id; //id niti
Thread * myThread;
LList<PCB> waitingList; //samo PCB jer je lista T*, lista koji cekaju na ovo
PCB(Thread * mmyThread, StackSize sstackSize, Time ttimeSlice);
void start();
void waitToComplete();
static void wrapper();
ID getID();
//static PCB * runningPCB; //ipak u kernelu
//static Time counter; //koliko traje trenutna nit - ipak u kernelu
~PCB();
};
#endif