MIT engineers have a reputation for applying their vast intellectual resources and physical energies toward solving some of mankind’s greatest challenges. And it’s fair to say this morning that at MIT’s Computer Science and Artificial Intelligence Laboratory, researchers have lived up to that expectation.
They haven’t built the first true AI, nor have they created perpetual motion or demonstrated a working fusion reactor. But they have figured out how to unfreeze a stalled word processing program so you can save your work, so surely those other things can’t be far behind.
In all seriousness, the problem of “infinite loops” is beyond annoying. It saps productivity from software (and those using it). Infinite loops occur when a program gets stuck executing a single block of code over and over again (you probably know this as “freezing” or “f*&k!”). They often occur during functions where a program is trying to perform a task on many pieces of data in sequence, like when it searches for a word in a document for instance.
The problem occurs when the program, for whatever reason, doesn’t know when to stop repeating that operation, or executing that same segment of code repeatedly. Hence the term loop. And hence your frustration, as now your program won’t let you do anything else, including save your progress. So MIT researchers built a sort of crash cart for frozen programs that can shake them from an infinite loop, moving them along to the next logical block of code.
The program, appropriately named Jolt, recognizes infinite loops by examining the program’s use of memory. Say your program appears to be stalled. When you run Jolt, it takes a look at the program’s memory after each repetition of that loop. If there’s a change after each execution, your program is probably doing something useful. If not, it’s simply hung up in an infinite loop. Jolt then looks for the first instruction that follows the code the program is stuck on and forces the program to move ahead (for you programming types who are interested, there’s a much more thorough nuts-and-bolts description over at MIT News).
That forced procedure may not restore the program to full functionality–for instance, Jolt (and its binary cousin Bolt) may not push the program to the correct next instruction–but ideally it will at least put the program in a state where you can save, quit, and relaunch. That beats retyping your term paper. After all, you stayed up all night just to get it finished.