feat: Aurora Neural OS v2.6 x86_64 microkernel, white theme GUI, and page replacement research
d097788 verified Download CA6_Rust_Micro_OS_Project/src/kernel.rs from vedraj1309/oslab: direct link, hf CLI and curl.
- Browser
- Download file 1.08 kB
-
https://huggingface.co/datasets/vedraj1309/oslab/resolve/main/CA6_Rust_Micro_OS_Project/src/kernel.rs
- Command line
-
hf download hf://datasets/vedraj1309/oslab/CA6_Rust_Micro_OS_Project/src/kernel.rs
-
curl -L -o kernel.rs https://huggingface.co/datasets/vedraj1309/oslab/resolve/main/CA6_Rust_Micro_OS_Project/src/kernel.rs
1.08 kB
| use crate::memory::BumpAllocator; | |
| use crate::scheduler::RoundRobinScheduler; | |
| use crate::sync::SpinLock; | |
| use crate::task::Task; | |
| use crate::timer::Timer; | |
| pub struct Kernel { | |
| pub scheduler: RoundRobinScheduler, | |
| pub timer: Timer, | |
| pub allocator: BumpAllocator, | |
| shared_counter: SpinLock<usize>, | |
| } | |
| impl Kernel { | |
| pub fn new() -> Self { | |
| Self { | |
| scheduler: RoundRobinScheduler::new(), | |
| timer: Timer::new(1), | |
| allocator: BumpAllocator::new(1024), | |
| shared_counter: SpinLock::new(0), | |
| } | |
| } | |
| pub fn create_task(&mut self, id: usize, name: &'static str, steps: usize) { | |
| self.scheduler.add_task(Task::new(id, name, steps)); | |
| } | |
| pub fn increment_shared_counter(&self) -> usize { | |
| let mut counter = self.shared_counter.lock(); | |
| *counter += 1; | |
| *counter | |
| } | |
| pub fn shared_counter(&self) -> usize { | |
| *self.shared_counter.lock() | |
| } | |
| } | |
| impl Default for Kernel { | |
| fn default() -> Self { | |
| Self::new() | |
| } | |
| } | |