Rev 85 | Rev 131 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 85 | Rev 127 | ||
---|---|---|---|
Line 82... | Line 82... | ||
82 | <title>Timeouts</title> |
82 | <title>Timeouts</title> |
83 | 83 | ||
84 | <para>Kernel subsystems can register a callback function to be executed |
84 | <para>Kernel subsystems can register a callback function to be executed |
85 | with a specified delay. Such a registration is represented by a kernel |
85 | with a specified delay. Such a registration is represented by a kernel |
86 | structure called <classname>timeout</classname>. Timeouts are registered |
86 | structure called <classname>timeout</classname>. Timeouts are registered |
87 | via <code>timeout_register</code> function. This function takes a pointer |
87 | via <code>timeout_register()</code> function. This function takes a pointer |
88 | to a timeout structure, a callback function, a parameter of the callback |
88 | to a timeout structure, a callback function, a parameter of the callback |
89 | function and a delay in microseconds as parameters. After the structure is |
89 | function and a delay in microseconds as parameters. After the structure is |
90 | initialized with all these values, it is sorted into the processor's list |
90 | initialized with all these values, it is sorted into the processor's list |
91 | of active timeouts, according to the number of clock interrupts remaining |
91 | of active timeouts, according to the number of clock interrupts remaining |
92 | to their expiration and relatively to already listed timeouts.</para> |
92 | to their expiration and relatively to already listed timeouts.</para> |
93 | 93 | ||
94 | <para>Timeouts can be unregistered via <code>timeout_unregister</code>. |
94 | <para>Timeouts can be unregistered via <code>timeout_unregister()</code>. |
95 | This function can, as opposed to <code>timeout_register</code>, fail when |
95 | This function can, as opposed to <code>timeout_register()</code>, fail when |
96 | it is too late to remove the timeout from the list of active |
96 | it is too late to remove the timeout from the list of active |
97 | timeouts.</para> |
97 | timeouts.</para> |
98 | 98 | ||
99 | <para>Timeouts are nearing their expiration in the list of active timeouts |
99 | <para>Timeouts are nearing their expiration in the list of active timeouts |
100 | which exists on every processor in the system. The expiration counters are |
100 | which exists on every processor in the system. The expiration counters are |
Line 109... | Line 109... | ||
109 | <section> |
109 | <section> |
110 | <title>Generic clock interrupt handler</title> |
110 | <title>Generic clock interrupt handler</title> |
111 | 111 | ||
112 | <para>On each clock interrupt, the architecture specific part of the clock |
112 | <para>On each clock interrupt, the architecture specific part of the clock |
113 | interrupt handler makes a call to the generic clock interrupt handler |
113 | interrupt handler makes a call to the generic clock interrupt handler |
114 | implemented by the <code>clock</code> function. The generic handler takes |
114 | implemented by the <code>clock()</code> function. The generic handler takes |
115 | care of several mission critical goals:</para> |
115 | care of several mission critical goals:</para> |
116 | 116 | ||
117 | <itemizedlist> |
117 | <itemizedlist> |
118 | <listitem> |
118 | <listitem> |
119 | <para>expiration of timeouts,</para> |
119 | <para>expiration of timeouts,</para> |
Line 126... | Line 126... | ||
126 | <listitem> |
126 | <listitem> |
127 | <para>preemption of threads.</para> |
127 | <para>preemption of threads.</para> |
128 | </listitem> |
128 | </listitem> |
129 | </itemizedlist> |
129 | </itemizedlist> |
130 | 130 | ||
131 | <para>The <code>clock</code> function checks for expired timeouts and |
131 | <para>The <code>clock()</code> function checks for expired timeouts and |
132 | decrements unexpired timeout expiration counters exactly one more times |
132 | decrements unexpired timeout expiration counters exactly one more times |
133 | than is the number of missed clock signals (i.e. at least once and |
133 | than is the number of missed clock signals (i.e. at least once and |
134 | possibly more times, depending on the missed clock signals counter). The |
134 | possibly more times, depending on the missed clock signals counter). The |
135 | time of the day counters are also updated one more times than is the |
135 | time of the day counters are also updated one more times than is the |
136 | number of missed clock signals. And finally, the remaining timeslice of |
136 | number of missed clock signals. And finally, the remaining timeslice of |