“Why don’t we run the taskbar and Task Manager at high priority, so they can remain responsive?”

Another interesting post from Raymond Chen, this time about the difficulty of dealing with a system that’s become CPU-starved. The question is simple: why not just run Task Manager and important parts of the UI like the taskbar at a higher priority?

The catch with running anything at high priority is that unless you have been very careful to avoid it, you will eventually run into a shared resource that you will have to wait for, and you are now stuck. Your priority checkout pass gets you to the front of the line, but if the person at the register has a large shopping cart full of groceries, you just have to wait until they are done before you get your chance.

Even if the code that protects the shared resource is careful to avoid priority inversion by transferring the priority of the waiter to the thread that owns the resource, you are still stuck waiting, and that owning thread might be doing something that takes a long time, like, say, accessing a file over the network.

↫ Raymond Chen

If a system has reached a state where even accessing or using something like a task manager becomes a problem, I personally just bonk my computer over the head with a forced shutdown using the power button. Honestly though, I can’t remember the last time I’ve had to do this, as my Linux machines all seem to handle problematic applications just fine. That being said, I’m sure people managing tons of servers and/or workstations and developers debugging their own running code run into catastrophic problems like this far more often, making forced shutdowns not as practical.

Have a terminal window open with top and easy access to the kill command, or make sure you can just ssh into it remotely if the UI has gone completely nuts.

Leave a Reply