/// 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
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()
pub struct GangScheduler gangs: BTreeMap<usize, Arc<Mutex<Gang>>>, task_to_gang: BTreeMap<usize, usize>, ready_gangs: VecDeque<usize>, // queue of gang IDs ready to run rcore gangs
impl GangScheduler pub fn new() -> Self Self gangs: BTreeMap::new(), task_to_gang: BTreeMap::new(), ready_gangs: VecDeque::new(),
pub struct HybridScheduler inner: RoundRobinScheduler, gang_sched: GangScheduler, /// Called when a task becomes runnable (e
impl Scheduler for HybridScheduler fn push(&mut self, task: Arc<TaskControlBlock>) if let Some(gang_id) = self.gang_sched.task_to_gang.get(&task.tid) self.gang_sched.notify_task_ready(task.tid); else self.inner.push(task);
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). Self Self gangs: BTreeMap::new()
pub fn create_gang(&mut self, members: Vec<usize>) -> usize let id = self.gangs.len(); let gang = Arc::new(Mutex::new(Gang id, members: members.clone(), status: GangStatus::Pending, )); for &tid in &members self.task_to_gang.insert(tid, id); self.gangs.insert(id, gang); id