tailieunhanh - Kernel timing issues: An introduction to the use of kernel timers and work queues

Kernel timing issues: An introduction to the use of kernel timers and work queues includes Kernel timing issues, Kernel timers, jiffies, jiffies overflow, Kernel timer syntax, A kernel-timer caution, Programming syntax. | Kernel timing issues An introduction to the use of kernel timers and work queues Kernel timers • Linux offers a facility that lets drivers put a process to sleep until a fixed amount of time has elapsed (as measured in jiffies) • When the timer expires, a driver-defined action will be performed, which can ‘wake up’ the process that was put to sleep, or could perform some alternative action (for example, the kernel timer could re-start) jiffies • • • • • • • unsigned long volatile jiffies; global kernel variable (used by scheduler) initialized to zero when system reboots gets incremented during a timer interrupt so it counts ‘clock-ticks’ since cpu restart ‘tick-frequency’ is a ‘configuration’ option On our machines: HZ=250 (in ‘.config’) jiffies overflow • Won’t overflow for at least 16 months • Linux kernel got modified to ‘fix’ overflow • Now the declaration is in ‘linux/’: unsigned long long jiffies_64; and a new instruction in ‘do_timer()’ (*(u64*)&jiffies_64)++; which compiles to assembly language as add $1, jiffies+0 adc $0, jiffies+4 Kernel timer syntax • Declare a timer: struct timer_list mytimer; • Initialize this timer: init_timer( &mytimer ); = mytimeraction; = (unsigned long)mydata; = • Install this timer: add_timer( &mytimer ); • Modify this timer: mod_timer( &mytimer, ); • Delete this timer: del_timer( &mytimer ); • Delete it safely: del_timer_sync( .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.