Why does the mouse still work when the system hangs?

5

0

This is not a problem exactly, but interesting.

When windows pc hangs for any reason e.g. WinExplorer crash, internal crash or HDD fault, most of the time everything stopped working except mouse. we can move mouse, click on the buttons. Though nothing else happens after clicking.

Why & how mouse can work at these "crisis" period ?

Parameters:

  • Windows 7
  • USB mouse

kmonsoor

Posted 2013-12-28T21:41:50.953

Reputation: 977

Answers

2

When the operating system itself "crashes", you will normally be shown the dreaded Blue-Screen-Of-Death. When your PC "hangs", this is because part of the operating system (e.g. a program you are running, or an interrupt being serviced by a device driver, is stuck in some kind of continual loop or waiting condition).

Windows is a multitasking operating system, where the kernel itself will interrupt any running programs to ensure every process in your system gets a turn to run. It's likely that in the cases you describe, one single individual process is either stuck in an infinite loop (consuming 100% of the CPU), or is causing some other kind of deadlock/resource starvation, and thus affecting the other processes on your system trying to use those same resources.

In general, you still see the mouse move and work because it's rare that these issues affect your mouse driver or video card driver (as these things are almost always in use, and you would have discovered that issue long before).

The solution: it depends! If the issue is with a particular hardware device driver, there's not much you can do outside of restarting your computer, and hoping for an update (or contacting the manufacturer with a bug report). If the issue is with a single process deadlocking your system resources, then you can probably just kill the process through the Windows Task Manager (and if it does recur, maybe contact the software developers with a bug report).

cp2141

Posted 2013-12-28T21:41:50.953

Reputation: 1 222

If you mention the Raw Input Thread, your answer will be better. (-: – JdeBP – 2013-12-30T17:12:32.123

2

When windows pc hangs for any reason e.g. WinExplorer crash, internal crash or HDD fault, most of the time everything stopped working except mouse. we can move mouse, click on the buttons. Though nothing else happens after clicking.

Put simply, it is because of preemptive multitasking and priorities.

The mouse is controlled by a low-level driver with high priority, so even if a program hangs, the cursor continues to be managed independently.

That said, if a program which has been set to high priority happens to freeze (and putting a 100% load on the CPU), then even the mouse and keyboard will eventually stop working because the system is so busy attempting to process the hung program that it cannot get around to processing the mouse or keyboard actions. (You can read up on preemptive multitasking for details.)

Windows Explorer is just a program like any other, so it doesn’t matter if it crashes. In fact, you can even replace it with an alternate Windows shell or file-manager altogether.

If a hardware device fails, then whether or not it takes the whole system down depends on what the hardware is and how critical it is to the system. If a printer or DVD drive fails, then the system will likely continue running, if the video-adapter or the hard-drive that the system is running from fails, then the system will likely become unresponsive.

Synetech

Posted 2013-12-28T21:41:50.953

Reputation: 63 242

This is nothing to do with multi-tasking. The mouse driver lives in kernel mode and is interrupt driven which means it sits above the task scheduler which only runs at IRQL2. In other words the mouse can interrupt any thread on the system and do it's thing. The whole scheduler can be dead but the mouse will continue to work. – Benj – 2017-09-01T20:25:04.220

…even the mouse and keyboard can eventually stop working because the system is so busy that it cannot get around to processing the mouse or keyboard actions. Case in point. – Synetech – 2013-12-28T22:05:51.470

1

It hangs. It doesn't freeze. A bit of semantics can go a long way.

A hang can be defined as a situation where a program, application or process becomes unresponsive to direct user input.

A freeze can be defined as a situation where the whole machine is unresponsive.

The main difference between them is that, if a program crashes, the kernel and as such the drivers the OS loaded are still active. Windows Explorer can hang, but as the Windows kernel isn't related to the explorer process, it allows you to still run your machine. You can kill and afterwards run another process through use of Task Manager.

When a freeze happens, it may be because the graphics driver fails unexpectedly (the system might still be working, but as you don't see what you do, it's usually accepted that the system is frozen) or the system goes into an error state, where it reports back to the user (a BSOD) it can no longer perform reliably it's functions.

Doktoro Reichard

Posted 2013-12-28T21:41:50.953

Reputation: 4 896