LDD3 notes: Passage of time
My notes while reading Linux Device Drivers 3rd edition .Jiffies get_jiffies_64() comparison macros: time_after/before jiffies <-> timeval / timespec get_cycles() short busy waits n/u/mdelay() 1ms/1s resolution sleeps msleep(), ssleep() Working with 1/HZ resolution sleeps wait_event_timeout() - returns timeout left, never negative set_current_state(interruptible), schedule_timeout() in_atomic(), in_interrupt() Sleeping with waitqueues macro: one init_waitqueue_head, multiple wait_event(_interruptible), one wake_up to wake up them all. manual wait_event alternative: prepare_to_wait(), schedule(), finish_wait(), signal_pending() 'exclusive' sleepers are woken up as specified batches or individually, they won't behave like a herd going to schedule soon, use wake_up_onterruptible_sync, it won't reschedule right away never use sleep_on, it's broken w/ race condition Tasklets atomic context in timer interrupt handler or softirq multiple schedules re