Live data from Hacker News

MIT develops new tool that can interrupt infinite loops

bostinnovation.com

31–40 of 72 posts

Re: MIT develops new tool that can interrupt infinite loops

#31
I think the better way to do this would be to throw a "JoltException" which you could catch in your program if you wanted to, like any other exception.

It seems like it'd be a huge mess to try to write code succeeding the loop which tries to handle the case where your loop code didn't complete like you expected it to.

Re: MIT develops new tool that can interrupt infinite loops

#32
post #22
post #17

Earlier quoted context omitted.

Basically the halting problem states that it is impossible to determine whether or not a given program halts under the assumption that it is executed in a turing complete machine. Due to the fact that a program is a composition of programs which at the lowest level are loops and instructions this also means that it is impossible to determine whether or not a loop halts.

Due to the fact that a program is a composition of programs which at the lowest level are loops and instructions this also means that it is impossible to determine whether or not a loop halts. It is easily provable that this is theoretically possible, but the required time is too long for it to be applicable. Suppose your memory has N states. Run your program through N+1 computation steps and if it's not already fini…

It also may not be applicable if you don't actually have access to all memory states involved. E.g. when communicating with a 3rd party computer over a network.

Re: MIT develops new tool that can interrupt infinite loops

#34
post #24

Earlier quoted context omitted.

In theory I believe it can actually detect all infinite loops, for an extremely generous definition of "can detect". On a finite-memory machine, a computation fails to halt iff it eventually repeats a state, which it must do in finite time, since there are only finitely many possible states (the finite-ness is what makes the halting problem not apply). However, that finite time might be extremely large, perhaps longe…

> On a finite-memory machine, a computation fails to halt iff it eventually repeats a state This is too strong of a statement. Lots of software simply loops, repeating the same state over and over, until an external interrupt occurs.

Good point; I guess I was thinking of the simplified textbook case of computations with no external interaction. I wonder if this MIT system is able to exclude the most likely false positives, like polling for input? On the other hand, maybe polling too long for input counts as an infinite---or at least, too long---loop for their use-case of interrupting user programs that seem to be hanging, so that the user can save.

Re: MIT develops new tool that can interrupt infinite loops

#36
The only way this would be valuable for every day use would be for programs that produce "close" output. Think of things like large scale simulations where sub-simulations might go infinite, but if they do and this causes the output of the sub-simulation to change, it isn't likely to cause major changes in the macro-simulation.

Very little code is written that way, but when code is written that way, it allows much more interesting things to happen in software and hardware both.

Re: MIT develops new tool that can interrupt infinite loops

#37

Aren't event loops infinite loops where memory might be unchanged for a long time?

Presumably the user would not activate Jolt in that case. And technically, unless the loop uses polling, it's not an infinite loop because the program isn't even running.

Re: MIT develops new tool that can interrupt infinite loops

#38
post #25

I've done this with MS Word and the VS debugger. Word crashed while I was editing a huge document. I simply skipped a few instructions down, returned to Word, saved the document, and restarted Word. When your options are either 1) crash, or 2) possibly recover to some working state, it's pretty easy to choose option 2.

i wish i could do that for safari

You probably can:

  $ gdb /Applications/Safari.app/Contents/MacOS/Safari $PID
iTunes, annoyingly, uses Apple's stupid little "please don't ptrace me" flag, which is a minor inconvenience, but fairly readily circumventable.

Re: MIT develops new tool that can interrupt infinite loops

#39
post #22
post #17

Earlier quoted context omitted.

Basically the halting problem states that it is impossible to determine whether or not a given program halts under the assumption that it is executed in a turing complete machine. Due to the fact that a program is a composition of programs which at the lowest level are loops and instructions this also means that it is impossible to determine whether or not a loop halts.

Due to the fact that a program is a composition of programs which at the lowest level are loops and instructions this also means that it is impossible to determine whether or not a loop halts. It is easily provable that this is theoretically possible, but the required time is too long for it to be applicable. Suppose your memory has N states. Run your program through N+1 computation steps and if it's not already fini…

  def is_collatz(n):
   s = set()
   while n not in (1, 2, 4):
    if n % 2:
     n = 3 * n + 1
    else:
     n /= 2
    if n in s: # Non-Collatz loop
     return False
    s.add(n)
   return True
This is theoretically bounded far below modern memory limits. Feel free to tell me the first natural number for which it returns False. :3

Re: MIT develops new tool that can interrupt infinite loops

#40
post #17

Earlier quoted context omitted.

Noob question time: what's the halting problem?

Basically the halting problem states that it is impossible to determine whether or not a given program halts under the assumption that it is executed in a turing complete machine. Due to the fact that a program is a composition of programs which at the lowest level are loops and instructions this also means that it is impossible to determine whether or not a loop halts.

It's only impossible to write a program that can be feed with any completely arbitrary program and input and yet determine all the time if it will halt or not.

What few people realize, is that most completely arbitrary programs are very uninteresting. More interesting programs have characteristics that would very often allow to statically prove that all of their loops that should terminate indeed will terminate. And even interesting loops for which it would not be in the first time possible to determine that often gain in clarity from being slightly changed so that the tool can do its work.

IIRC MS has a tool that does sort of that for windows drivers.

Post reply on HN