Why does reset work on so many machines?

Thread Starter

Volttrekkie

Joined Jul 27, 2017
63
This is a question that has been bugging me for a long time. I have fixed a whole variety of machines. Air conditioners, ice machines, printers, lifts, scanners, labelers, packaging machines...the list is endless...and of course your own laptop. And as we all know, when the machine just won't do what it should, like get onto the web, and you checked everything else, modem is working, reset it, cables all good, no software conflict you can find...can't find any cause...so you finally decide, well, maybe I'll just try restart. And low and behold it works. Now, this works on all these machines time and time again. There has to be a common reason. And you feel feel like an idiot just having to restart again and act like you know what you are doing without really understanding the exact cause. What is the exact cause? Is it the capacitors? Do they need to be relieved? What is going on? Do you see what I am getting at? We've all seen this surely. Why do all machines do this crap?
 

crutschow

Joined Mar 14, 2008
25,135
I think it's likely that it's often microprocessor program related, since these days just about every electronic device has a built-in microprocessor.
There may be some bug in the software that was undetected during testing and, for certain rare conditions, causes the device to get stuck in a software loop it can't get out of.
So the only way to get it back to square-one is to power it down and then back up (which reboots the software).

I recently had such a problem with the internet bridge module between my internet modem and my Directv receivers.
The bridge indicated it was connected and getting a signal from the modem, but the Directv receiver could not connect to the internet through it.
After going through the "internet connect" procedure many times on the Directv receiver, and rebooting the modem with no results, I finally reset the bridge module and, bingo, that worked.
So the bridge apparently was stuck in a loop where it detected the modem ethernet signal, but wasn't able to go through whatever protocol procedure was needed to connect to the internet.
Resetting the module allowed it to do that.
 

Papabravo

Joined Feb 24, 2006
13,973
This is a question that has been bugging me for a long time. I have fixed a whole variety of machines. Air conditioners, ice machines, printers, lifts, scanners, labelers, packaging machines...the list is endless...and of course your own laptop. And as we all know, when the machine just won't do what it should, like get onto the web, and you checked everything else, modem is working, reset it, cables all good, no software conflict you can find...can't find any cause...so you finally decide, well, maybe I'll just try restart. And low and behold it works. Now, this works on all these machines time and time again. There has to be a common reason. And you feel feel like an idiot just having to restart again and act like you know what you are doing without really understanding the exact cause. What is the exact cause? Is it the capacitors? Do they need to be relieved? What is going on? Do you see what I am getting at? We've all seen this surely. Why do all machines do this crap?
Lousy engineering and worse quality control.
 

MrSoftware

Joined Oct 29, 2013
1,824
By reset you mean reboot, then it's actually pretty strait forward. Typically when a software controlled piece of hardware starts up, it's in some default state that isn't useful. As the software that controls it starts up, the software changes settings on the hardware to put it into a state that it will do what is necessary. For example if the device has a network interface, the software will program the network device with the various network addresses, wifi passwords, etc.. that it needs to operate on that particular network. In theory this is a one-and-done operation. In reality, hardware is not perfect and has glitches. If there is a glitch or bug that puts the device into a bad state, maybe the network adapter settings get scrambled, it's up to the software to fix the state by correcting the settings. If it's a cheap consumer device, odds are the software was not written to detect and correct these error conditions, so no matter what you do as a user, the settings are not corrected and the device won't work. But when you reboot it, on start-up the proper settings are programmed in again and all is well.

Do you ever wonder why a computer (cell phone, smart TV, etc..) takes so long to start up? During all that time, the software is setting up the hardware.
 

andrewmm

Joined Feb 25, 2011
403
machines can get into states that the "designers" did not anticipate,

Its a fairly certain bet that the "designers" did anticipate the machine turning on, and what had to happen to turn on, and its a fairly good bet that they tested that , probably a lot.

So resetting / switching off , just forces the machine back to a state it knows what to do.


Now a different conversation is , why was it not designed better,
but that's a VERY difficult can of worms,

Comes down to "good enough"
 

WBahn

Joined Mar 31, 2012
25,932
This is a question that has been bugging me for a long time. I have fixed a whole variety of machines. Air conditioners, ice machines, printers, lifts, scanners, labelers, packaging machines...the list is endless...and of course your own laptop. And as we all know, when the machine just won't do what it should, like get onto the web, and you checked everything else, modem is working, reset it, cables all good, no software conflict you can find...can't find any cause...so you finally decide, well, maybe I'll just try restart. And low and behold it works. Now, this works on all these machines time and time again. There has to be a common reason. And you feel feel like an idiot just having to restart again and act like you know what you are doing without really understanding the exact cause. What is the exact cause? Is it the capacitors? Do they need to be relieved? What is going on? Do you see what I am getting at? We've all seen this surely. Why do all machines do this crap?
Most machines for which the notion of "restart" or "reboot" has a meaning are some kind of state machine (even purely mechanical ones). What they do right now is a function of what their present state is and what their current inputs are. The "state" and the "inputs" are often broader than what the designers allowed for -- anything that affects what the machine does is either part of the state or part of the inputs. For instant, the current temperature is an input if the machine behaves differently at different temperatures (even if it wasn't meant to).

The number of effective bits of state is the base-2 logarithm of how many different configurations the machine can exist in. For mechanical machines with continuous movements (such as a weight on a lead screw, for example) this is tricky, but imagine moving the system a tiny amount and seeing if there is any meaningful difference in behavior. If not, then those two positions represent the same state.

As the machine runs, it is wandering through its state space. Ideally, this is happening in a very deterministic way, particularly for a digital system (or the digital portion of a larger system), but the shear size of any useful state space is so enormous that only a small fraction of it has really been mapped out. Consider a system containing just eight 8-bit registers, or 64 bits of state space. That alone is so huge that if we were to have a million machines exploring a thousand different states every second, it would take over five hundred years to explore them all. So at any given time, nearly every operating machine that has been running for more than a short amount of time in a state that neither it, nor any other machine like it, has ever been in. It's not surprising that if the machine design did not take this reality into account adequately, that there will be large regions of state-space that lead to some kind of undefined behavior which may not be recoverable in any meaningful way based on any combination of inputs unless those inputs can force the machine into a well-defined state regardless of its current state. That's what a reboot does.
 

peterdeco

Joined Oct 8, 2019
186
I knew someone who thought he knew how to program microcontrollers. Glitch after glitch in his programs. Finally his boss (small company) wrote in the instructions that if the unit doesn't respond or acts erratically, turn unit off for 10 seconds and try again. Personally, if I was his boss, on payday I wouldn't respond.
 

WBahn

Joined Mar 31, 2012
25,932
Crap software engineering, I would put a Watchdog timer in the software.
While some sort of watchdog timer is often a good idea, it should usually be seen as an emergency escape mechanism. All too often, they are used as part of the normal operating mechanism. As a rule, anytime a watchdog (or similar recovery mechanism) activates there should be some kind of log event (or at least some indication that it has occurred) because something has not operated according to plan and that really should be examined and explored, not just ignored because the system happened to continue operating acceptably due to the watchdog timing out.
 

ArakelTheDragon

Joined Nov 18, 2016
1,350
Its magic. Also a lot of non-educated engineers make these devices. They have decades of experience, the experts in these fields and LOOKs like they are great, but in reality LOOKs is nothing.
 

MrSoftware

Joined Oct 29, 2013
1,824
A lot of it comes down to budget. Every project has a budget, and often there's only enough budget to make it "good enough". The marketing guys call it MVP, Minimum Viable Product. Something just good enough to sell. A team of engineers is not cheap. Guess that it costs maybe $5k-$10k/week to employ a good engineer. Maybe you've got a group of 10 engineers working on your fancy new touch screen widget, so that's $50k-$100k / week to employ them. Why pay them for 12 months to make it "great" when you can pay them for 8 months to make it "good enough" and potentially sell the same number, but at a higher profit margin? Plus during that 4 months you saved, they can be working on the next product, and get that product to market sooner too, turning even more profit. And it snowballs. Not every market tolerates MVP, but it sure seems to work in the price sensitive consumer electronics market.
 

MisterBill2

Joined Jan 23, 2018
6,383
Most of the real explanation is given in post #5. Most code is written to go through a specific sequence, often with branches into different paths in that sequence. In the real world, not everything flows along the predicted sequence every time, and so there are exceptions. An exception often takes the execution of the program away from the path and then it becomes lost, either at a dead-end, or in a loop that has no exit. So at that point the only way to recover is to go back to the beginning, either through a reset or else from a halt and start over, such as a reboot.
Creating code that will never encounter an input that will cause a problem is very challenging, and when you consider current operating systems, written by a huge crew of dysfunctional programmers, the fact that millions of lines of code work as well as they do is amazing.
 

peterdeco

Joined Oct 8, 2019
186
Another weakness I have found in many appliances is switch debouncing. So many times I have turned on my coffee pot, kitchen fan, washing machine and microwave only to instantly turn on and back off. On the new washing machine, they went a little too far. You now have to push and hold for 3 seconds to shut it off.
 
Top