Researchers at MIT believe they have found a way to fix stalled software without losing work, which they're calling a defibrillator for hung applications.
One major cause of stalled software is infinite loops - when applications execute a single bit of code over and over again.
To exit that cycle, researchers have created a tool called Jolt that interrupts those infinite loops, pushing the software onto the next line of code.
Jolt looks out for infinite loops by monitoring memory use, taking a series of "snapshots" after each loop.
“The snapshots could be completely different,” researcher Michael Carbin said.
“That can be an indicator that your program is computing. It may be doing something useful for you, so maybe you don’t want to break out of this.
"But if it’s not, and it has exactly the same state, then clearly it’s stuck in an infinite loop.”
Using Jolt, the researchers have restored five different programs, leaving them stable enough to save work and restart.
However, the days of crashing browsers and productivity suites aren't yet behind us, as there are a few problems with the system.
First, it's quite demanding, and watching all the loops in a program will slow it down by up to 8 percent, Carbin said.
What's more, in order to force the software out of the loop, Jolt needs to be applied when the program is compiled - and the researchers admit that "getting commercial software developers to use Jolt when compiling their code could be a tall order".
To solve that problem, the researchers were working on a follow-up called Bolt for compiled software.
So far, it worked with basic applications, but in more advanced programs it was difficult to see where loops began and ended.
To beat that, the researchers were working on an algorithm to help Bolt "orient itself" and were considering letting the tool start "hopping around to new instructions at random" until it found a solution.