This five-part article introduces Blueprint, a technology developed Connective Logic Systems (where we work) that provides an alternative approach to multi-core development. The Blueprint toolset is built on the premise that we actually have no problem understanding complex concurrency -- until we project it into the one-dimensional world of text. For this reason, a visual representation is much easier to work with than its textual equivalent. There are some cases where text is obviously more intuitive -- such as parallelizing data-parallel loops. In these cases, technologies such as Microsoft's Task Parallel Library (TPL) and Intel's Threaded Building Blocks, can be intuitive and productive. For more background information, see Part 1.
A Language Just For Concurrency
Blueprint provides a means of separating an application's concurrency logic from its algorithmic/business logic, and uses a specialized visual programming paradigm to deal with the concurrency aspects. This allows descriptions to include branching and merging information in a way that textual equivalents alone do not support. In the concurrency domain, statement "order" is replaced by "connectivity", but the algorithmic/business domain remains sequential and is decoupled from its scheduling; see Figure 1.
Blueprint presents application developers with a high-level object-oriented (OO) view of the world, meaning it:
- Is implicitly concurrent.
- Makes no assumptions about target hardware.
This could therefore be a single machine, and/or a heterogeneous network of machines. This means that applications can be built for any process configuration without the need to modify program logic.
Asynchronously executing class instances can be joined together in any way, provided that the prototypes at each end are compatible. Adjacent classes synchronize through their connections. They can be archived and re-used through a visual drag-drop-and-connect metaphor; see Figure 2.
Blueprint has the concept of "colonies" -- a network of compute nodes in which any node can process any task -- which allows additional slave machines to be recruited and/or retired at any stage of application execution without loss of data (Scale-on-Demand). In addition, the runtime scheduler supports task prioritization, and Blueprint applications will execute preemptively at network scope. This gives the resulting applications an implicit distributed real-time capability.
In this article, we examine the rationale for choosing visual over textual in the concurrency domain and looks at how Blueprint uses its diagrammatic approach to bring additional capabilities to developer's existing multi-core toolboxes.
The Case for Visual Concurrency
Anyone who has played football (American, Australian, Rugby, or Soccer) knows that you need to keep track of each other player on the field, as well as the ball, the referee, and yourself. Likewise, each musician in an orchestra must synchronize with the conductor and each other musician. It therefore seems that many people are actually very good at dealing with concurrency.
However, although most of us can "see" any number of written sentences at the same time, few of us could "read" more than one sentence at the same time. Even the most experienced stock market traders would probably be challenged by three or more simultaneous telephone calls; our linguistic skills (textual and verbal) appear to be more or less sequential.
This should not be surprising because linguistic meaning is heavily dependent on word order, and so "watching" a football match is a very different experience from listening to it on the radio, or reading about it in a paper. Films can usually tell stories in less time than books because apart from anything else, the information bandwidth is higher (but of course that does not necessarily make it a more satisfying aesthetic experience!).
When Is Visual Programming Applicable?
Few would disagree that the best way to express an FFT or Matrix inversion algorithm is almost certainly textual; VHDL is now used by electronics engineers for the domains in which it is appropriate. In the same way that the electronics industry now adopts a hybrid visual/textual approach, software engineering can also benefit from the same specializations.
Few people would disagree that GUIs are best developed using graphical drag-and-drop metaphors, class designers are also making increased use of visual semantics, but equally few people would try to use pictures to describe a recursive quick-sort algorithm. TPL, TBB, and Blueprint are clearly not mutually exclusive.
Conventional text programs derive much of their "meaning" through their statement ordering, whereas an electronic circuit diagram derives equivalent meaning through its connectivity (which can branch and merge). In the specific cases where statement order doesn't matter, then there is typically potential for concurrent execution.
Most text languages are primarily concerned with algorithmic logic (usually branching on particular data values) and don't have an intuitive way of expressing concurrency in general, particularly the more complex irregular dependencies like "f3 can be executed when f1 and f2 complete, but f1 can't be executed while f0 is executing".
Whilst Parallel-For, Map-Reduce, and other existing mechanisms can address "regular" parallelism in an effective "bottom-up" manner, the "futures" approach to irregular problems that involve more than half a dozen concurrent threads of execution can be difficult to conjure with.
Parallel Recent Articles
This month's Dr. Dobb's Journal
Most Recent Premium Content
- November - Mobile Development
- August - Web Development
- May - Testing
- February - Languages
- Open Source
- Windows and .NET programming
- The Design of Messaging Middleware and 10 Tips from Tech Writers
- Parallel Array Operations in Java 8 and Android on x86: Java Native Interface and the Android Native Development Kit
- January - Mobile Development
- February - Parallel Programming
- March - Windows Programming
- April - Programming Languages
- May - Web Development
- June - Database Development
- July - Testing
- August - Debugging and Defect Management
- September - Version Control
- October - DevOps
- November- Really Big Data
- December - Design
- January - C & C++
- February - Parallel Programming
- March - Microsoft Technologies
- April - Mobile Development
- May - Database Programming
- June - Web Development
- July - Security
- August - ALM & Development Tools
- September - Cloud & Web Development
- October - JVM Languages
- November - Testing
- December - DevOps
Dr. Dobb's Journal
Dr. Dobb's Tech Digest