Rcore Gangs May 2026
/// Pick the next runnable gang, then return its next member to run pub fn pick_next_task(&mut self) -> Option<usize> while let Some(gang_id) = self.ready_gangs.pop_front() let gang = self.gangs.get(&gang_id).unwrap(); let mut gang_lock = gang.lock(); if gang_lock.status == GangStatus::Runnable gang_lock.status = GangStatus::Running; // Return the first member that isn't already running on a CPU for &tid in &gang_lock.members if !is_task_running_on_another_cpu(tid) return Some(tid); // If all already running (rare), re-queue self.ready_gangs.push_back(gang_id); None
fn next(&mut self) -> Option<Arc<TaskControlBlock>> if let Some(tid) = self.gang_sched.pick_next_task() return find_task_by_tid(tid); self.inner.next() rcore gangs
pub struct HybridScheduler inner: RoundRobinScheduler, gang_sched: GangScheduler, /// Pick the next runnable gang, then return
Modify your existing scheduler (e.g., RoundRobinScheduler ) to wrap gang logic: /// Pick the next runnable gang
It sounds like you're referring to (the educational OS kernel written in Rust, often used in Tsinghua University’s OS courses) and gangs in the context of parallel computing or OS process groups (e.g., gang scheduling).
/// Called when a task becomes runnable (e.g., wakes from I/O or is created) pub fn notify_task_ready(&mut self, tid: usize) if let Some(&gang_id) = self.task_to_gang.get(&tid) &m
impl GangScheduler pub fn new() -> Self Self gangs: BTreeMap::new(), task_to_gang: BTreeMap::new(), ready_gangs: VecDeque::new(),









