Struct mycelium_kernel::rt::Core

source ·
pub struct Core {
    scheduler: &'static StaticScheduler,
    id: usize,
    running: AtomicBool,
    rng: Xoroshiro128PlusPlus,
}
Expand description

A kernel runtime for a single core.

Fields§

§scheduler: &'static StaticScheduler

The task scheduler for this core.

§id: usize

This core’s ID.

ID 0 is the first CPU core started when the system boots.

§running: AtomicBool

Set to false if this core should shut down.

§rng: Xoroshiro128PlusPlus

Used to select the index of the next core to steal work from.

Selecting a random core index when work-stealing helps ensure we don’t have a situation where all idle steal from the first available worker, resulting in other cores ending up with huge queues of idle tasks while the first core’s queue is always empty.

This is not a cryptographically secure random number generator, since randomness of this value is not required for security. Instead, it just helps ensure a good distribution of load. Therefore, we use a fast, non-cryptographic RNG.

Implementations§

Runs one tick of the kernel main loop on this core.

Returns true if this core has more work to do, or false if it does not.

Returns true if this core is currently running.

Stops this core if it is currently running.

Returns
  • true if this core was running and is now stopping
  • false if this core was not running.

Run this core until Core::stop is called.

Trait Implementations§

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Casts the value.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Casts the value.
Casts the value.
Casts the value.
Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait. Read more
Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait. Read more
Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s. Read more
Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s. Read more
Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait. Read more

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Casts the value.
Casts the value.
Casts the value.
Casts the value.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Casts the value.
Casts the value.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Casts the value.
Casts the value.