Commit 098311a
committed
Refactor the large `task` crate into two crates:
1. `task_struct`: the basic `Task` type that contains only
core states related to a task, e.g., task ID, name, runstate,
saved register context, TLS data area, etc.
2. `task`: the higher-level `TaskRef` type, a shareable reference
to a `Task`, and its derivatives like `JoinableTaskRef`.
This crate also includes the system task list, kill handlers,
task switching functions, and current task getters.
Why? Upcoming changes like theseus-os#774, theseus-os#809, theseus-os#820, and theseus-os#821
necessitate some refactoring to avoid cyclic dependencies
between `task`, `scheduler`, `runqueue*`, etc.
* The joinability of a task is moved from `Task` into
`TaskRef`, since a task doesn't care about joinability until
it is made into a `TaskRef`, which is actually usable
and schedulable. Similarly, only a `TaskRef` can be added
to the system task list, not a bare `Task`.
* We expose access to private `Task` fields via a new type
`ExposedTask`, which only the `task` crate can instantiate
in a useful way.
* Add a new `WeakTaskRef` type that is a weak reference
to a `TaskRef`, and use this for anything related to
debugging or printing task info, e.g., in `task_fs`, `ps`, etc.
* Make the global system task list private and expose
access to it via the new `WeakTaskRef` type.
This prevents callers from holding the lock around
the system task list, which would prevent others from
spawning new tasks or cleaning up exited tasks.
* Reduce the `Task` constructor to a single method
that accepts a new `InheritedStates` enum, allowing the
initial contextual states for a new task to come from
either an existing task or a custom set of states.
These states include the task's `Environment`, namespace,
memory mgmt info, and application crate reference.
* The `FailureCleanupFunction` is now passed into the
`TaskRef` constructor rather than the `Task` constructor,
as its signature includes a `TaskRef`-based type. 6ef4e11
1 parent fff5cb5 commit 098311a
File tree
226 files changed
+5982
-3127
lines changed- book
- subsystems
- doc
- ap_start
- apic
- captain
- crate_metadata
- dreadnought/future
- e1000
- early_tls
- ethernet_smoltcp_device
- idle
- arch/x86_64
- implementors
- core
- clone
- cmp
- convert
- default
- fmt
- hash
- marker
- ops
- deref
- drop
- panic/unwind_safe
- stable_deref_trait
- interrupts
- irq_safety
- held_interrupts
- mutex_irqsafe
- rwlock_irqsafe
- ixgbe
- logger_x86_64
- memory
- mlx5
- mod_mgmt
- parse_nano_core
- nano_core
- net
- runqueue_priority
- runqueue_realtime
- runqueue_round_robin
- serial_port
- spawn
- src
- ap_start
- captain
- crate_metadata
- early_tls
- fault_crate_swap
- idle
- arch
- x86_64
- interrupts
- irq_safety
- mod_mgmt
- nano_core
- spawn
- task_fs
- task_struct
- task
- tls_initializer
- unwind
- vga_buffer
- stack_trace
- task_fs
- task_struct
- task
- tlb_shootdown
- tls_initializer
- unwind
- vga_buffer
- virtual_nic
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
226 files changed
+5982
-3127
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1180 | 1180 | | |
1181 | 1181 | | |
1182 | 1182 | | |
1183 | | - | |
| 1183 | + | |
1184 | 1184 | | |
1185 | 1185 | | |
1186 | 1186 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
234 | 234 | | |
235 | 235 | | |
236 | 236 | | |
237 | | - | |
| 237 | + | |
238 | 238 | | |
239 | 239 | | |
240 | 240 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
0 commit comments