Commit be2611b
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 713d297 commit be2611b
File tree
562 files changed
+3696
-8968
lines changed- doc
- ap_start
- apic
- async_channel
- boot_info
- multiboot2
- captain
- cpu
- arch
- crate_metadata_serde
- crate_metadata
- crate_swap
- dfqueue
- dreadnought
- future
- early_printer
- exceptions_full
- fault_crate_swap
- fault_log
- framebuffer
- gdt
- gic
- gic
- qemu_virt_addrs
- qemu_virt_addrs
- implementors
- core
- clone
- cmp
- convert
- fmt
- hash
- iter/traits/collect
- marker
- ops
- arith
- bit
- drop
- panic/unwind_safe
- num_enum
- zerocopy
- interrupts
- arch
- ioapic
- kernel_config/display
- keyboard
- libterm
- madt
- memory_aarch64
- memory_initialization
- memory_structs
- memory_x86_64
- memory
- mod_mgmt
- parse_nano_core
- mouse
- multicore_bringup
- arch
- multiple_heaps
- nano_core
- page_attribute_table
- panic_entry
- pause
- pmu_x86
- preemption
- ps2
- rendezvous
- runqueue_priority
- runqueue_realtime
- runqueue_round_robin
- scheduler
- sleep
- future
- spawn
- src
- acpi_table
- ap_start
- apic
- async_channel
- boot_info
- captain
- cpu
- crate_metadata_serde
- crate_metadata
- crate_swap
- dfqueue
- dreadnought
- early_printer
- exceptions_early
- exceptions_full
- fault_crate_swap
- fault_log
- font
- frame_allocator
- framebuffer
- gdt
- gic
- gic
- interrupts
- ioapic
- kernel_config
- keyboard
- libterm
- madt
- memory_aarch64
- memory_initialization
- memory_structs
- memory_x86_64
- memory
- paging
- mod_mgmt
- mouse
- multicore_bringup
- multiple_heaps
- nano_core
- panic_entry
- pause
- pmu_x86
- preemption
- ps2
- rendezvous
- runqueue_round_robin
- scheduler_priority
- scheduler
- serial_port
- simd_personality
- sleep
- spawn
- task_fs
- task_struct
- task
- tlb_shootdown
- tls_initializer
- tss
- unwind
- vga_buffer
- waker_generic
- waker
- window
- task_struct
- task
- scheduler
- tls_current_task
- tlb_shootdown
- tls_initializer
- tss
- unwind
- vga_buffer
- waker_generic
- waker
- window
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
562 files changed
+3696
-8968
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
0 commit comments