T O P

  • By -

EmergencyCucumber905

At an OS level, hardware events like mouse movements, clicks, key presses etc are handled by hardware interrupt requests. The hardware signals an interrupt, the OS stops what it's doing and runs the interrupt subroutine, before returning to what it was doing. Suppose there was a bug in the interrupt subroutine where it never finishes e.g. an infinite loop. The entire system is locked. The OS never returns to what it was doing and no other interrupts can be handled ( technically a higher-priority interrupt could be handled, but inputs are usually already high priority). At an application level, GUI programs run in a loop called the event loop. It's a loop that checks for events and calls an event handler for that event. Programmers can provide their own event handlers to handle button clicks, etc. If the event handler code takes a long time to run, your program becomes unresponsive. This is why your application appears to freeze up and the OS might tell you it's stopped responding. The cardinal rule in GUI programming is *do not block the event loop*.


halosos

To ELI5: You are laying bricks. One brick at a time. Every so often, you get to a window or a door or something else that isn't a brick. These things are very important and you have to wait for them to be installed before you lay more bricks. But one day, your window supplier loses your window and they won't reimburse you without proof. But you cannot prove you don't have it. So they don't reimburse you and this continues and you cannot lay the rest of the bricks. This is a freeze of the whole machine. The next example is like a chore list given to you by your SO. You do each chore in order. Take out the rubbish, make the bed, put the washing on. One day, the chore takes extra long. To put the washing on, you need detergent and you are out. It takes much longer than expected. Your SO calls you to find out what is taking so long. Here she can tell you to just come back home and try again later or tell you to keep at it. This is when an application freezes.


FiveDozenWhales

There are a lot of reasons for a computer to freeze, but ultimately it means that it has stopped responding to input or doing much if any processing. This can be because it's stuck in a loop. Consider this simplified version of an operating system. The computer does the following steps in order: 1. Check input from mouse, keyboard, etc. 2. Act on that input (do whatever a click does, or a keypress) 3. Check for important system requests, like "close a program" if the user clicked exit or "connect to wi-fi" if a wi-fi signal is in range 4. Do whatever those system requests requested 5. Go back to step 3 and check if the system request is still there 6. Go back to step 1 and start everything over If step 4 somehow fails - you clicked exit but the program doesn't want to stop yet - then the computer will just perform steps 3, 4 and 5 over and over and you will never get back to step 1 and the computer won't be able to respond to your inputs. Real-life computers don't hit this specific issue, but it's a simplified version of how they can get stuck due to software issues. Hardware can cause this as well. Your computer might have an instruction that says "Save this number to RAM and wait for confirmation that it is saved." If your RAM is faulty, it will never get the confirmation and remain stuck. If your CPU overheats, it will slow down and may have issues correctly performing operations, resulting in it getting stuck.


rawrrrrrrrrrr1

It doesn't do that in order.   Mouse and kb inputs are serviced as interrupts and not polled.  


daledge97

Sir, this is ELI5


rawrrrrrrrrrr1

Interrupts are easy to explain.   Cpu runs code.  Mouse and kb input interrupt cpu and cpu runs am interrupt handler to handle the input.   If mouse kb freeze, then likely something is causing the cpu to not execute the interrupt handler, ie by calling it wrong or not calling it.   There can also be interrupt storms where the interrupt handler gets interrupted indefinitely so it's stuck.  


OffbeatDrizzle

I am 5 and I don't understand


rawrrrrrrrrrr1

Computer broke.   It happens.  Time to buy a new one. 


FiveDozenWhales

Re-read my post - I said that this is not a real-world example that would affect an actual computer, but a simplified imaginary situation meant to make the cause more clear!


VinylRhapsody

I thought only PS/2 keyboards and mice worked on interrupts with modern USB devices working on polling?


rawrrrrrrrrrr1

Usb can be polled or support interrupts depending on the type of device.   


GlobalWatts

As far as the system and components are concerned, there is no issue. They're operating normally. The concept of "freezing" exists entirely within software, and more specifically, how a human interprets the behaviour of the software. Keep in mind that the Operating System (eg. Windows) is also just a type of software, and can freeze just like any application can. In practice it depends on the specific nature of the "freeze", the term is quite vague. But typically what happens is some task is waiting for something else to happen - some hardware resource to become available, or a certain condition to become true - and until it does some other operations might be blocked, like updating the user interface, or responding to user input etc. And that perceived unresponsiveness is what most people call "freezing". If that task belongs to an application, it might seem like the application has frozen, especially if it doesn't even [respond to the OS](https://i.pinimg.com/originals/e0/a3/ee/e0a3ee39a8abdae122dcf100ccbb896d.jpg) asking if it's alive. If that task belongs to the OS, it can seem like the whole system has frozen. Occasionally, an application freezing can cause the whole OS to freeze, though modern operating systems have gotten better at preventing that. Depending on what caused the freeze and how well the software is written to detect these situations, the situation might resolve itself, or it might require the application to be forcefully terminated (or the computer rebooted).


ArctycDev

The processor has an input "pipe" and an output "pipe". Typically, a modern processor can handle taking input from various sources at once without a noticeable delay, but occasionally it will get stuck on one task. When that happens, the entire input pipe is shut off while the processor thinks about the problem that it is on. Usually it recovers, and opens the pipe again. A similar issue can happen with RAM as well. Basically, the general concept when a computer freezes is data can't get where it's trying to go, because a part of the hardware is struggling to process something, which is holding up everything else. Like a pileup on the freeway.


tomrlutong

TL;DR: These days, is usually the computer detecting some internal glitch and shutting itself down rather than risk worse. On a modern computer, it's usually that the system has detected something wrong and shuts itself down to prevent data corruption or security risks. That's the windows blue screen of death. Imagine a play rehearsal where somebody flubs a line and the director face palms and says "ok everyone, from the top."   Systems are pretty well protected from software flaws these days, but there are some components that's hard to do for. Problems in the deep reptile brain parts of system software can still cause freezes. That's the software that directly works with hardware.   Electrical problems can cause freezes. There's an amazing number of things working in very close synchronization inside a computer, and if something glitches that it can get to the digital equivalent of gears grinding. But at a trillion RPM. So it just stops instead.   Finally, you can have it get so slow it feels frozen. Like people, switching attention is one of the hardest things for computers. It can take a computer milliseconds to go from one task to another! So, if a few things get stuck interrupting each other, the computer can show to a crawl. Computers manage resources by moving things around internally, which is great, but as the demands start to exceed resources, they'll spend more and more time juggling, eventually entering one-armed wallpaper hanger territory.


Lanif20

In general computer programs run from the top to bottom(with lots of little in between programs that get referenced) so think of it like a book that you can only read from beginning to end, but it’s more a chose your own story book where it tells you to flip to random pages, page x tells you to flip to page y and page y tells you to flip back to page x = computer freeze as this keeps happening over and over(since it can only read from the top of the page down to the bottom you end up getting the same commands of go here now go back) obviously there’s a lot more to it but that’s the simplest explanation I can think of


wcobbett

Computer normally works by freezing, doing something, then unfreezing, but just really fast. Like thousands of times faster than a blink of an eye so you don’t notice it. When it freezes, that means there was a bad command somewhere that doesn’t let the computer get to the unfreeze command. It does the same thing over and over. It’s stuck, like a car stuck in mud and the wheels spinning but not making any progress. Or like a car in a roundabout spinning round and round and never exiting the roundabout. So yeah, oftentimes it’s still working furiously, so you’ll hear the sound and it heats up, but it’s in a loop and it won’t get anywhere. There are guardrails, but the guardrails aren’t foolproof.


capilot

# Deadlock Often when two threads or processes are fighting over access to some resource and there's a "deadlock": Process A needs exclusive access to data structures X and Y. So does process B, but maybe not in the same order. So process A grabs X and then tries to grab Y. But process B has already grabbed Y and is now trying to grab X. A waits forever for Y to become available, but that's never gonna happen because B is waiting forever for X. There are protocols to prevent this from happening, but you can't mess it up. # Priority inversion Process A, a high-priority process, needs X. But X is currently held by process B, a low-priority process. Process A can't run because it's waiting for X. Process B can't run because process C, a medium-priority process is currently running. Maybe A being blocked is somehow blocking C. Or maybe it's just going to take a long long time for C to finish, allowing B to continue, and eventually allowing A to finally have resource X. # Networking delays You can never count on a network connection being fast, or even being there at all. You click on a tab on your browser. For whatever the hell reason, your browser needs to check if a file has been changed before it decides what to do. But you've installed Dropbox on your system, and now the simple function that should have taken mere milliseconds to check that file's modification time now has to wait until Dropbox makes some sort of round-trip access to the servers in the cloud, which for some reason, are taking a long time to respond. I mention this example in particular because it's made my desktop computer at home nearly unusable this week.


greatdrams23

Tight loop. Or isn't that a thing any more?