Join Patrick Royal for an in-depth discussion in this video What is parallel processing?, part of Java EE Essentials: Servlets and JavaServer Faces.
- View Offline
If you've done any programming meant to run on servers or clusters, then you've probably heard about parallel processing. But what exactly is parallel processing? Why is it so important? These are some of the questions that will be answered in this video. Let's start with the first one. Parallel processing refers to a programming structure wherein a single program is run by multiple CPU cores at the same time. Depending on what the program does, and how it works, this can lead to massive gains in speed. Of course, you might wonder why we bother working so hard to develop better methods of parallel processing.
Why not just focus on building faster single core CPUs? For decades, that was exactly what happened. There was even a law coined to describe the process. Moore's law, which asserted that the number of transistors on a given area of a computer chip would double every 18 months. This means that the overall processing speed would also double every 18 months. Moore's law largely held true for many years, but eventually designers began to run into insurmountable problems with cooling such dense transistors. And the speed of light was a hard cap on the size of a chip, so they couldn't just make chips larger.
In order to keep making gains in speed, computers had to switch from having one extremely fast core to having multiple cores that could operate in parallel. Now that a workable solution has been found for computer hardware, it falls to us programmers to develop the software to match it. Once you get used to it, writing programs to run in parallel isn't difficult, but it requires different thought processes than sequential programming. The first thing to do is to figure out what exactly can be parallelized. If one part of the program depends on the result of another part, then the second part cannot run until the first part is complete.
On the other hand, most programs have large sections of code that can be run without reference to one another and then can combine their outputs. The objective of parallel programming then is to identify the parallelizable sections of your code and then set them up so they can run as efficiently as possible on multiple machines. With enough processors, eventually the parallelizable section takes essentially no time. So the time to run the program is just equal to the time to run the non-parallelizable section.
This concept known as Amdahl's law, is a great way to quickly estimate how much speed can be gained by parallelizing an algorithm. These are the basic techniques behind parallel processing. In the next video, we'll look at some of the techniques that are specifically applicable to Java servlets and faces.
- Creating simple Java EE servlets
- Setting up a JavaServer Faces application
- Developing managed beans
- Working with web context
- Handling servlet life-cycle events
- Developing parallel-capable servlets
- Optimizing Java EE code
- Enabling security
- Creating custom components and renderers