tailieunhanh - Linux Device Drivers-Chapter 6 : Flow of Time

Tham khảo tài liệu 'linux device drivers-chapter 6 : flow of time', công nghệ thông tin, hệ điều hành phục vụ nhu cầu học tập, nghiên cứu và làm việc hiệu quả | Chapter 6 Flow of Time At this point we know the basics of how to write a full-featured char module. Real-world drivers however need to do more than implement the necessary operations they have to deal with issues such as timing memory management hardware access and more. Fortunately the kernel makes a number of facilities available to ease the task of the driver writer. In the next few chapters we ll fill in information on some of the kernel resources that are available starting with how timing issues are addressed. Dealing with time involves the following in order of increasing complexity Understanding kernel timing Knowing the current time Delaying operation for a specified amount of time Scheduling asynchronous functions to happen after a specified time lapse Time Intervals in the Kernel The first point we need to cover is the timer interrupt which is the mechanism the kernel uses to keep track of time intervals. Interrupts are asynchronous events that are usually fired by external hardware the CPU is interrupted in its current activity and executes special code the Interrupt Service Routine or ISR to serve the interrupt. Interrupts and ISR implementation issues are covered in Chapter 9 Interrupt Handling . Timer interrupts are generated by the system s timing hardware at regular intervals this interval is set by the kernel according to the value of HZ which is an architecture-dependent value defined in linux . Current Linux versions define HZ to be 100 for most platforms but some platforms use 1024 and the IA-64 simulator uses 20. Despite what your preferred platform uses no driver writer should count on any specific value of HZ. Every time a timer interrupt occurs the value of the variable jiffies is incremented. jiffies is initialized to 0 when the system boots and is thus the number of clock ticks since the computer was turned on. It is declared in linux as unsigned long volatile and will possibly overflow after a long time of continuous .

TỪ KHÓA LIÊN QUAN
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.