• WANTED: Happy members who like to discuss audio and other topics related to our interest. Desire to learn and share knowledge of science required. There are many reviews of audio hardware and expert members to help answer your questions. Click here to have your audio equipment measured for free!

Why Your Computer Crashes

amirm

Founder/Admin
Staff Member
CFO (Chief Fun Officer)
Joined
Feb 13, 2016
Messages
44,663
Likes
241,004
Location
Seattle Area
Why Your Computer Crashes
By, Amir Majidimehr

Ever wonder why your computer “crashes?” What is a crash anyway? To understand that, we need to first step back and understand the architecture of our PC.

When you turn on your machine, the hardware automatically executes one program: we call this the operating system or amongst people who write the code for it, the “kernel.” As the name implies, the kernel is the core of your machine. It sits between the hardware and the programs that run on top of it. Examples are Windows, MacOS, Linux, and iOS (Apple mobile operating system).

The kernel’s job is to provide an environment where the application programs can run on top of it and with it, hide the complexity and differences of the hardware below it. For example when you ask your word processor to open a document, the exact same code in it opens the file whether it is stored on the hard disk of flash thumb drive. These are very different hardware devices yet from an application point of view, or how you might use them to browse files stored on them, they appear identical. This sharply reduces the work for the application developers or your efforts to manage your files.

So at high level you have three pieces stacked on top of each other. The hardware is at the bottom. The kernel sits on top of that. And all the applications run above the kernel. There is one piece of hardware and one kernel but many applications. By the way, your desktop, the thing that shows all your files and such, is also an application, albeit, one that ships with the operating system and always runs.

The next important concept is to realize that there is no way to write perfect software that is of any complexity. The permutations in any computer program are infinite in scope so there is no way that all the possible paths can be verified to be correct before software is released. Further, software may access other components in the operating system or elsewhere which may have flaws or “bugs” as we call them. This is an aptly named problem as anyone who has tried to chase bugs to kill them knows that you can get most of them, but invariably a few get away. :)

To make you feel even better, modern audio/video electronics has also gotten so complex that many devices such as TV, Blu-ray players, cable and satellite set-top boxes run an operating system (usually a variant of Linux). So don’t be surprised if those devices also crash like your computer can!

On top of the software bugs, we also have to deal with hardware that can have faulty software embedded them (called “firmware”) or design. They can also flat out break; something that thankfully our software doesn’t do.

A hard disk that fails may stop responding all of a sudden in which case your program which is trying to save its file to it hangs indefinitely. Or it may corrupt data told to write to its media and keep going as if nothing has happened. This doesn’t happen often but can. And when it does, figuring out that it occurred can be incredibly tough if not impossible. But again, this is not a common occurrence so don’t lose sleep over it.

Failures then can occur up and down the “stack” of hardware, kernel and applications. The failure manifests itself very differently however depending on where it exists.

Let’s start with the easy part and look at what happens when the problem is in the applications. As an example, assume we have a program that expects a number from 1 to 9 to be input to it and you instead put in a name. The program attempts to use that string of characters as a number and things go bad from there on. One of two situations manifest themselves at this point:

  1. Your program keeps going but does the wrong thing (including hanging which means chasing its tail forever, not responding to you).

    It is your job then to realize something has gone wrong and not trust the output of the application. Important thing here is that nothing crashes and the system keeps going.

  2. The program crashes (is removed from the system) with the operation system putting up a notice. We call this an “exception” or “fault.”
Understanding the second failure mode requires a deeper dive into the system architecture. Your application runs in a box created for it by the hardware (CPU) and the operating system. It is given a private space to execute its code. Access to anything outside of this area is forbidden as to provide protection against one program snooping on another or the operating system, or corrupting these others due its own bugs.
f635d4_1dc16cc1d8174b2185de3f96b93e2254~mv2.png
The engine that does any work in your computer is the Central Processing Unit or CPU. The CPU runs both application code and that of the operating system. In the case of above errant program, the CPU happily executes what it is told in the form of code in that program. During this operation however, it is always checking to see if the application is doing something it should not be doing such as going outside its bounds. Should it attempt to do so, the CPU halts executions of your application at that precise moment, and calls special code in the operating system to complain. That code then verifies what has occurred, and pops up the crash message saying the application has done something wrong and it is being terminated. See some examples for MacOS and Windows to the right.
f635d4_363cd565d05a4a5e95324c462571d37d~mv2.png
So let’s review again. Your program is running at full speed at potentially billions of instructions per second. But on every instruction a check is made to make sure it is not attempting on purpose or accidently accessing anything that it is not his. The latter is the key here: when a program has bugs, sooner or later it starts to execute random or incorrect instructions. That code invariably generates requests to data that is outside of its bounds (or “illegal” such as attempting to write on top of its own code). The CPU stops on that precise instruction and reports to the kernel that something has gone wrong, resulting in the crash message displayed by the operating system with the program in question named.

Now here is the good news. Application programs are partitioned enough that they cannot take the computer down with them when they crash (there are some notable exceptions to this but for now, let’s go with this simplification). So in essence then, your computer cannot crash because a program has done something wrong. So don’t go reinstalling your program hoping it would fix something. Likely it would not.

Now let’s take what we just learned and apply it to a situation where the system does actually crash. Even though the kernel is “king” so to speak and has lots of power in your system, it also lets the CPU monitor its behavior just as it does for applications. As with user applications, the kernel has its own boundaries of where its code and data exist and it allows the CPU to warn it if its own code attempts to access what it should not.
f635d4_1aa6f4fd3093449ba08c9e86c67c964e~mv2.png
Now imagine an errant piece of code in the operating system that gets triggered because you did something unusual. Let’s say it is plugging in a device into the USB jack of your computer which has faulty “driver” (a piece of kernel code that interfaces with that piece of hardware). As soon as you plug in the cable, the bug gets triggered. Let’s say that causes an incorrect access to occur to a location outside of the kernel code. The CPU dutifully catches that event and reports it to the same piece of code it used when an application crashed.

The behavior is radically different now. The operating system examines the nature of this “fault” and realizes it is its own code that was the source of the problem. Fearing that continuing to run may lead to more drastic failures such as corrupting user data, and importantly, losing track of what has gone wrong, it attempts to commit suicide by popping up the message that every user in the world hates: the system has crashed. In Windows, this is the Blue Screen of Death which is often abbreviated to BSOD. A sample is on the right.

MacOS also has a crash message contrary to popular belief of its lack of existence as seen below.
f635d4_3719535dc3ac4948bb6e6ed10007f5ec~mv2.png
What happens next is that the kernel will attempt to take a snapshot of critical memory data so that it can be analyzed later to potentially find the cause of the crash. I say potentially because while the failure endpoint is known, what got us there may be totally obscured. An operating system bug may corrupt some data that is not used hours or even days later leading to the visible crash. The snapshot of the system at crash point then has little useful information as to why we got there as so much has happened since.

Operating system companies like Microsoft collect crash data (for both applications and the kernel) and work on resolving them based on frequency of occurrence. So be sure to give consent to have the computer upload such information to them after you have restarted your computer. Additional crash “dumps” also helps the engineer triangulate the problem better resulting in higher odds that the solution is found.

Having spent years tracing through crash dumps to find and fix operating system bugs, I can speak firsthand to the difficulty of detective work required to back trace the problem to its root cause. Some bugs literally took months of intense code review and crash analysis to unravel. So don’t be surprised if there is no quick resolution to your problem from the system provider for these crashes.

As end users, you can also attempt to troubleshoot what may have caused the system to crash. That goes beyond the scope of this introductory article but know that there is a bit of self-help available. Suffice it to say, you may be able to find out if it was indeed the broken device or driver for that printer which caused it.

There is a common myth that your computer crashes because it runs out of memory. That just doesn’t happen! It almost doesn’t matter how much memory your computer has; you cannot exhaust it. No, you read that right. There is no relationship between the two. I can have a computer with two Gigabytes of memory and run eight Gigabytes worth of programs and nothing will crash!

Reason for that is that the operating system uses the hard disk as an extension of system memory. So as long as you have hard disk space, you can keep running programs. And since hard disk is much larger than your computer memory, you essentially have unlimited ability to use more memory by running as many applications as you like. Now, if you reach the limit of free hard disk space, the operating system will complain but usually in the form of not wanting to run more programs or existing programs crashing as they fail to get space to store their data. But the operating system will almost invariably stay operational. You can stop some programs, recover space and keep going. The technical term for this feature is “virtual memory.”

Likewise, running out of disk space should just result in error messages and not outright system crash. So don’t go adding memory or disk space to your computer to stop system crashes. It will not help (although sometimes changes the system behavior enough to make it act differently).

So there. You may not know how your operating system runs things, but now know a bit about what makes it not do that! :)
 
Last edited:

fas42

Major Contributor
Joined
Mar 21, 2016
Messages
2,818
Likes
191
Location
Australia
Obviously ... because there's a fallen tree in the way ...
 

Don Hills

Addicted to Fun and Learning
Joined
Mar 1, 2016
Messages
708
Likes
464
Location
Wellington, New Zealand
I blame Microsoft, for moving from a segmented memory model to a flat model. ;)
 

NorthSky

Major Contributor
Joined
Feb 28, 2016
Messages
4,998
Likes
945
Location
Canada West Coast/Vancouver Island/Victoria area
Good read Amir.
And yes, Apple computers crash too sometimes.

Perhaps in another installment you can talk about viruses that also crash our computers? ...And best system protection?
...Credit card number thefts, bad sites who will impede on your computer's performance, the lows of the Internet?

My neighbor had his credit card replaced three times in less than a month! ...Because someone from the USA was using it! ...Over $4,000
Big pain in the butt.

Him too had many crashes in his computers, and I too. Just in the last twelve months I must had ten serious crashes, if not more.
The computer store always ask me to bring my computer or laptop over to them, with a $100 minimum fee.
Sometimes it takes me several hours to get rid of a serious issue, and it's no picnic. Just an accidental click, or just googling around and clicking an entry can get you into a crash. So I figure the Internet highway is not safe, and I don't have enough system protection against it.
That's why I will like to learn more about. They said Windows 10 is more protected, protected against what?

How to restore your computer from crashes, from viruses that made it completely caput? What to do and not do?
...The time it can takes, the procedures to follow in order to regain access to our computers that have crashed for whatever reason?
This, I'm big time interested to learn. ...With videos too.
 

Purité Audio

Master Contributor
Industry Insider
Barrowmaster
Forum Donor
Joined
Feb 29, 2016
Messages
9,183
Likes
12,464
Location
London
Interesting and excellent thank you Amir.
May I ask what makes one computer 'faster' than another ? My boys are always seeking the ultimate computer for their online games.
Keith.
 

RayDunzl

Grand Contributor
Central Scrutinizer
Joined
Mar 9, 2016
Messages
13,250
Likes
17,193
Location
Riverview FL
I had random (like once a month) Win7 blue screens, I suspect it was a cheezy power supply - case and power combo was like $39, which cleared up with a cheezy Antec replacement. Stable since then.

That's on my old 5-year-plan i7, which is now in its 8th year.
 
OP
amirm

amirm

Founder/Admin
Staff Member
CFO (Chief Fun Officer)
Joined
Feb 13, 2016
Messages
44,663
Likes
241,004
Location
Seattle Area
I had random (like once a month) Win7 blue screens, I suspect it was a cheezy power supply - case and power combo was like $39, which cleared up with a cheezy Antec replacement. Stable since then.

That's on my old 5-year-plan i7, which is now in its 8th year.
Yes PC power supply failing like this is pretty common. They take so many shortcuts to create such high power supplies for so little money that they don't last more than a few years. I have fixed at least three machines in our household the same way.
 

NorthSky

Major Contributor
Joined
Feb 28, 2016
Messages
4,998
Likes
945
Location
Canada West Coast/Vancouver Island/Victoria area
Yesterday my Internet Explorer browser jammed, and was completely stuck. I couldn't do anything, the mouse couldn't click anywhere. The screen was simply frozen. It happened during exploring some photographs from one site (photos of a small apartment with underground tunnels and rooms behind a trap door - fascinating stuff), and that was one of the main subjects from my MSN home page.
This → http://www.viralnova.com/apartment-secret-dungeon-gallery/

I shut down everything, manually, power button. I reopened it, but it didn't work.
I shut it down a second time, giving it more time; it took a while to restore my stuff.
Now it came back, but that took roughly a good 45 minutes or so.

@ times I can experience couple crashes per week on average, major crashes.
It makes me think that I need to buy a super computer, with the top latest in it ($3,000+) and pay extra for the best protection and anti-virus anti-crash systems out there.

My laptop is cheap ($629 MSRP) and it's only an i5. I'm a cheap type of guy, and I'm also a type of explorer guy...I'm not afraid to check around in my searches.
I believe you learn more from being audacious and from crashing all the time.

Anyway, I very welcome this thread's subject; very useful stuff. ...And from an ex-Microsoft executive. :cool:

* Computers are funny, as much as the humans who build them. :) ...Certainly not perfect, and very challenging @ times.
We all crash occasionally, too tired or whatever, just like our computers, and the little hamster inside them taking a break in his hammock for a nap. :D
 
Last edited:

NorthSky

Major Contributor
Joined
Feb 28, 2016
Messages
4,998
Likes
945
Location
Canada West Coast/Vancouver Island/Victoria area
...And what exactly do you tell your computer to do for you, Thomas?
Do you experience the occasional crash, when telling your computer to do some' that she's not too fond of performing for whatever reason @ the time?
 
OP
amirm

amirm

Founder/Admin
Staff Member
CFO (Chief Fun Officer)
Joined
Feb 13, 2016
Messages
44,663
Likes
241,004
Location
Seattle Area
Yesterday my Internet Explorer browser jammed, and was completely stuck. I couldn't do anything, the mouse couldn't click anywhere. The screen was simply frozen. It happened during exploring some photographs from one site (photos of a small apartment with underground tunnels and rooms behind a trap door - fascinating stuff), and that was one of the main subjects from my MSN home page.
There are two types of crashes in a computer. The type where the operating system knows something has gone and the type it doesn't. Unfortunately what you experiences is the second type and very common.

This is going to get complicated but the most common reason operating systems hang in the way you explain is that "interrupts are blocked" forever. Computer systems operate on the basis of doing work, e.g. computing a number, until some input/output device needs attention. That device pulls on a special line/hardware feature in the CPU called an interrupt line. It does what it states: it is trying to interrupt the flow of work on the compute to say, "i need attention." One example is the mouse. As soon as you move it, it sends an interrupt to the CPU saying I have some new data for you. Alas, the operating system routinely blocks interrupts for work that it wants to finish from start to end. These operations when working correctly always unblock interrupts at the end. But there are bugs that cause a situation where the interrupt gets blocked, but never unblocked. The moment this happens, everything grinds to a halt since you can't interact with the machine. Nothing can go in or come out of it so even if the computer is still "alive" it can't respond to you.

The same can also happen in the case of a broken piece of hardware which pulls the interrupt line but doesn't let go. Again, the system hangs because other activity cannot be recognized.
 

NorthSky

Major Contributor
Joined
Feb 28, 2016
Messages
4,998
Likes
945
Location
Canada West Coast/Vancouver Island/Victoria area
That's very cool to know Amir, and we all know that machines are build by humans and that computers can beat humans @ playing chess.
What do you do to resolve the impasse when it happens to you? ...Is there a quicker remedy than the one I described above?
 
OP
amirm

amirm

Founder/Admin
Staff Member
CFO (Chief Fun Officer)
Joined
Feb 13, 2016
Messages
44,663
Likes
241,004
Location
Seattle Area
It is very hard to find and fix the causes of these problems. One I do is reduce the variables. If my computer is having trouble, I disconnect every device I can and see if it persists. Pull out the ethernet cable, printers, etc. Often this points points to a faulty device. Learning to read the Event Logs in Windows helps too. You can google those messages and see what people say. Ultimately though, it may be less hassle just to buy a new machine :).
 

NorthSky

Major Contributor
Joined
Feb 28, 2016
Messages
4,998
Likes
945
Location
Canada West Coast/Vancouver Island/Victoria area
Lol, I would have twenty laptops by now.
Disconnecting the modem/router, the laptop, removing the battery...I did all of that many many times.
Sometimes it works and it doesn't. You need a secondary laptop or computer or phone with Web access to ask questions, and true sometimes the solution you can get from trying stuff you read, not necessarily related to your exact issue but good enough, after two, three, four, five hours.
Sometimes the issue is with the Internet service provider, the same company you're dealing with, other times it's just the nature of the system we created and the normal hazards of life. ...Including, I suspect, the ones who do this for a living; infecting your computer with their own disease and asking money to release it somewhere else. ...Pretty much the same as in real life with the people who don't have an honest one.

It's like driving in a new neighborhood where you don't know if the lights are going to turn green.
Because on red they'll have time to open your windows by force and take off with your wheels. :D
And if you don't have a spare suit @ home, you're out of luck and might have to wear only shorts. ...They'll take your shoes too, and don't carry a picture of your mother and brother and wife in your car because they'll take that too. And don't report your car stolen because the licence plates won't match anymore, and neither your car's favorite color, grey.

Crashes happened because the road is icy and drivers are not careful. It's the same with computers...bad weather some days. :)

Also, each model car, laptop brand and model number have various salvation resolution; when asking for help it's better to give your model and version of Windows, or red delicious or spartan or Mac Intosh apple flavor.

Here's a fair question for who's reading: How many crashes did you have in the last twelve months?
And two, the brand of your PC, and which Windows version?
I'll wait for some answers and then I'll share some more.
 

Ronm1

Active Member
Joined
Mar 9, 2016
Messages
115
Likes
33
Location
NH
Bob, it's called trouble shooting. Whether it's an auto, fridge, heating system or our body. One evaluates the symptoms and analyze vs knowledge of the product. An educated guess is made and a change or move made to cure the issue. If problem persist we evaluate again...etc. hopefully the symptom doesnt change to confuse the issue further. The process continues until the issue is resolved. If knowledge of product is limited the evaluation stage will be weak. This explains why we usually go to a specialist if our knowledge base is limited. There is little chance of gaining knowledge on a blog for complex, intermittent problems. They are difficult enough when you think you know what you are doing.
 

NorthSky

Major Contributor
Joined
Feb 28, 2016
Messages
4,998
Likes
945
Location
Canada West Coast/Vancouver Island/Victoria area
Yes Ron, we learn as we go, and by ourselves the better because not only we save money but also we acquire more knowledge.

The other day my lawnmower wouldn't start; I google my lawnmower brand and said that it wouldn't start.
I clicked on videos, and they showed me how to get the carb out and to clean it inside and unblock the main jet, small passage with a needle.
That was the problem and I saved about hundred loonies.

In the last twelve months I had almost twelve major crashes on my laptop, where everything was dark and nothing responded.
I used my phone and googled around; that's how I probably saved $1,000+

If someone's laptop here crashes, I think I can help, from personal experience. ...To some extent, not everything because many features I don't use.

Amir mentioned several possibilities of why it can happen and it does happen occasionally, more or less depending also of each one's own use.
Having a computer expert here handy is essential in our audio hobby. ...And more.
__________

Here's another issue I had for a while: In Google Chrome I used to have eight boxes of my most visited websites, but for the last two months only two are showing a website, the other six boxes are grey out (blank). I searched and searched for hours on how to restore them but all in vain. I tried almost everything.
Google's own help center couldn't help me out. But it's no big deal so I quit searching after several attempts.
And occasionally IE goes away, no page showing, no connection. So I do a test and then it's coming back, but every few days I lose it.
Those are very minor issues and not important, @ least not like a major crash when your computer has zero response and the screen is screaming a red light alarm!
Or it's totally dark! The first one is a virus, and those buggers required drastic action. And what might work once might not the next time, and you have to repeat the booting process few times, and it takes time, and time is life.
As for a complete dark screen, that too requires some precise key punches, and other solutions for each brand.
Then there are restore points, defrag, erasing your history, cookies, cache, ...clearing your browsing history.
Also, scanning your computer for malware, viruses, other slowing down issues.
Applications running in the background will slow down your computer too.

I have never in my life pay a computer technician to fix my computers and laptop, ever.
I always fixed the problems myself. But I don't have the many years of expertise as some have here.
I started late with computers, with Windows 98. And I had the blue screen of death within the first two weeks. I tried to download Windows 2000 and it wouldn't take it, just not enough juice in it I guess. So I bought a refurb, a ThinkCentre IBM with Intel Pentium 4 and Windows XP. The RAM was only 0.5GB.
And 40GB of hard drive. Today's phones are ten times faster and more powerful. That IBM is dead now. Of course with XP. But I had time to abuse it the best I could.

Today I have a message, Windows 10 want me to upgrade my laptop on April 9, Saturday. Everything they said is ready to go; I clicked on that little red X in that top right corner...no go for Bob. It's very tempting though because all checked up perfectly for that upgrade, and with 200 million people who have already did.

But I trust few people here and there, and I can live without for now. I'll kill this laptop with 8.1 first.

It's fun the world of technologies, computers, electronics, audio, video, music, movies, communication, ...it keeps us entertained while sitting outside with the wildlife, like I am doing right now...with the wind, the blue sky, the white clouds, the trees, the birds, the music (jazz) playing in the background, and talking to you by typing letters one by one to form words from my keyboard that reflect my state-of-mind in the now.
All of this on topic with computer crashes and all that jazz. Today no crash, just losing IE for couple times and for very short.
Yesterday is gone, and I have no clue on what I'll be watching tonight on Blu. But last night I did watch Star Wars: The Force Awakens in 2D only because the 3D version is coming up only later so that the movie studio can make more money from a movie buff like me. And same with the UHD Blu-ray version for people like Amir for his new LG 4K TV.

I like the Star War movies, but I don't get it as much as some do. ...It's just the way it is, with music, movies, women, jobs, hobbies, toys, fishing, sailing, ...we all rock to our own rhythm where we feel comfy, or try to accommodate best we can.

I have a new baby now to feed and grow up with; his name is AudioScienceReview, and it cries sometimes...I can hear it crying. :)
But it's only a normal phase, he'll grow up, becoming older and starting pre-school, then college, till he becomes a full grownup adult, then die like life's destiny for all of us. :) ...If he's lucky he might make it till the year 2116. ...Hundred years old. If not, no big deal...there is WBF. :)
And life keeps on living and computer crashes will still happen tomorrow; so why worry today for tomorrows' eventual faith...death. :D

I have a responsibility as a citizen of planet Earth; to make life happy all around me, even in hard times...in times of computer crashes.
 

Ronm1

Active Member
Joined
Mar 9, 2016
Messages
115
Likes
33
Location
NH
[QUOTE="NorthSky, post: 8217]t last night I did watch Star Wars: The Force Awakens in 2D only because the 3D version is coming up only later so that the movie studio can make more money from a movie buff like me.
[/QUOTE]
I know that feeling Bob
 
Top Bottom