// This file is part of noxos and licensed under the MIT open source license #ifndef NOX_SCHEDULER_H #define NOX_SCHEDULER_H #include "proc/thread.h" #include "proc/process.h" #include "utils/bitmap.h" #include "boot/boot_info.h" #define SCHEDULER_PROCESS_CHUNK_SIZE 64 typedef struct scheduler_processes_chunk_T scheduler_processes_chunk_T; struct scheduler_processes_chunk_T { process_T** processes; bitmap_T processes_bitmap; uint32_t num_free_pids; scheduler_processes_chunk_T* prev; scheduler_processes_chunk_T* next; }; typedef struct { uint32_t num_threads; uint32_t num_processes; thread_T* running_thread; scheduler_processes_chunk_T* processes; bool blocked; bool initialized; } scheduler_T; void scheduler_init (boot_info_T* boot_info); cpu_state_T* scheduler_start (cpu_state_T* state); bool scheduler_is_initialized (); void scheduler_dump_info (process_T* process, uint8_t indent); thread_T* scheduler_register_thread (thread_T* thread); void scheduler_pause_thread (thread_T* thread); void scheduler_start_thread (thread_T* thread); void scheduler_kill_thread (thread_T* thread); pid_t scheduler_register_process (process_T* process); void scheduler_kill_process (process_T* process); process_T* scheduler_get_process (pid_t pid); thread_T* scheduler_get_current_thread (); process_T* scheduler_get_current_process (); cpu_state_T* scheduler_switch_context (cpu_state_T* state); #endif //NOX_SCHEDULER_H