What is Time?
Specifically, what is time in parallel programming?
Have you heard about Rich Hickey’s talk at JVMSummit. It’s worth checking out. It is pretty thought provoking and I think it’s getting close to some issues which are plaguing concurrent programming today.
He makes the analogy that the problem of dealing with change over time in a programming language is similar to the problem of dealing with memory. If a programming language has a bad model for one of these, then you introduce incidental complexity to any program written in that language. Think about the differences between programming in a language where you have to explicitly manage memory to programming in a language with garbage collection. A lot of developers have decided that the benefits of a language like C aren’t sufficient to pay for the complexity the explicit memory management adds to programs which have to deal with complex object lifetimes.
Is there a similar paradigm shift possible in thinking about how state changes over time in a concurrent system? One possibility of course is pure functional programming languages. They basically avoid the whole question. This makes them very powerful for concurrent programming, but it also them makes it hard to use them to model mutable objects.
Hickey’s basic model is that values are immutable (as in a pure functional language), but the entity you can actually refer to (an identity) is not a value, but a series of values which represent different states over time. The current state of an identity is actually associated with the observer.
Once you’ve included time in your basic model like this, then it becomes possible to start talking about how mutable objects interact with processes on unsynchronized, concurrent processors.
There’s some interesting ideas here. You can read more in an interview with Hickey at Artima Developer. And you have to love a talk about programming which repeatedly invokes Alfred North Whitehead.
In a way, these questions remind me of the book Einstein’s Clocks, Poincaré’s Maps: Empires of Time by Peter Galison.
Before the 19th century, people thought of time as a constant which permeated the universe. Poincaré and Einstein overturned this view, but there were actually some hints of their revolution earlier. Before the telegraphs and railroads were first built, each city ran by its own clock. As the cities were connected, it became difficult to talk about things like train schedules because of all of the conversions between local times. Galison makes some interesting comparisons between this paradigm shift and the one which swept through physics after Einstein. In fact, a number of Einstein’s gedanken experiments involved observers on trains.
It is still possible to talk about mutable objects in Einstein’s physics, even though events are no longer simultaneous to all observers. Perhaps distinguishing between value and identity is part of a similar paradigm shift in programming.
BTW, if you don’t know Rich Hickey, he’s the creator of Clojure. Clojure is a Lisp dialect which compiles to Java bytecodes. And if you don’t know who Peter Galison is, he’s a professor of the history of science at Harvard.