MCPcopy Create free account
hub / github.com/YatSenOS/YatSenOS-Tutorial-Volume-1 / allocatePCB

Method allocatePCB

lab6/src/1/src/kernel/program.cpp:127–139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127PCB *ProgramManager::allocatePCB()
128{
129 for (int i = 0; i < MAX_PROGRAM_AMOUNT; ++i)
130 {
131 if (!PCB_SET_STATUS[i])
132 {
133 PCB_SET_STATUS[i] = true;
134 return (PCB *)((int)PCB_SET + PCB_SIZE * i);
135 }
136 }
137
138 return nullptr;
139}
140
141void ProgramManager::releasePCB(PCB *program)
142{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected