<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <HTML ><HEAD ><TITLE >Hardware Interrupts (Hard IRQs)</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Unreliable Guide To Hacking The Linux Kernel" HREF="book1.html"><LINK REL="UP" TITLE="The Players" HREF="c26.html"><LINK REL="PREVIOUS" TITLE="The Players" HREF="c26.html"><LINK REL="NEXT" TITLE="Software Interrupt Context: Bottom Halves, Tasklets, softirqs" HREF="x64.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Unreliable Guide To Hacking The Linux Kernel</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="c26.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >The Players</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="x64.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="BASICS-HARDIRQS" ></A >Hardware Interrupts (Hard IRQs)</H1 ><P > Timer ticks, <TT CLASS="HARDWARE" ><B >network cards</B ></TT > and <TT CLASS="HARDWARE" ><B >keyboard</B ></TT > are examples of real hardware which produce interrupts at any time. The kernel runs interrupt handlers, which services the hardware. The kernel guarantees that this handler is never re-entered: if another interrupt arrives, it is queued (or dropped). Because it disables interrupts, this handler has to be fast: frequently it simply acknowledges the interrupt, marks a `software interrupt' for execution and exits. </P ><P > You can tell you are in a hardware interrupt, because <TT CLASS="FUNCTION" >in_irq()</TT > returns <SPAN CLASS="RETURNVALUE" >true</SPAN >. </P ><DIV CLASS="CAUTION" ><P ></P ><TABLE CLASS="CAUTION" WIDTH="100%" BORDER="0" ><TR ><TD WIDTH="25" ALIGN="CENTER" VALIGN="TOP" ><IMG SRC="./stylesheet-images/caution.gif" HSPACE="5" ALT="Caution"></TD ><TD ALIGN="LEFT" VALIGN="TOP" ><P > Beware that this will return a false positive if interrupts are disabled (see below). </P ></TD ></TR ></TABLE ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="c26.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="x64.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >The Players</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c26.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Software Interrupt Context: Bottom Halves, Tasklets, softirqs</TD ></TR ></TABLE ></DIV ></BODY ></HTML >