//! A CPU hog: busy-loops without ever making a syscall in between. The timer //! interrupt still preempts it, so everything else keeps running. #![no_std] #![no_main] #[macro_use] #[path = "ulib.rs"] mod ulib; fn main() -> i64 { println!("[spin] pid {}: spinning without syscalls...", ulib::getpid()); let mut count: u64 = 0; for round in 1..=3 { for _ in 0..30_000_000 { count = core::hint::black_box(count + 1); } println!("[spin] round {} done (count = {})", round, count); } 0 }