Add Scheduler wireframe.
Right now does nothing but has containing classes for process and thread information.
This commit is contained in:
parent
de2c96b848
commit
960cbf9519
8 changed files with 208 additions and 1 deletions
32
zion/scheduler/process.h
Normal file
32
zion/scheduler/process.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// Forward decl due to cyclic dependency.
|
||||
class Thread;
|
||||
|
||||
class Process {
|
||||
public:
|
||||
// Caller takes ownership of returned process.
|
||||
static Process* RootProcess();
|
||||
Process();
|
||||
|
||||
uint64_t id() { return id_; }
|
||||
|
||||
Thread* CreateThread();
|
||||
Thread* GetThread(uint64_t tid);
|
||||
|
||||
private:
|
||||
Process(uint64_t id, uint64_t cr3) : id_(id), cr3_(cr3) {}
|
||||
uint64_t id_;
|
||||
uint64_t cr3_;
|
||||
|
||||
uint64_t next_thread_id_ = 0;
|
||||
|
||||
// FIXME: Make a better data structure for this.
|
||||
struct ThreadEntry {
|
||||
Thread* thread;
|
||||
ThreadEntry* next;
|
||||
};
|
||||
ThreadEntry* thread_list_front_;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue