Why Does a Computer Freeze? What Happens Inside the CPU When It Crashes
During a computer freeze, the CPU isn’t simply idle; it may be trapped in a high‑priority interrupt handler or deadlocked kernel code, and the operating system’s scheduling and interrupt priorities determine whether the processor can be reclaimed, explaining why a simple infinite loop rarely causes a crash.
The article explores the common question of why computers freeze and what the CPU actually does during a crash, noting that most users have experienced a system hang when running heavy applications.
It explains that a CPU does not merely stop; rather, it can become stuck in software, such as an infinite loop, but modern operating systems use time‑slicing and interrupts to preempt even runaway code.
void dead_loop() {
while (1) {
...
}
}Running such a dead loop may cause the fan to spin faster, yet the system continues to operate because the scheduler regains control after the thread’s time slice expires.
Interrupts
Interrupts are a fundamental mechanism that allows the OS to pause the current CPU work and handle higher‑priority events, such as timer ticks, enabling the kernel to reclaim execution rights and schedule other threads.
Interrupts themselves have priorities; a low‑priority interrupt cannot preempt a high‑priority one. If the kernel mishandles an interrupt—e.g., entering a spin‑lock dead loop—the CPU can become a "plant" that no longer responds to other interrupts.
Two main scenarios can lead to a freeze:
1. High‑priority interrupt handler gets stuck: Because the CPU is executing at a very high priority, normal interrupts cannot regain control, leaving the core effectively dead.
2. Kernel deadlock after an interrupt: If a deadlock occurs inside the kernel (for example, two threads waiting on each other’s locks), the scheduler finds no runnable threads, and the system appears frozen.
The article cites real‑world examples of kernel‑level deadlocks causing prolonged outages, emphasizing that such low‑level failures are far more serious than user‑level infinite loops.
Images illustrating the concepts are included in the original article.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.