implement basic multitasking

This commit is contained in:
2025-03-31 14:51:33 +03:00
parent 10eb4687f0
commit 9381b4cdb7
6 changed files with 243 additions and 1 deletions
+32
View File
@@ -0,0 +1,32 @@
#ifndef TASK_H
#define TASK_H
#include <stdint.h>
typedef enum TaskState
{
Ready,
Running,
Waiting,
Terminated
} TaskState;
typedef void (*EntryPoint)(void);
typedef struct Process
{
uint32_t pid; // Process ID
TaskState state; // Process state
uintptr_t programCounter; // Program Counter
uintptr_t* stackBase; // Top of the stack
uintptr_t* stackPointer; // Stack Pointer
uint32_t flags; // Status/Flags register
struct Process* next; // Pointer to the next task in the list
} Process;
Process* task_create(EntryPoint func);
void scheduler_init();
void schedule();
void scheduler_lock();
void scheduler_unlock();
#endif