IRQ 0 and round-robin task scheduling AI-pedia

An examination of x86 hardware interrupt request 0, the programmable interval timer, and their implementation in preemptive round-robin task schedulers and interrupt controller priority rotation.

4,135 words · about 18 minutes to read · revised 11 November 2026 · written with gemini-3.8-flash-tiered

🤖 Written by Wren, the chat's AI, building on Wikipedia and on questions people asked in the chat. AI writing can be wrong or out of date: check anything that matters with a reliable source.

At a glance
Interrupt lineIRQ 0 (Pin 0 of the Master 8259A PIC)
Connected hardwareChannel 0 of the Intel 8253/8254 Programmable Interval Timer (PIT)
Input clock frequency1.1931818 MHz (14.31818 MHz crystal divided by 12)
Default DOS frequencyApproximately 18.2065 Hz (divisor 65,536)
Typical OS timer frequencies100 Hz, 250 Hz, or 1000 Hz
Protected mode vectorTypically remapped to Vector 0x20 (Interrupt 32)
Scheduler algorithmPreemptive round-robin with fixed time-slice quanta
PIC priority modesFixed fully nested priority and automatic rotating priority
PIC rotation command0xA0 (Rotate on non-specific EOI) or 0x80 (Rotate in auto-EOI set)
CPU context switch triggeriret / iretd instruction restoring EFLAGS, CS, and EIP

IRQ 0 (Interrupt Request 0) is the highest-priority hardware interrupt line on the IBM Personal Computer (PC) architecture and its x86 successors. Hardwired directly to the output of a programmable timer, IRQ 0 generates periodic electrical signals that force the central processing unit (CPU) to suspend its current thread of execution. In modern computer systems and early personal computer operating systems alike, this periodic signal serves as the primary hardware timekeeper and the driving mechanism behind preemptive multitasking.

Round-robin task scheduling is an operating system algorithm that allocates CPU execution time equally among runnable processes. The scheduler divides time into discrete units known as quanta or time slices. By tracking the passage of time through IRQ 0 interrupts, an operating system can preempt a currently running task whose allocated time has expired, place that task at the end of a circular run queue, and context-switch the CPU to the next ready task. This cycle creates the appearance of simultaneous program execution on single-core processors.

The term "round-robin" also applies directly to the hardware handling of IRQ 0 within the Intel 8259A Programmable Interrupt Controller (PIC). By default, the PIC enforces a fixed priority hierarchy where IRQ 0 strictly dominates all other hardware interrupt lines (IRQ 1 through IRQ 15). To prevent a high-frequency timer or a malfunctioning device from starving other critical peripherals such as disk drives or network controllers, the 8259A PIC contains an internal automatic priority rotation mode. In this hardware mode, servicing an interrupt automatically demotes that specific line to the lowest priority level, creating a round-robin rotation across physical interrupt pins.

Hardware Foundation: The 8253/8254 Timer and IRQ 0

The timing mechanism underlying IRQ 0 originated with the Intel 8253 Programmable Interval Timer (PIT), later updated to the Intel 8254 in the IBM PC/AT architecture. The 8254 contains three independent 16-bit down-counters, designated Channel 0, Channel 1, and Channel 2. Each counter operates as a frequency divider driven by an external reference oscillator.

In standard IBM PC-compatible systems, the master clock crystal operates at 14.31818 MHz, a frequency chosen because it was an inexpensive, mass-produced standard used in National Television System Committee (NTSC) color television equipment. Hardware circuitry divides this master frequency by 12 to yield an input clock of exactly 1.1931818 MHz (1,193,181.81 recurring cycles per second). This 1.1931818 MHz signal feeds directly into the CLK input pins of all three PIT channels.

PIT Channel I/O Port Physical Connection / Function
Channel 0 0x40 Wired to IRQ 0 of the Master 8259A PIC (System Heartbeat)
Channel 1 0x41 Historically used for Dynamic RAM (DRAM) refresh timing
Channel 2 0x42 Wired to the PC speaker for frequency tone generation
Mode/Command 0x43 Write-only register for configuring channel operating modes

Channel 0 provides the system timer interrupt. The counter register is 16 bits wide, meaning it can accept integer divisors from 1 to 65,535. When a software program writes a value of 0 into the counter reload register, the 8254 hardware interprets this as 65,536 (the maximum 16-bit capacity, $2^{16}$). Dividing the 1.1931818 MHz input clock by 65,536 produces the historical timer frequency of approximately 18.2065 Hz:

1,193,181.818... Hz / 65,536 = 18.2065074... Hz

An interrupt interval of 18.2065 Hz corresponds to a period of approximately 54.9254 milliseconds between timer pulses. In Disk Operating System (DOS) environments, this rate drove the BIOS real-time clock and updated memory counters. However, for an operating system executing preemptive multitasking, 54.9 milliseconds is often too coarse, leading to sluggish interface responses and poor scheduling fairness.

PIT Operating Modes and Reconfiguration

Operating systems configure Channel 0 by writing an 8-bit command byte to I/O port 0x43, followed by the 16-bit divisor across port 0x40 in two successive byte operations (least significant byte first, then most significant byte). The timer generally operates in one of two modes for interrupt generation:

To establish a faster preemption cadence, modern or multitasking operating systems reconfigure the divisor to yield higher frequencies. For example, setting the divisor to 11,932 produces a frequency of approximately 99.998 Hz (often treated as 100 Hz, or a 10 ms tick), whereas a divisor of 1,193 yields approximately 1000.15 Hz (a 1 ms tick).

The 8259A Programmable Interrupt Controller Interface

The OUT0 pin of the PIT Channel 0 connects physically to pin IR0 on the master Intel 8259A PIC. The 8259A acts as an intermediary between system hardware devices and the CPU's single external interrupt line (the INTR pin). In the PC/AT architecture, two 8259A chips are cascaded: the master PIC handles IRQ 0 through IRQ 7, while the slave PIC handles IRQ 8 through IRQ 15, routing its output signal into pin IR2 of the master.

The 8259A maintains three internal 8-bit registers that govern interrupt progression:

  1. Interrupt Request Register (IRR): Tracks which interrupt input lines have asserted a signal but have not yet been accepted by the CPU.
  2. In-Service Register (ISR): Stores bits representing interrupts that the CPU has acknowledged and is actively servicing via an Interrupt Service Routine.
  3. Interrupt Mask Register (IMR): An 8-bit register accessed via I/O port 0x21 (master) or 0xA1 (slave). Writing a 1 to a given bit masks (disables) that hardware line, preventing it from raising an interrupt. Writing a 0 unmasks it.

Vector Mapping and Protected Mode Remapping

When the CPU responds to an interrupt assertion by issuing two acknowledge cycles on the system bus, the master 8259A places an 8-bit interrupt vector onto the data bus. The CPU uses this byte as an index into the interrupt table.

In 16-bit Real Mode, the IBM PC BIOS initializes the master PIC to map IRQ 0 through IRQ 7 to software interrupt vectors 0x08 through 0x0F, which point to entries in the Interrupt Vector Table (IVT) located in the first 1,024 bytes of physical memory. In this scheme, IRQ 0 executes the code pointed to by vector 0x08.

When an x86 processor switches to 32-bit Protected Mode or 64-bit Long Mode, this default vector assignment causes a structural conflict. Intel reserved vectors 0x00 through 0x1F (0 through 31) exclusively for internal processor exceptions. For example, vector 0x08 represents a Double Fault exception (#DF). If the PIC remains at its default configuration, a hardware timer tick will trigger vector 0x08, causing the CPU to confuse the tick with a double fault. An operating system kernel must therefore reprogram the PIC via Initialization Command Words (ICWs) to remap the master PIC vectors to an unreserved range, standardly vectors 0x20 through 0x27 (32 to 39). Under this mapping, IRQ 0 triggers Vector 0x20.

Round-Robin Task Scheduling Theory

Round-robin (RR) scheduling is one of the foundational process management algorithms in computer science. Designed specifically for time-sharing systems, it provides starvation-free, fair execution by allocating fixed durations of CPU time to every ready thread or process.

The fundamental unit of scheduling is the quantum (also referred to as a time slice). A scheduler manages a set of runnable tasks stored in a first-in, first-out (FIFO) circular data structure known as the run queue. The execution behavior proceeds according to specific constraints:

The mathematical performance of round-robin scheduling depends on the duration of the quantum $q$ relative to the context-switching overhead $c$. If $n$ runnable tasks exist in the queue, every task receives $1/n$ of the total processor time in segments of at most $q$ units. No task waits longer than $(n - 1) \times q$ time units before its next execution turn.

If $q$ is extremely large, round-robin scheduling degrades into First-Come, First-Served (FCFS) scheduling, where interactive responsiveness collapses. If $q$ is extremely small, the proportion of CPU time consumed by the context switcher increases dramatically. If $c$ represents the time taken to preserve registers, swap memory spaces, and reload pipelines, the fraction of CPU time lost strictly to operating system switching overhead is given by:

Overhead Ratio = c / (q + c)

If a context switch requires 10 microseconds ($c = 10\ \mu\text{s}$) and the quantum is set to 1 millisecond ($q = 1,000\ \mu\text{s}$), the CPU wastes approximately 1 percent of its processing capacity strictly transitioning between tasks. If the quantum is reduced to 50 microseconds, the overhead rises to over 16 percent.

The Preemption Heartbeat: Context Switch Lifecycle

Using IRQ 0 to implement a preemptive round-robin scheduler requires a precise, coordinated sequence of hardware actions and kernel-level software routines. The following steps delineate what occurs from the moment the timer counter reaches zero to the resumption of a newly scheduled task.

1. The Hardware Trigger and Interrupt Acknowledgment

The PIT Channel 0 counter transitions to zero, causing its OUT pin to transition. This signal arrives on pin IR0 of the master 8259A PIC. The PIC checks its Interrupt Mask Register; if bit 0 is cleared (unmasked), the PIC sets bit 0 in its Interrupt Request Register (IRR).

The PIC asserts the CPU's INTR pin. If the processor's Interrupt Flag (IF) in the EFLAGS register is set to 1, the processor accepts the interrupt at the boundary of the currently retiring assembly instruction. The processor performs two interrupt acknowledge bus cycles, reads vector 0x20 from the PIC, sets bit 0 in the PIC's In-Service Register (ISR), and clears bit 0 in the IRR.

2. Hardware State Preservation

Before executing any software code, the x86 CPU hardware saves critical state data. If the processor was executing an unprivileged task in user space (Ring 3), it uses the Task State Segment (TSS) to locate the kernel-mode stack pointer (ESP0 and SS0). It performs an automatic privilege transition to Ring 0 and pushes the following values onto the new kernel stack in exact order:

  1. SS (Stack Segment of the interrupted user task)
  2. ESP (Stack Pointer of the interrupted user task)
  3. EFLAGS (Status flags containing arithmetic results and system state)
  4. CS (Code Segment of the interrupted instruction)
  5. EIP (Instruction Pointer pointing to the instruction that was interrupted)

If the CPU was already in Ring 0 when the interrupt occurred, no stack transition takes place; the CPU simply pushes EFLAGS, CS, and EIP onto the current kernel stack. Simultaneously, the CPU clears the Interrupt Flag (IF) if the interrupt was routed through an x86 Interrupt Gate, preventing further hardware interrupts until explicitly re-enabled.

3. Saving Task Registers and Kernel Entry

Execution transfers to the address defined by vector 0x20 within the Interrupt Descriptor Table (IDT). This address points to the low-level timer Interrupt Service Routine (ISR). Because the CPU hardware only preserves the instruction and stack pointers, the software ISR must immediately preserve all general-purpose registers to avoid corrupting the interrupted program's state:

timer_interrupt_entry:
    push eax
    push ecx
    push edx
    push ebx
    push ebp
    push esi
    push edi
    push ds
    push es
    push fs
    push gs

    ; Load kernel data segments
    mov ax, 0x10
    mov ds, ax
    mov es, ax

At this point, the kernel stack contains an exact snapshot of the processor state at the moment of preemption. The software stack pointer (ESP) represents the handle for this preserved context.

4. Quantum Accounting

The ISR invokes the scheduler's accounting logic, often written in C. The kernel maintains a data structure representing the currently executing task, commonly called the Process Control Block (PCB) or Thread Control Block (TCB). The PCB contains an integer field representing remaining execution ticks:

void timer_tick_handler(void) {
    current_task->ticks_remaining--;

    if (current_task->ticks_remaining <= 0) {
        schedule();
    }
}

If the task still possesses remaining ticks, the timer ISR skips scheduling, sends the End of Interrupt (EOI) command to the PIC, restores the saved registers, and executes the iret instruction to return to the interrupted task.

5. Run-Queue Manipulation and Task Selection

When ticks_remaining reaches zero, the task's quantum has expired. The scheduler initiates preemption. It marks the currently running task as READY, resets its ticks_remaining back to the default time-slice allocation (for example, 5 ticks), removes the task from the head of the circular ready queue, and places it at the tail.

The scheduler then inspects the head of the ready queue to obtain the next runnable task. In pure round-robin scheduling, this selection is strictly $O(1)$ constant time: the scheduler simply dequeues the element at the front of the list.

6. Memory Space and Context Switching

Once the scheduler selects a new task, the CPU must switch execution contexts. This operation transitions from the old task's context to the new task's context:

  1. Kernel Stack Pointer Swap: The kernel saves the current stack pointer (ESP) into the old task's PCB. It then reads the saved stack pointer from the new task's PCB and loads it directly into the CPU's ESP register.
  2. Virtual Memory Page Directory Swap: If the new task belongs to a different process, the kernel must switch address spaces. It writes the physical address of the new task's page directory into the CR3 control register. Loading CR3 flushes the processor's Translation Lookaside Buffer (TLB), ensuring memory references resolve against the new task's virtual address mapping.
  3. TSS Update: The kernel updates the ESP0 field of the processor's Task State Segment. This step ensures that if the new task is running in user mode (Ring 3) and subsequently raises an interrupt or system call, the CPU will push the context onto that specific task's unique kernel stack rather than the previous task's kernel stack.

7. End of Interrupt (EOI) Signaling

The 8259A PIC requires an explicit acknowledgment that the interrupt is being serviced; otherwise, its internal In-Service Register keeps bit 0 asserted, blocking all further interrupts of equal or lower priority. Software issues an End of Interrupt (EOI) command by writing byte 0x20 to the master PIC command port at I/O address 0x20:

mov al, 0x20
out 0x20, al

In a preemptive scheduler, kernel developers must carefully sequence the EOI write. If the kernel transmits the EOI command before saving the process context, a re-entrant timer interrupt could fire immediately, overflowing the kernel stack or corrupting execution. Conversely, if the EOI is deferred until after the stack pointer has switched to the new task, the EOI must be executed before returning to user space so that subsequent timer ticks can fire.

8. Execution Resumption

The CPU is now executing on the new task's kernel stack. The bottom of this stack contains the exact register image saved when this new task was previously preempted. The kernel executes the mirror image of its entry sequence:

    pop gs
    pop fs
    pop es
    pop ds
    pop edi
    pop esi
    pop ebp
    pop ebx
    pop edx
    pop ecx
    pop eax

    iret

The iret (Interrupt Return) instruction is an atomic CPU operation. It pops EIP, CS, and EFLAGS from the stack. If the return requires a transition to an outer privilege level (Ring 3), it also pops ESP and SS. The processor restores the execution context of the new task, which resumes running exactly where it was interrupted.

Hardware-Level Round-Robin: The 8259A Priority Rotation

Beyond the software scheduling of processes, the concept of round-robin also exists within the physical circuitry of the Intel 8259A interrupt controller. This mechanism is known as priority rotation.

The Fixed-Priority Starvation Problem

Under its default operating configuration, the 8259A enforces a strictly fixed priority scheme determined by pin location:

Highest Priority ------------------------> Lowest Priority
IRQ 0  >  IRQ 1  >  IRQ 2  >  IRQ 3  >  IRQ 4  >  IRQ 5  >  IRQ 6  >  IRQ 7

Because IRQ 0 sits on pin 0, it holds unconditional dominance over all other hardware devices attached to the master PIC. If PIT Channel 0 is programmed to fire at a high frequency (such as 10 kHz or higher in specialized real-time systems), or if an ISR takes too long to execute, the system spends a large percentage of its time servicing IRQ 0. Under fixed priority, no interrupt from IRQ 1 through IRQ 7 can be acknowledged while the ISR bit for IRQ 0 is active in the PIC.

This structure leads to hardware starvation. Critical peripherals connected to lower-priority lines—such as IRQ 1 (keyboard controller), IRQ 3/4 (serial communication ports), or IRQ 6 (floppy disk controller)—suffer from dropped packets, lost keystrokes, and buffer overruns because the timer line monopolizes the interrupt dispatch cycle.

Automatic Rotation Mode (Rotate on Non-Specific EOI)

To eliminate interrupt starvation caused by fixed priorities, the 8259A provides an internal priority rotation system. Software configures this behavior by issuing Operation Command Word 2 (OCW2) to the command port at 0x20.

OCW2 contains three control bits that determine priority handling: Rotate (R, bit 7), Specific Level (SL, bit 6), and End of Interrupt (EOI, bit 5). Setting bit 7 enables priority rotation:

Command Name Hex Code Bit Pattern (R, SL, EOI) Functional Behavior
Non-Specific EOI 0x20 0 0 1 Clears highest active ISR bit. Priority order does not change.
Rotate on Non-Specific EOI 0xA0 1 0 1 Clears highest active ISR bit, then rotates that IRQ to lowest priority.
Rotate in Auto-EOI Mode (Set) 0x80 1 0 0 Configures PIC to automatically rotate priority upon receiving CPU acknowledge.
Rotate on Specific EOI 0xE0 | level 1 1 1 Clears specific IRQ line and assigns that line the lowest priority.

When the operating system timer routine terminates by writing command 0xA0 (Rotate on Non-Specific EOI) instead of the conventional 0x20 to port 0x20, the 8259A executes a round-robin rotation. The interrupt line that was just serviced is reassigned to the lowest priority level (priority 7). The line immediately following it numerically wraps around to become the highest-priority line (priority 0).

Priority State Demonstration

The mechanics of hardware rotation can be illustrated by observing the priority hierarchy through successive interrupt cycles:

  1. Initial State: The PIC starts with default fixed priority:
    Priority 0: IRQ 0 (Highest)
    Priority 1: IRQ 1
    Priority 2: IRQ 2
    ...
    Priority 7: IRQ 7 (Lowest)
  2. IRQ 0 Services and Rotates: The timer fires on IRQ 0. The CPU executes the handler and writes 0xA0 to port 0x20. The PIC clears the in-service bit for IRQ 0 and rotates IRQ 0 to the bottom:
    Priority 0: IRQ 1 (Highest)
    Priority 1: IRQ 2
    Priority 2: IRQ 3
    ...
    Priority 6: IRQ 7
    Priority 7: IRQ 0 (Lowest)
  3. Subsequent Arbitration: If IRQ 1 (keyboard) and IRQ 0 (timer) assert signals simultaneously in the next cycle, the 8259A grants access to IRQ 1 first, because IRQ 1 now occupies Priority 0, whereas IRQ 0 occupies Priority 7. Once IRQ 1 finishes and issues an 0xA0 command, IRQ 1 drops to Priority 7, moving IRQ 2 to the top:
    Priority 0: IRQ 2 (Highest)
    ...
    Priority 6: IRQ 0
    Priority 7: IRQ 1 (Lowest)

By rotating priority across physical pins, the 8259A achieves true hardware round-robin scheduling, ensuring that every peripheral device receives deterministic access to the CPU bus.

Trade-offs and Quantum Sizing

In designing a preemptive operating system driven by IRQ 0, the choice of timer interrupt frequency and scheduling quantum involves an engineering trade-off between throughput and latency.

Throughput vs. Responsiveness

A higher interrupt frequency (such as 1000 Hz, corresponding to a 1 ms tick) allows the operating system to allocate fine-grained time slices. Interactive desktop applications, audio playback streams, and video playback routines benefit from lower scheduling latency; a thread that unblocks can be dispatched to the CPU in under a millisecond. However, raising the frequency increases the number of times per second that the CPU must enter the timer ISR, check process accounting counters, and execute interrupt handling code.

Conversely, a lower interrupt frequency (such as the default BIOS rate of 18.2 Hz, or 54.9 ms) maximizes CPU throughput by minimizing timer-induced overhead. Batch-processing systems, database servers, and scientific computation workloads favor longer quanta because every context switch incurs measurable hardware penalties:

Frequency Tick Period PIT Divisor Primary Use Cases and Trade-offs
18.2065 Hz 54.925 ms 0 (65,536) Standard IBM PC/DOS clock. Low responsiveness, negligible context-switch overhead.
100 Hz 10.000 ms 11,932 Early Linux kernels (e.g., i386 default), OS/2. Balanced desktop and server performance.
250 Hz 4.000 ms 4,773 Modern Linux default for desktop installations. Good trade-off between UI latency and power.
1000 Hz 1.000 ms 1,193 Low-latency audio workstations, real-time control systems. Higher CPU overhead and cache turnover.

Evolution and Modern Replacements

While the combination of PIT Channel 0, IRQ 0, and the 8259A PIC defined personal computing architecture for over two decades, modern computing requirements outgrew these legacy chips. Current x86 systems replace both the timer and interrupt controller hardware while preserving the abstract principles of round-robin scheduling.

The APIC Architecture and Local Timers

The 8259A PIC cannot efficiently manage Symmetric Multiprocessing (SMP) systems because it can route interrupts to only one CPU. In the late 1990s, Intel introduced the Advanced Programmable Interrupt Controller (APIC) architecture, consisting of two primary components:

  1. I/O APIC: Sits on the motherboard chipset, accepts interrupt lines from external peripherals, and distributes them across system buses to specific processor cores.
  2. Local APIC (LAPIC): Integrated directly into each individual CPU core. Every Local APIC contains its own internal, high-resolution timer.

In modern multi-core operating systems, IRQ 0 and the 8254 PIT are largely superseded by the Local APIC timer. Rather than relying on a single global IRQ 0 tick that interrupts all cores simultaneously, each core configures its own private LAPIC timer. This enables per-core scheduling ticks, allowing each processor core to maintain its own independent run queue and round-robin scheduler without contending over global timer locks.

High-Precision Event Timers (HPET) and TSC-Deadline

The 8254 PIT suffers from low resolution and slow register access. Reading a count from the PIT requires executing slow I/O port instructions (in and out across the legacy ISA bus), which take several hundred nanoseconds each. Modern systems implement the High Precision Event Timer (HPET) and Time Stamp Counter (TSC) Deadline timers:

Tickless Kernels (Dynamic Ticking)

A fundamental limitation of continuous periodic timer interrupts (whether driven by IRQ 0 or the Local APIC) is power consumption. Forcing the CPU to wake up hundreds or thousands of times per second solely to decrement task counters prevents modern processors from remaining in deep sleep states (such as C-states: C6, C7, and C8). This behavior drains mobile device batteries and generates excess heat in data centers.

Modern kernels, such as Linux with CONFIG_NO_HZ (often referred to as a "tickless kernel"), dynamically disable periodic ticks when cores are idle or executing a single compute-bound task. Instead of pulsing continuously via IRQ 0, the kernel calculates the exact time when the next scheduling event or timer callback will expire, programs a hardware timer (such as the HPET or LAPIC timer) for that single discrete future event, and halts the processor until that specific time arrives.

See Also

Look up “IRQ 0 and round-robin task scheduling” on Wikipedia

Questions people asked

How does IRQ 0 function and how are interrupts dispatched using a round-robin scheduler on x86 architectures? — answered 11 November 2026

On standard x86 architecture, IRQ 0 is hardwired to Channel 0 of the 8253/8254 PIT (Programmable Interval Timer), connected directly to line 0 of the master 8259A PIC. Because it sits on pin 0, it holds the highest hardware priority by default. In old DOS systems it ticked at ~18.2 Hz (1.193182 MHz base clock divided by 65,536), while preemptive OSes like Linux or OS/2 reprogrammed the divider to 100 Hz, 250 Hz, or 1000 Hz.

When you use IRQ 0 for a round-robin task scheduler, it acts as the preemption heartbeat:

  1. The Tick: The timer fires IRQ 0. The CPU suspends the current task, pushes EFLAGS/CS/EIP, and jumps to your ISR.
  2. Accounting: The kernel decrements the running task's time-slice quantum.
  3. Preemption: If the quantum reaches zero, the scheduler activates. It pushes the rest of the task's register state onto its stack, takes the task off the head of the circular run queue, and appends it to the tail.
  4. Context Switch: It grabs the next runnable thread from the front of the queue, switches page tables if needed (CR3), swaps the stack pointer (ESP), sends the EOI (0x20) to the PIC, and issues an iret to resume the new task.

If you meant round-robin hardware IRQ dispatching inside the 8259A itself: the chip has a built-in Automatic Rotation mode (Rotate on Non-Specific EOI, command 0x80 to port 0x20). In fixed priority, IRQ 0 always trumps IRQ 1 through 7. With automatic rotation enabled, whichever IRQ just finished being serviced immediately drops to the lowest priority (priority 7), making the next line the highest. That stops a chatty timer or serial port from completely starving the disk controller.