(Poem #1419) Telnet Song
There is a program called TELNET to get to another CPU. Control up-arrow is the escape; it's doubled to send it through, and "quit" is control up-arrow Q. A hacker once used TELNET to get to another CPU. He knew he could quit whenever he wanted to: all he had to do was type control up-arrow Q. Instead the hacker used TEL-NET to get to another CPU. He knew he could quit whenever he wanted to: all he had to do was type control up-arrow [at i-th time, repeat 2^i times] Q. [repeat verse n times; the choice of n is free] The hacker soon got bored with this, and wanted to get back. He sighed, and started the exponential popping of the stack: The hacked flushed the TEL-NET to the most distant CPU: He couldn't log out until he had killed them all, counting up powers of two: he typed control up-arrow [at i-th time, repeat 2^(n-i+1) times] Q. [repeat n times] Whew! The hacker's eyes were bloodshot; his fingers, black and blue; He wanted to log out and and go home to bed, and sleep for a day or two. He typed L O G O U T ... carriage return ... The hacker was on a network with only twenty CPU's. But if he had telnetted to them all, he would not yet be through with typing control up-arrow [repeat 7 times] Q!
Note: This was written after an article by Donald E. Knuth, titled "The Complexity of Songs": D.E. Knuth, 'The Complexity of Songs', Communications of the ACM 27 (4) pp. 345--348, April, 1984 (repetitions indicated; the song is only sung correctly if the appropriate number of repetitions is used) Some comments: Strictly speaking, the song is not part of the article; it was appended afterwards. The composer and lyricist is Guy L. Steele, Jr. The melody has a certain haunting quality that is quite hard to convey in ASCII text. I don't know whether it has ever been played. The composer has email, so it shouldn't be too hard to find out. -- http://www.poppyfields.net/filks/00222.html (Sitaram points out that that last bit is a dig at Knuth's refusal to use email. :)) 2^i is 2*2..*2 [i times], e.g. 2^5 = 2*2*2*2*2 = 32 I've explained the maths behind the song in a postscript (it gets long) Two of the more delightful aspects of hacker culture [see links] are an abundant and enthusiastic creativity, and a strong sense of play. Unsurprisingly, these have combined to produce a large body of verse, ranging from esoteric in-jokes to catchy and accessible song parodies, and even some genuine "poetry". There is a marked, qualitative difference from poems like yesterday's, though - this is not a case of poets embracing the brave new world, but rather the denizens of that world embracing verse, a look from the inside rather than from the outside. (There is a significant overlap with science fiction fandom's filk music, not least because so many fans are hackers and vice versa, but the two are nonetheless different genres). Today's song is definitely one of the classics of the genre, and not just for its distinguished (if you'll forgive the understatement) authors - Kunth's notion of song complexity has an irresistible combination of quirkiness and serious academic value, and Steele's song highlights the fun factor while providing a good intuitive grasp of Knuth's point. And while the verse itself isn't as clever as some of the others out there, it has a nicely hypnotic rhythm that fits the "trapped in an exponential loop" nature of the song. martin [Links] "Hacker" is used throughout in the original sense of the word - see http://www.catb.org/~esr/jargon/html/H/hacker.html [broken link] http://www.cs.sunysb.edu/~algorith/lectures-good/node2.html for some idea of what is meant by "the complexity of songs". [broken link] http://groups.google.com/groups?selm=ANDERS.90Jun7131354%40mago.uio.no lists chords for the song Biography of Steele: [broken link] http://www.sls.csail.mit.edu/~hurley/guysteele.html and of Knuth: http://www-gap.dcs.st-and.ac.uk/~history/Mathematicians/Knuth.html The Jargon Files: http://www.catb.org/~esr/jargon/ And a great collection of computer-related songs: http://www.poppyfields.net/filks/fullindex.html [PostScript] A little digression into mathematics: There is a program called TELNET to get to another CPU. Control up-arrow is the escape; it's doubled to send it through, An 'escape' is a character that sends the *next* character not to the current session but to the one below it in the stack. So, say our intrepid hacker logged in to machine A, telnetted to B, and from B telnetted to C His stack now looks like this: [hacker -> C -> B -> A]. Anything he types gets executed by machine C. Now supposing he wants to send a keystroke to machine B instead? What he needs to do is to escape the keystroke. Escape, here, is control-up arrow, so to type 'HELLO' on machine B, he needs to type: control-uparrow H control-uparrow E control-uparrow L control-uparrow L control-uparrow O or, using ^| as a shorthand for the control-up arrow key sequence, ^| H ^| E ^| L ^| L ^| O for a total of 15 keystrokes (or 10 if you count ctrl-up arrow as one keystroke even though it involves two physical keys). Now supposing he wanted to send something to machine A? If he types ^|, the keystrokes get sent to B - what he wants to do is type ^| on machine B, so that the next character goes to machine A. But how does he type a ^| on B? The song tells us that: Control up-arrow is the escape; __it's doubled to send it through,__ so we type ^|^| to send a ^| to machine B. So to send, say, an "X" to machine A, we need to type ^|^|X, right? Nope - because the ^|^| sends a ^| to machine B, and then the X goes to *machine C*, the machine at the top of the stack. To send the X to machine A, we need to send a ^|X to machine B. And to do that, we need to send a ^|^| to C (which sends a ^| to B), and then a ^|X to C (which sends an X to B), at which point we'll have sent a ^|X to B, which duly sends the X to A. By this point, it should be clear how fast the number of keystrokes can blow up as we add even one more machine to the stack. So let's go ahead and complete the demonstration by logging out of A. Press C B A ^| ^| C has a ^|, will pass the next key to B ^| ^| B has a ^|, will pass its next key to A ^| ^| ^| C has a ^|, will pass the next key to B ^|Q ^|Q the ^|Q gets passed to C which passes it to B which passes it to A which logs out Two telnet sessions (A->B and B->A), and a total of 4 (2^2) control-up arrows before the Q, as Steele said. Logging out of four machines is left as an exercise :) (Note that I assume control-uparrow-Q is a single keystroke, rather than a control-uparrow followed by a Q, otherwise the song doesn't work) martin