Ex Bibliotheca

The life and times of Zack Weinberg.

Monday, 24 June 2002

# 7 PM

A programming puzzle for the readership:

Coding in Python, what is the most robust way to write a work scheduler that dispatches assignments to N asynchronous execution threads? Each assignment is the execution of an arbitrary piece of code. Dependencies between assignments are static and known in advance.

It needs to be thoroughly robust against the assignment inadvertently trashing the scheduler or execution thread's private state, failing to terminate, or consuming excessive machine resources; the scheduler should in all these cases be able to recover control, abandon execution of the problem assignment, and continue.

Also, no matter what, a user interrupt must be able to abort the entire thing. I.e. even in the face of assignments maliciously trashing the scheduler, or outright bugs in the scheduler or execution threads, control-C should work.

Ideally, the implementation of this scheduler would be damn fast. Some performance hit is okay. I said "threads" up there, but any asynchronous execution mechanism is fine; I don't insist on the use of honest-to-ghu threads. (Coroutines, however, are no good; I do need to be able to execute assignments in parallel.)

In case anyone is wondering, yes, I already have a scheduler, it's just not nearly robust enough.

# 2:40 AM

Picked up my sister at Oakland airport this afternoon and took her into San Francisco, where she's living this summer. The airport still hasn't recovered from post-Sep.11 security "upgrades"; the lines for the checkpoints are still just as long. Also, since the building was built on the assumption that people who are meeting arriving flights could come to the gate, there is nowhere to get so much as a newspaper on the outside of the security perimeter. And you can't cross the security perimeter without a ticket anymore. Feh.

I got to meet all of Dara's housemates — she's living with a bunch of friends from Stanford. We all had dinner and watched Jumanji, which they had a tape of. This is a silly comedy with a relatively non-lame performance turned in by Robin Williams. It came out in 1995, and it's kind of depressing how poorly the CGI effects have aged. They looked really spiffy back then; now they seem obviously fake.