What determines whether or not Caps Lock responds while the computer is frozen?

15

6

When a computer is not responding in some way, there are different levels of "frozen".

For example, let's say I'm browsing the web on my PC...

  1. If the current browser tab stops responding (clicking/typing does nothing), perhaps the browser still will.

  2. If the whole browser is locked up, perhaps the OS is still responding.

  3. If the OS GUI does not respond, often I can still toggle the Caps Lock LED.

  4. If Caps Lock no longer responds, I must assume "maximum freeze". Sometimes though, if I wait, the whole computer may still go back to normal after a while.


  • If Caps Lock no longer toggles, does that mean the computer is "more frozen than in step 3"?

  • Does it make sense to use Caps Lock as a final test of "frozen"?

  • ...And if so, what is the difference between when Caps Lock toggles and doesn't? What determines whether or not Caps Lock responds?

Bort

Posted 2016-11-18T14:36:35.403

Reputation: 914

10Response to Caps Lock, Num Lock and Scroll Lock requires the OS to still be able to service (keyboard) interrupts. The LED response AFAIK is generated in the ISR, and no userspace processing is required. So the inability to perform this operation does indicate a severe condition. When this condition lasts for more than a few seconds and Ctrl-Alt-Del is also nonresponsive, then I treat it as unrecoverable and hit the reset or power swittch – sawdust – 2016-11-18T19:50:37.917

Some programs do funky stuff with the CapsLock key, making the CapsLock key less reliable to be sure. I would use Numlock in this case, maybe as second test. For example, in music Tracker software, For example Milky Tracker, Fast Tracker and even OpenMPT, the CapsLock is used to insert a note off, and as such the status of the CapsLock key is caught. As such, the LED will not turn on once pressed, giving a false sense of frozen. – LPChip – 2016-12-02T13:00:13.893

@LPChip - Would that funky stuff require the music software to still be responding? – Bort – 2016-12-02T13:03:39.030

@Bort Depends. The OS must still lay the keys to the program, but it depends on how its programmed and how the program hangs. It is possible the program did not crash, but simply does not react to keypresses and mouse clicks, yet it still fully works. In that case caps lock would not change state, nor would the program respond. But activating a different program would work normally. – LPChip – 2016-12-02T13:17:13.623

Answers

2

You're basically answering your own question during your question, but for the sake of having an answer, I'll try to answer it to the best of my abilities.

There are different ways, something can become unresponsive.

Lets assume you are using Windows, though the process is not that different for other operating systems.

When you interact with a program, you do so by clicking or typing while the program has focus.

Clicking or Typing goes via the mouse or keyboard to the motherboard. The operating system will query what is being typed and how the mouse is being moved. It interprets the signals and interacts with the programs accordingly.

Keyboard shortcuts will be sent to the active application unless a hotkey is being pressed that has a global status. In that case the operating system will perform a different action.

The operating system will also make the program amongst other programs function without any interaction. For example, when you copy a file from location 1 to location 2, if you don't type anything or not move the mouse, the file copy operation will still continue.

Modern Operating Systems have a feature called Multi Tasking which basically means that it cycles through all programs very fast giving each program time to perform a cycle in its programming. By doing so, it will appear that all programs run at the same time fluently. In this cycle, the Operating System itself will also be given CPU time.

When a program performs lots of calculations, the CPU is being utilized more. The more a CPU is being utilized, the less power is available for the rest of the system, including cycling through all other programs. When the CPU reaches 100% utilization, the computer will become very slow as it is waiting for CPU time to process all the activities by all open programs. The Operating System normally prevents the computer from freezing if this happens, but it is possible the computer can freeze in these occasions.

When a program is being created, it is possible a bug exists which causes the program to crash or become unresponsive when a series of tasks is performed.

There are different levels of unresponsiveness when talking about program bugs. It is possible the program stalls its execution waiting for a certain button to be pressed, but that button appeared outside of the screen. The program works normally, it just does not accept user input and as such appears to be stalled while technically it isn't.

It is possible the program is performing a memory operation but the memory operation refers to a different segment of memory, which again refers to a different segment of memory and along the way ends up refering to the first segment of memory. As a result, a never-ending loop is formed. The program thinks its performing a simple action and expects a result within a few nanoseconds but causes a buffer underrun or overflow. Windows 7 and higher has several protections and will give a critical error: "The program stopped responding and has crashed. Send error report". In earlier versions of windows, depending on how severe the memory loop was, it could result in a Blue Screen of Death.

The Operating System itself is in essense also a program, and has the same problems. It is possible a bug in programming can cause the entire Operating System to become unresponsive.

Lastly, part of the Operating System are programs used to communicate with hardware. These are called drivers. Just like normal programs, a driver can also crash and become unresponsive, although chances for this to happen are less likely to occur. It is possible that the keyboard driver crashes and causes the keyboard to stop responding, while the mouse still works.

The Operating System usually detects driver issues and attempts to restart the driver. Depending on how well the driver was programmed determines how much the user finds hinder of the crash. Sometimes it may cause a flicker of the display and nothing more, sometimes a popup is shown indicating that the driver was crashed and restarted.

Plug and Play drivers usually are stable and don't crash. Custom drivers for specific hardware may crash more easily because the chances are higher some bugs have not been found yet.

With the above explained, its time to answer the question.

As indicated, a crash can happen for different reasons and with different severity. If the CapsLock key will trigger the LED light requires two things. It requires the driver to be functioning, and it requires the Operating System to give time to process the programming cycle of the driver (the multitasking part I mentioned earlier)

If both are true, pressing the Capslock key will do the following:

The key is being pressed on the keyboard and its signal is sent to the motherboard. The Operating System's driver explains to the Operating System what happens and the driver sends a message back to the keyboard that the LED state should change to its new state. The Operating System will use this information to type text in caps. Some programs however turn the LED key off by sending a second capslock signal to the driver. Depending on the keyboard, the CapsLock light may never turn on if this is the case.

If the driver does not get its cycle directly after pressing the caps lock, the LED will not change. But it is possible that the system is very slow for some reason, and the cycle is delayed. In that case it can happen that pressing the capslock or numlock will not immediately change the LED's state, but after a second or two.

Lastly, it is possible, that for some reason on the Operating System Level, it waits cycling through the drivers programming cycle because it waits for something. If this is the case, it is possible the mouse can still be moved, yet the everything else appears to be frozen.

Given that the pc is going to be in serious trouble if normal keyboard LED functions are not working after 5 seconds of time has passed, it can be safely assumed that the system has crashed severely and cannot be recovered.

There are two other keys, namely Scroll Lock and Numlock. From these three keys, Numlock is the only key that other programs likely won't abuse due to the nature of what the key does. It is more reliable to use numlock to test if the system is responsive or not than the capslock or scroll lock because some programs tend to use these keys to trigger a different function, and as such they often make the LED status to off which makes it less reliable to test with Capslock or scroll lock, and more reliable to test with the numlock.

LPChip

Posted 2016-11-18T14:36:35.403

Reputation: 42 190

My ultimate question was about [what determines if the Caps Lock LED responds]. Secondary to that was [if it is appropriate to use Caps Lock to test for "point of no return"]. I'm not sure in what way you imply that I answered my own question. My question contained only a speculative hypothesis, with no actual data or true theory involved. I believe your answer fortifies my proposed use of Caps Lock by explaining the lower-level mechanisms. – Bort – 2016-12-02T15:04:54.090

@Bort I edited my question to hopefully make it more clear. I did try to answer your question, but felt the need to explain how everything works in order to lay a foundation as to why things are like this. Otherwise it is seen as my opinion and not so much fact based. – LPChip – 2016-12-02T15:32:15.587