← jackdoe CODE AND TRUST: vibrators to pacemakers I want to discuss two programs, one the program that controls a vibrator, and one that controls a pacemaker. First pseudocode for a program of a vibrator: def fib(n): if n <= 1: return n return fib(n-1) + fib(n-2) def pulse(ms, freq): start_vibration(freq) sleep(ms) stop_vibration() frequency = 2 while True: pulse(2000, frequency) frequency = fib(frequency) sleep(1000) This program will vibrate with increase frequency using the Fibonacci numbers 2, 3, 5, 8, 13, 21, 34.. Pacemakers are implant devices that have electrodes connected to chambers of the heart and can force it to contract and pump blood. Its goal is to create stable heart rate, of course the heart might pump without it, so it also needs to monitor what is going on and when it should send an electric pulse. This is how much we trust other people's programs, we allow them to control our heart. Can you imagine? Just think of the simplest part of a pacemaker: "send a 2ms pulse every 810ms", ignoring the inhibited mode where it senses cardiac activity and does nothing if present, but focus on just sending regular pulse to maintain 74 beats per minute. A naive and absurdly reduced pacemaker program: def pulse(ms): start() sleep(ms) stop() while True: pulse(2) sleep(810) Notice how similar it looks to the vibrator program: loop, pulse, sleep. On the surface the vibrator program even looks more complicated because of the Fibonacci sequence. Oh, I forgot to say, the pacemaker's computer and battery are inside the human body. If the battery runs out they have to cut it out. If you read some pacemaker code you will see in the comments they put not only how many cycles an instruction takes but also how much current it will use, its very impressive. The real pacemaker code is ridiculously complex, tens of thousands of lines, true fault tolerant code is very difficult. It has taken many many years of talent and politics to make those kinds of programs possible, standar...
First seen: 2025-07-10 03:37
Last seen: 2025-07-10 11:41