The Differences between Circuits and Classes
While class instances are passive entities that are "executed" by one or more explicitly created threads, circuit instances can be thought of as active entities that execute asynchronously and communicate through their connections. Synchronization is mostly achieved through the use of high level operations like collection, multiplexing, distribution, repetition and their reciprocal operations; splitting, de-multiplexing, competing and reduction. Explicit locking is provided but is seldom required.
Circuit member functions (methods) can be multi-dimensional, and each element can own its own individual state; this provides implicit concurrency and in many cases replaces constructs like parallel_for. It is also possible to specify the number of times that member function elements can be re-entered simultaneously without blocking (reentrancy).
There is no limit to the concurrency that a circuit component or circuit instance can have. If a multi-dimensional component has multi-dimensional member components then the resulting concurrency will be the product of the two component concurrencies. If the application's synchronization logic permits two or more components to execute simultaneously then the resulting concurrency will be the sum of the two or more component concurrencies, and so-on. This means that concurrency can be incrementally realized and accrued in a top-down manner, rather than starting with low-level loops; but both approaches will work interoperably as appropriate (methods can contain TPL, TBB, etc).
Building Applications from Components
Circuit components are intrinsically "self distributing" and so developer code doesn't typically need to know anything about their internals in order to re-use them; it's usually just a case of connecting the appropriate input and output pins (a prototyped operation). Since most user defined circuits are arbitrarily compose-able, they can be archived into "topic" libraries and re-used across projects. This means that applications can be created by domain experts using a drag-drop-and-connect metaphor.
The example below shows a simplified military sonar system constructed from re-usable components (circuit instances).
The object-oriented model is conceptually asynchronous in that its actors can invoke each other's methods concurrently. In single-core systems, the OO model can be mapped to classes and synchronous invocation, but this approach does not work for multi-core and distributed systems because of the limitations of the stack based call-and-return mechanism. Applications using synchronous invocation are doomed to spend the rest of their life executing in a single thread or suffer huge upheaval on each platform change as the code is modified to break the application into chunks appropriate for that platform.
Blueprint provides an alternative to a regular class, called a "circuit". Circuits have many of the desirable properties of classes that allow code to be encapsulated and re-used but they are self-propelled rather than relying on thread(s) to drive their execution and they use connections instead of calling to invoke each other's operations. This means that complex applications can be built from composing any number of circuit instances, as required, and the computation will be automatically distributed across the available hardware with an even load-balance.
For More Information
- Multi-Core OO: Part 1
- Multi-Core OO: Part 2
- Multi-Core OO: Part 3
- Multi-Core OO: Part 4
- Multi-Core OO: Part 5
|To upload an avatar photo, first complete your Disqus profile. | View the list of supported HTML tags you can use to style comments. | Please read our commenting policy.|