-
Notifications
You must be signed in to change notification settings - Fork 0
/
PCB.cpp
80 lines (56 loc) · 1.22 KB
/
PCB.cpp
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
//
// Created by Alex on 2020/8/13.
//
#include "PCB.h"
PCB::~PCB() = default;
PCB::PCB(int pid, int father_pid, int priority)
: pid(pid),
father_pid(father_pid),
priority(priority),
statue(0) {
}
int PCB::get_pid() {
return this->pid;
}
int PCB::get_priority() {
return this->priority;
}
std::map<int, int> PCB::get_resources() {
return this->resources;
}
int PCB::get_statue() {
return this->statue;
}
std::list<int> PCB::get_childrenPCBs() {
return this->childrenPCBs;
}
void PCB::set_priority(int new_priority) {
this->priority = new_priority;
}
void PCB::set_statue(int new_statue) {
this->statue = new_statue;
}
void PCB::add_childProcess(int c_pid) {
this->childrenPCBs.push_back(c_pid);
}
void PCB::set_resources(int rid, int num) {
this->resources[rid] = num;
}
void PCB::delete_childProcess(int c_pid) {
this->childrenPCBs.remove(c_pid);
}
int PCB::get_father_pid() {
return this->father_pid;
}
void PCB::set_waitRid(int rid) {
this->waitRid = rid;
}
void PCB::set_waitRid_num(int n) {
this->waitRid_num = n;
}
int PCB::get_waitRid_num() {
return this->waitRid_num;
}
int PCB::get_waitRid() {
return this->waitRid;
}