From 69703f6fdd788276e84cbe2714c91fcfdb9e76cb Mon Sep 17 00:00:00 2001 From: Amlal Date: Thu, 24 Apr 2025 17:34:39 +0200 Subject: dev, kernel: scheduler and heap related work. - Replacing USER_HEAP_LIST with HEAP_HEAP_TREE. - Reworked Signal struct. - Add Team spinner inside ARM64 HAL too. Signed-off-by: Amlal --- dev/kernel/HALKit/ARM64/HalKernelMain.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'dev/kernel/HALKit/ARM64/HalKernelMain.cc') diff --git a/dev/kernel/HALKit/ARM64/HalKernelMain.cc b/dev/kernel/HALKit/ARM64/HalKernelMain.cc index d9f3eb85..3498d477 100644 --- a/dev/kernel/HALKit/ARM64/HalKernelMain.cc +++ b/dev/kernel/HALKit/ARM64/HalKernelMain.cc @@ -48,7 +48,30 @@ EXTERN_C void hal_init_platform( Kernel::mp_initialize_gic(); + /// after the scheduler runs, we must look over teams, every 5000s in order to schedule every process according to their affinity fairly. + + auto constexpr kSchedTeamSwitchMS = 5U; /// @brief Team switch time in milliseconds. + + Kernel::HardwareTimer timer(rtl_milliseconds(kSchedTeamSwitchMS)); + + STATIC Kernel::Array kTeams; + + SizeT team_index = 0U; + + /// @brief This just loops over the teams and switches between them. + /// @details Not even round-robin, just a simple loop in this boot core we're at. while (YES) { + if (team_index > (kSchedTeamCount - 1)) + { + team_index = 0U; + } + + while (!UserProcessScheduler::The().SwitchTeam(kTeams[team_index])) + ; + + timer.Wait(); + + ++team_index; } } -- cgit v1.2.3