For more on this topic, see Using data parallelism in multicore LabView
For years, processor manufacturers have been improving the performance of CPUs by increasing clock speed. The latest trend, however, in processor technology is multiple cores. Essentially, this means manufacturers are packing several CPUs on one chip. Forget about the commercial dual- and quad-core machines currently available - Intel has promised an 80-core machine in the next five years.
Figure 1. CEO Paul Otellini Showcases Intel's 80 Core Prototype (Courtesy of slashgear.com).
It almost sounds too good to be true - a seemingly endless performance increase to run even the most demanding applications. And with this great increase, just imagine how fast existing programs will run. You might suspect that it is not quite this simple; you would be correct.
Programming applications to run on multicore processors is much tougher than programming for their single-core counterparts. While multiple applications can easily run on different cores, you must meticulously code applications to take advantage of multicore technology. This means that existing applications most likely see little performance increase, if any, when running on a modern multicore machine.
Designing Parallel Code
The first major challenge in programming a parallel application is identifying which sections of a given program can actually run in parallel with each other, and then implementing those sections in code. We can call each piece of code that is able to run in parallel with another piece a thread; therefore, an entire parallel application can be referred to as multithreaded.
Traditionally, text-based programmers have had to explicitly define these threads in their applications using APIs such as OpenMP or POSIX. Because text-based programming is inherently serial in nature, attempting to visualize parallelism in a multithreaded piece of code is difficult. On the other hand, by harnessing the graphical nature of NI LabVIEW, coders can easily visualize and program parallel applications. In addition, LabVIEW automatically generates threads for parallel sections of code, so engineers and scientists with little or no programming background can spend more time problem solving and less time worrying about low-level implementation of their applications.
(Click to enlarge)
Figure 2. Comparison of Multithreading in LabVIEW and Text-Based Languages.
A second challenge of multicore programming is thread synchronization. With tens or hundreds of threads running in a given application, you must ensure that all these threads work well together. For example, if two or more threads attempt to access a memory location at the same time, data corruption can occur. Clearly, identifying all possible conflicting pieces of code in an application is a daunting task.
By graphically creating a block diagram in LabVIEW, however, you can quickly take a specific task from idea to implementation without considering thread synchronization. Figure 2 shows an application in which both parallel sections of graphical code access a hard disk when writing a file. LabVIEW automatically handles the thread synchronization.
Figure 3. Simple Application Demonstrating Automatic Thread Synchronization in LabVIEW.