-
-
Notifications
You must be signed in to change notification settings - Fork 779
kernel: move schedulers to capsules #4640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The implementations are not relevant for tock/rust memory safety.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is really great!
I'm not convinced it makes sense to have these type declarations in the components, rather than basically expand the type declaration in each board.
Either way the name SchedulerObj
is wrong.
Otherwise looks good to me.
64, | ||
>; | ||
|
||
type SchedulerObj = components::sched::round_robin::RoundRobinComponentType; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bike-shedding the name for this:
- It's not an object. Arguably Rust doesn't have objects at all, and this is certainly is not one.
SchedulerType
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Obviously, this would apply to all the boards and is hopefully just sed -i 's/type SchedulerObj/type SchedulerType/' boards/**/main.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like "Type" because everything is a type.
Here is what has emerged so far:
Hw
: For types which are the specific hardware for a resource/hil. Example:type AlarmHw = nrf52840::nrf5x::rtc
.Driver
: For types which are syscall drivers. Example:type AlarmDriver = capsules_core::alarm::Alarm
.
I think for both of those, type would be suitable, ie AlarmType
and then AlarmType
again.
I think we would benefit from a class that has a generic feel. Any ideas other than "type"? I used obj only because it was something to use and easy to replace later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps something that helps with the semantic implications here, SchedulerChosen
(SchedulerUsed
, SchedulerSelected
, ...)? i.e., you pass the scheduler you chose (in the same way that you pass the HW
you instantiate) to generic Scheduler
interfaces?
We haven't used travis for nearly a decade 😛 |
Feels like just yesterday. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me (pending the name bikeshed)
.find(|proc| proc.ready()) | ||
.is_some_and(|ready_proc| { | ||
self.running.map_or(false, |running| { | ||
ready_proc.processid().index < running.index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's worth flagging here that switching from using processid()
to enumerate()
actually fixes a potential correctness issue since the priority scheduler claims to prioritize based on process slot order, but the default process id implementation might not preserve the invariant of processid order matching slot order in the face of dynamic processes.
Pull Request Overview
This pull request moves the schedulers to capsules. This ends up being a bit more involved for two reasons:
iter.enumerate()
instead of the ProcessId.index as the priority.Testing Strategy
travis
TODO or Help Wanted
Blocked on the PR to remove unsafe from the scheduler trait.
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.