Concurrency Revolution

6/13/2005 7:51:13 AM

Concurrency Revolution

Well-known C++ author, Herb Sutter, wrote “The Free Lunch Is Over: A Fundamental Turn Toward Concurrency in Software” in Dr. Dobbs Journal about a fundamental turning point in processor design in which traditional approaches to improving speed (except increases in cache sizes) are running out of steam and manufacturers are migrating en masse towards hyperthreading and multicore technologies. Alongside this trend are continual and rapid increases in storage and network capacities that will leave computers increasingly CPU-bound.

As a result, in order to improve software performance in increasingly sophisticated applications and operating systems, developers will have to either have to more heavily optimize their applications or move closer towards a multithreaded programming model.

The multithreaded programming provides more opportunities than optimizations. Hence, Herb Sutter predicts an upcoming concurrency revolution.

Unfortunately, as Anders Hejlsberg has said, there “are not a lot of PhD’s” in the world who can understand the difficulties of multithreading, so programming languages have to introduce new and easier concepts to take advantage of underutilized processing power and make it accessible and safe for the mainstream user.

Since Herb Sutter works in the C++ group at Microsoft, he’s probably familiar with upcoming advances in C++. Anders Hejlsberg also mentions concurrency as a important concern of C# 3.0–not surprising, since its also a key feature of the COmega, of which C# 3.0 is based on.

Jeffrey Richter from Wintellect recently presented a talk on threading, which I reported on. He was contracted to work on the Base Class Library; a few of his locks, SoaReaderWriterLock and others, did not make the Whidbey timeframe but will be introduced in Orcas framework. The fact that Microsoft put a heavy-hitter to work on threading indicates a key focus area for the next release.

It’s safe to say that Microsoft will be addressing this issue soon, and probably will be leading the way. As for Sun, Java 5 introduces some concurrency features such as AtomicInteger types, ReentrantLocks, lock-free data structures, but it’s not fundamentally different from concepts that originated in the 60s.

The smart minds at Microsoft Research have been focused on a new concurrency constructs in COmega based on join calculus. More details here and here. The papers detail how one goes about rewriting traditional threaded programs to this model.

It’s different from traditional concurrency programming in several ways:

  • minimalist—whole-threading is based on the one concept of chords
  • declarative, local synchronization
  • compiled to queues and automata
  • no reliance on explicit locks.
  • relies on asynchronous message-passing rather than synchronous method calls
  • methods, not fields, carry state

One of the more interesting applications of this new model is the ease in which it allows one to create Actor objects (sort of like AI agents). The approach is very clean. An actor object operates in a separate thread and communicate with other objects purely through asynchronous messages and no locks are needed. This is very much like event-driven programming in Windows in which the OS communicates with each window through messages, except that here each message is directed to a different function rather than a single callback.






Net Undocumented is a blog about the internals of .NET including Xamarin implementations. Other topics include managed and web languages (C#, C++, Javascript), computer science theory, software engineering and software entrepreneurship.

Social Media