pub enum SchedState {
New,
Runnable {
cpu: usize,
},
Running {
cpu: usize,
},
Blocked,
Zombie,
Reaped,
}Expand description
Formal scheduling state of a task, encoding ownership unambiguously.
Each state identifies the exclusive owner of the task:
| State | Owner | Present in |
|---|---|---|
| New | creator / global | alltasks only, no queue |
| Runnable { cpu } | LOCAL_SCHEDULERS[cpu] | exactly one class queue |
| Running { cpu } | LOCAL_SCHEDULERS[cpu] | exactly currenttask on cpu |
| Blocked | BLOCKED_TASKS | exactly BLOCKED_TASKS |
| Zombie | GLOBAL_SCHED_STATE | zombies + alltasks |
| Reaped | nobody | removed from all structures |
alltasks may retain a reference for all states except Reaped, but must
never be used to determine schedulability. The source of truth is the
SchedState and its owning container.
Variants§
New
Task constructed but not yet visible to the scheduler.
Runnable
Enqueued on cpu’s local run queue, awaiting selection.
Running
Currently executing on cpu.
Blocked
Waiting for an event; entry must exist in BLOCKED_TASKS.
Zombie
Exited; waiting to be reaped by parent’s waitpid.
Reaped
Fully removed from all scheduler and identity structures.
Implementations§
Source§impl SchedState
impl SchedState
Sourcepub fn is_runnable_like(self) -> bool
pub fn is_runnable_like(self) -> bool
Returns true if the task is in a scheduling-eligible state.
Trait Implementations§
Source§impl Clone for SchedState
impl Clone for SchedState
Source§fn clone(&self) -> SchedState
fn clone(&self) -> SchedState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for SchedState
Source§impl Debug for SchedState
impl Debug for SchedState
impl Eq for SchedState
Source§impl PartialEq for SchedState
impl PartialEq for SchedState
impl StructuralPartialEq for SchedState
Auto Trait Implementations§
impl Freeze for SchedState
impl RefUnwindSafe for SchedState
impl Send for SchedState
impl Sync for SchedState
impl Unpin for SchedState
impl UnsafeUnpin for SchedState
impl UnwindSafe for SchedState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more