/// Called when a task yields or blocks pub fn task_blocked(&mut self, tid: usize) if let Some(&gang_id) = self.task_to_gang.get(&tid) let gang = self.gangs.get(&gang_id).unwrap(); let mut gang_lock = gang.lock(); gang_lock.status = GangStatus::Pending; // Optionally, preempt all other members of this gang for &other in &gang_lock.members if other != tid && task_status(other) == TaskStatus::Running force_yield_task(other);
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
pub struct HybridScheduler inner: RoundRobinScheduler, gang_sched: GangScheduler,
impl GangScheduler pub fn new() -> Self Self gangs: BTreeMap::new(), task_to_gang: BTreeMap::new(), ready_gangs: VecDeque::new(),
/// Called when a task yields or blocks pub fn task_blocked(&mut self, tid: usize) if let Some(&gang_id) = self.task_to_gang.get(&tid) let gang = self.gangs.get(&gang_id).unwrap(); let mut gang_lock = gang.lock(); gang_lock.status = GangStatus::Pending; // Optionally, preempt all other members of this gang for &other in &gang_lock.members if other != tid && task_status(other) == TaskStatus::Running force_yield_task(other);
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
pub struct HybridScheduler inner: RoundRobinScheduler, gang_sched: GangScheduler,
impl GangScheduler pub fn new() -> Self Self gangs: BTreeMap::new(), task_to_gang: BTreeMap::new(), ready_gangs: VecDeque::new(),
© 2019 - 2025. Tarah WorldTrade India Pvt Ltd. All Rights Reserved.