Fredkin was my undergraduate advisor in Computer Science. I’ll speak more about him in future postings.
Speaking of his excellent coding style, bill75 taught me a lot, but the two most important lessons in programming were invaluable to me in every subsequent job:
- An ideal subroutine does exactly one thing and returns. Ditto for functions, methods, messages or whatever your language calls them.
- The structure, function and necessity of a clock queue. Many times I’ve helped colleagues out of a hole they’ve dug for themselves trying to manage more than one timing-related event in a single program. The clock queue is self-evidently the solution, once you know about it.
As promised, Weather Radar on a PDP-8 in Antarctica is my followon to this thread.
Would you mind explaining what a clock queue is?
In essence, a clock queue is identical to the keyboard ring buffer explained by Bill above. Program(s) that need a task done at a specific time put a [timestamp, link-to-task] on the queue, sorted in timestamp order. Clock ticks examine the head of the queue, and if a timestamp has passed, remove the item and wake up the corresponding task. Then loop back to see if there are other timestamps that need to be serviced.
Thanks.
That kind of service is very common in emulators, where various hardware devices usually need to schedule future actions.