Enum kernel::process::State

source ·
pub enum State {
    Running,
    Yielded,
    StoppedRunning,
    StoppedYielded,
    Faulted,
    Terminated,
}
Expand description

States a process can be in.

This is public so external implementations of Process can re-use these process states.

While a process is running, it transitions between the Running, Yielded, StoppedRunning, and StoppedYielded states. If an error occurs (e.g., a memory access error), the kernel faults it and either leaves it in the Faulted state, restarts it, or takes some other action defined by the kernel fault policy. If the process issues an exit-terminate system call, it enters the Terminated state. If it issues an exit-restart system call, it terminates then tries to back to a runnable state.

When a process faults, it enters the Faulted state. To be restarted, it must first transition to the Terminated state, which means that all of its state has been cleaned up.

Variants§

§

Running

Process expects to be running code. The process may not be currently scheduled by the scheduler, but the process has work to do if it is scheduled.

§

Yielded

Process stopped executing and returned to the kernel because it called the yield syscall. This likely means it is waiting for some event to occur, but it could also mean it has finished and doesn’t need to be scheduled again.

§

StoppedRunning

The process is stopped, and its previous state was Running. This is used if the kernel forcibly stops a process when it is in the Running state. This state indicates to the kernel not to schedule the process, but if the process is to be resumed later it should be put back in the running state so it will execute correctly.

§

StoppedYielded

The process is stopped, and it was stopped while it was yielded. If this process needs to be resumed it should be put back in the Yield state.

§

Faulted

The process ran, faulted while running, and is no longer runnable. For a faulted process to be made runnable, it must first be terminated (to clean up its state).

§

Terminated

The process is not running: it exited with the exit-terminate system call or was terminated for some other reason (e.g., by the process console). Processes in the Terminated state can be run again.

Trait Implementations§

source§

impl Clone for State

source§

fn clone(&self) -> State

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for State

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Eq for State

source§

impl PartialEq for State

source§

fn eq(&self, other: &State) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for State

source§

impl StructuralEq for State

source§

impl StructuralPartialEq for State

Auto Trait Implementations§

§

impl RefUnwindSafe for State

§

impl Send for State

§

impl Sync for State

§

impl Unpin for State

§

impl UnwindSafe for State

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> SizedTypeProperties for T

source§

const IS_ZST: bool = _

🔬This is a nightly-only experimental API. (sized_type_properties)
true if this type requires no storage. false if its size is greater than zero. Read more
source§

impl<T> SpecOptionPartialEq for T
where T: PartialEq,

source§

default fn eq(l: &Option<T>, r: &Option<T>) -> bool

🔬This is a nightly-only experimental API. (spec_option_partial_eq)
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> Printable for T
where T: Copy + Debug,