Are threads evil? (updated)

This paper by Prof. Edward Lee explains something of why “threads” are such a painful abstraction.  As Prof. Lee notes, threads intrinsically create non-determinism and resource conflicts which we then attempt to “prune” via synchronization and complex tools. In an earlier note, I argued that we should design real-time multi-threaded applications to minimize the need for synchronization, but Prof. Lee goes further to point out that the thread model itself encourages a disorganized program structure.  Along those lines, one of the basic difficulties in real-time application design is non-deterministic resource allocation. How can we ever be sure that, for example, a multi-threaded app where threads can allocate memory has sufficient memory for critical threads to proceed?

I’m not a fan of the “algebraic” tagged model that Lee suggests as an alternative – too much of the flavor of “formal methods” via the denotational semantics base.  In fact, Liu’s thesis, referenced here, struggles mightly with the unsatisfactory nature of the mathematical framework to get somewhere. Do we really have to create lemmas about posets to describe 2 simple processes? It seems to me that the confusion of the underlying mathematical basis has to be resolved before we can figure this out. Or maybe not.

Consider a really dumb system that keeps a “gain” variable, outputs a single analog voltage, and inputs both an input signal and “messages” that tell it what to do. The input events can be thought of as samples of the analog signals on the “pins”.

Inputs are maps: Pins -> Signals  where each input represents one unit of time and the set Pins contains “Vin” and some unknown number of pins (which may not be actual physical pins) comprising the message port.

Given a sequence of inputs, w, we suppose we have a function LastGain(w) that extracts the value of gain we were told to set in the most recent message and SinceLastCommand(w) that counts samples (time units) since the last command message.  Let’s be more specific on the “Vin”

LastVin(wa) = a(Vin).

StableVin(wa) = (1+ StableVin(w))*[a(Vin) ==  LastVin(w)]  where [exp] is 1 if exp is true and 0 otherwise


Then we can require that Dev(w)= g*v if

StableVin(w)>= t1 and v=LastVin(w)

and g=LastCommand(w) and SinceLastCommand(w) >= t2

Venture Capital falls off the cliff

Through all the bumps and strains in the broader economy, venture outlays kept up an almost eerily steady pace over the previous 21 months, ranging between $7.3 billion and $8 billion each quarter, from the start of 2007 to the third quarter of last year, according to the MoneyTree survey, which tracks venture-capital investments.

But in the fourth quarter, investments plunged to $5.4 billion, a drop of 26.4 percent from the prior quarter and 33.2 percent from the fourth quarter a year earlier, the MoneyTree report showed. The survey is produced by the accounting firm PricewaterhouseCoopers and the National Venture Capital Association, using Thomson Reuters research data. (Boston Globe)

I’m ready to argue is that there is a basic problem in returns demands.  Insistence on earning very high returns fast pushes investors into “elevator pitch” companies with technology that is easy to undertand for non-experts. Imagine trying to explain Visi-calcs product when it was in development stage. Or Adobe’s. Or Oracle’s product. All of these are complex, relatively new, pieces of technology that required long term investment of engineering efforts.