Multiprocessing

From iGeek
Jump to: navigation, search
Multiprocessing.jpeg
Mutliprocessing is the concept of using more than one processor (at the same time) to help you accomplish tasks. We sort of capped out (or the rate of improvement dramatically slowed) for single-processing, but the idea of getting computers to do more than one thing at once is still growing exponentially. So let's look at what this means.

Types of Multiprocessing

There are basically what I would describe as three types of Multiprocessing:

  1. Symmetric
  2. Asymmetric
  3. Specialized

Engineering is always about tradeoffs -- so implying that one is better than all the others is false. One type of multiprocessing may be better for some things than the others, but then there are usually cases where a different solution would be better for that other case.

Symmetry implies balance, reflection, or sameness. What this means to symmetric multiprocessing is that each processor can see and do the same things. From a hardware point of view this means that each processor can see the entire memory map (see all of the hardware). From a software point of view it means that each processor can be doing the same things (it can be running any task in the system).

Asymmetry implies imbalance, or some difference between the processors. What this means to asymmetric multiprocessing is that different processors do different things. From a design point of view this is often implemented so that one processors job is to control the rest (play traffic cop), or it is the supervisor of the others. Sometimes from a hardware point of view the other processors can't even see all areas of memory (they have to get the supervisor to give them what they need), or sometimes a processor is specialized to the point where it is responsible for doing only one thing in the system (like handling a task like sound, video, or some other specialized input or output).

A common type of Asymmetric multiprocessing is a GPU. The graphics processor is a specialized king of processor, actually hundreds of them, that each does similar things on different pixels at the same time. Your CPU may help keep the GPU fed, or interact with it -- but for graphics, the GPU often carries the heavy lifting.

In most computers today there is a lot of specialized processors doing specialized things. There are often graphics processors making your screen draw faster, sometimes there are individual processors for handling things like your "ports", sometimes there are sound processors, or speech processors, and so on. Heck, even my car has more than one hundred of these specialized processors all over the car. Sub-processors (or support chips) uses vary by need and implementation -- and it is always a balancing act for the designers between making the main processor do more (and reducing the complexity and cost), or offloading more to little specialized sub-processors (to try to increase performance by giving the main processor less work). Almost all computers have specialized multiprocessing going on -- so ironically, when people (geeks) talk about multiprocessing they almost never mean that type -- they are almost always discussing multiple primary (general purpose) processors.

Warfare

Humans love to have battles about "what is better". People make some absolute statement, or draw some line in the sand, and then defend that absolute view with some extreme attitudes. Geeks (programmers and engineers) are humans (contrary to what some might think) - and so they too go to war over ideas of what is better. One hotly contested issue is "Symmetric Multiprocessing" versus "Asymmetric Multiprocessing". Of course the truth is that each is better for some things, and worse for others, and what you are trying to do will greatly influence which is better for you. AMP can be better for specialized tasks, and very large scale multiprocessing (say more than 8 processors), while SMP is usually superior for small scale (say 4 -8 processors) and most common applications. But there are lots of crossovers and exceptions to the rules. Don't let geek hype and bias warfare influence what is important to you, which is usability, not some design warfare or hypothetically better technology.

The point

The point of multiprocessing is to make your computer go faster, by allowing it to do more things at once. To keep the processors busy you have to have things for each processor to do. Sometimes designers are trying to make the whole computer go faster, other times they just want to make some part run faster. Even in making one part faster, you are usually offloading the other processors from doing that task (and helping the whole). This balancing act is called "load balancing", keeping all the processors fed (busy), and making things go faster overall.

Some think that to use multiprocessing it requires that applications be completely rewritten, this is only partially true. To make an individual Application use multiple processors at the same time it usually means that the application has to be "threaded". Threads (or threading) are a way of dividing an individual application into many parts that each can be running at the same time. Once threaded, the threads can be divided up (doled out) amongst the processors, so that one application can be running parts (threads) of itself on many processors at the same time.

Note: there are other benefits of threading beyond multiprocessing; it helps uniprocessor systems as well, since it offers hint to schedulers, or allows the OS to better manage a program.

Just because an application is not multithreaded does not mean that a user won't see any benefit from a multiprocessing machine. Each app, may not be able to send parts to each processor, but there are many Apps, that can go to different processors.

Think of all the things your computer is trying to do, and all the applications (or sub-applications) your computer might be running at the same time. If you are running three different applications at the same time, MP can devote a processor to each of those Applications. That means that each Application can run faster (smoother) because the computer is load balancing between all the Applications being run -- so you can see some nice results depending on how you work.

Some key Applications (like the Operating System itself) are doing many things. Think of some parts of the Operating System can be threaded, which will give you performance benefits. Think multi-media like sound, video, 3D and other resource intensive things. There are many parts of the Operating System that can be optimized and tuned like this. You could have all the networking running on one processor, all the file copies and other functions on another, speech recognition running on another, and so on. Each can take time on different processors, or divide themselves among multiple processors. It doesn't usually divide up as one task per processor -- but there are many ways to share the workload among many processors.

Conclusion

The most important part of MP is how well the Operating System itself, and a few key Applications will utilize it, not which type you are using.

Multiple processors help performance, geek-wars are just fought over how much, and what areas to speed up first or the most. Apps that need it the most will be the first to utilize them, or utilize them better. Those that don't, won't; but then you probably don't need more than what a single processor can give you for that app anyways.

And the more powerful software gets, and the more advanced people get, the more programs they are running at the same time, and the bigger the positive impact of having multiple processors will mean to them getting work done. Users used to run a few programs at once, or in ancient times, only one at a time. Now days, my OS is running hundreds; and I'm usually running 10-15, not counting the many services and other things running in the background. And my computer is not a computer any more; it often has two or more main processors, along with dozens of little dedicated ones to do things like graphics, I/O device control, and so on. So all computers are becoming multi-processors. Heck, the average car has like 20 different computers all talking to one another. So multi-processing is here to stay, and will only get more prevalent as costs continue to go down.

Written 1999.07.06