Blackboard

Definition
Top-down and bottom-up processes codepend on each other to provide data. Therefore, they share a common data repository (blackboard). A scheduler is used to prioritize the claims to the blackboard.

The problem domain for this pattern has multiple modules working together, each working on its own part of the solution. The modules work concurrently and the output of one module serves as the input for another module. Each module is dependent on one or more other modules to deliver part of the solution and the modules can't operate sequentially, it's both top-down and bottom-up.

The blackboard metaphore is from a classroom situation. The teacher is solving a problem together with her students. She asks them for input. Multiple students raise their hand and one is picked by the teacher. The student approaches the blackboard and writes down some information that helps to advance the solution a bit. Then the next one is called. The students are knowledge sources. The teacher is the scheduler.

Blackboard architecture diagram

The Blackboard is the common datastructure of the Knowledge Sources. The blackboard is able to represent all states of some problem space. The blackboard contains several levels of description with respect to the problem space. These levels may have several relationships with each other, like is-part-of. Levels are parts of the same datastructure. If separate datastructures are needed, the blackboard is divided into panels. Each panel in turn may contain several levels.

Blackboard panels

The Knowledge Source is a component that adds to the solution of the problem. It may be anything that reads from some level of the blackboard and suggests some change to parts of the blackboard. Its most common form is the production rule. Knowledge Sources are completely unconnected to other Knowledge Sources.

The Scheduler determines which Knowledge Source gets the chance to change the blackboard. Every execution cycle, it notices changes to the blackboard, activates the appropriate Knowledge Sources, selects one of these and executes it.

How does it work?

Running the program having this architecture, entails continually executing the execution cycle (control, cycle). These are the steps that are continuously executed during the cycle:

  1. The preconditions of all Knowledge Sources are checked.
  2. The Knowledge Sources that match are added to some datastructure in the Scheduler. They are added to the once that are left from the last cycle.
  3. The Scheduler determines which of the Knowledge Sources is chosen for activation. The chosen Knowledge Source is activated and its actions are executed. This results in changes in the blackboard.

A remark: when the Scheduler selects a Knowledge Source, it may have been in the datastructure for many cycles. In the meanwhile the blackboard has changed. So the preconditions need to be checked to be sure they are still valid.

Examples

A common example of this pattern is in speech recognition. Separate threads can process different parts of the sound sample, updating the blackboard with words that have been recognized. Then another process can pick up these words and perform grammar and sentence formation. Meanwhile more words and meanings are coming in, and eventually even higher level processes can pick up the formed sentences and various alternative guesses and begin to formulate it's meaning, then further intelligence systems can start to choose the most appropriate answer. All these systems have access to the blackboard and work together through it's central platform. [2]

  • Hearsay-II, a speech recognition program. Speech can be recognized at several levels. For each of these levels production rules exist.
  • The Global Workspace Theory of human consciousness

Where does it come from?

The blackboard is developed in the early 1970's for Hearsay-II. Its purpose was to interpret spoken sentences, in order to query a database. The speech signal was interpreted in several levels ranging from acoustic signal parameters to complete sentences.

The architecture is an extension of the Production System. In Production Systems there is also a common data structure, called working memory. It contains production rules, rules that execute any number of actions, when their preconditions are fulfilled. These rules fire directly. The blackboard architecture adds a controller to this system and allows for more flexible ways to change the common datastructure.

When should you use it?

  • The problem space should be factorable into separate parts.
  • The problem requires different forms of approaching the problem, like bottom-up and top-down reasoning.

Problems

  • It seems to me the main idea behind this architecture is to allow for complicated control structures in choosing which rules to fire. However, it remains unclear to me what kind of heuristics to apply in this selection. Most importantly, if we just select the first Knowledge Source in the queue, there is no need for this complex architecture. Unless you have a fairly good idea about these selection criteria, the architecture may be overkill.
  1. Wikipedia
  2. Microsoft TechNet