Amiga Multitasking

by Eric Schwartz
from the AmiTech Gazette, November 2012

There are a few bits of minor news in the Amiga­-related worlds, mostly in the MorphOS realm this month. Outside that realm, the book "Commodore: The Amiga Years" has been pushed back to January. Hopefully it shan't be pushed back any further. Back to the Morph realm, new versions of the vector drawing program Steam Draw, along with an update to the "Ultimate Pack" MorphOS software compilation. The R300 video card found in supported Mac G4 Powerbook systems has been "fast-tracked" for 3D support in MorphOS, thanks to donations. Hopefully wireless networking isn't far away either. Also, a bounty has been set up to port MorphOS to G5 Powermac (a specific model, but hopefully the CPU support will enable a spread across at least a few G5 Mac models). Best of luck to those working these projects, and any who may benefit from them.

Continuing my examination of details from the Amiga past, this month I'll write about the multitasking OS. The Amiga operating system was a true first, being able to multitask, or run multiple programs at the same time, on a consumer platform. (QDOS, for the Sinclair QL came before, but was not very successful.) The only other multitasking systems available at the time then were large business or institutional machines running UNIX and similar operating systems that helped inspire the Amiga OS. Even in later years when multitasking operating systems were common, the Amiga OS stood out by its low overhead and ability to get by with less memory or drive space than others.

The Amiga used what was called preemptive multitasking, run by system software called Exec. In such a system, programs divide the available CPU resources according to their priority when actively running, as opposed to waiting around for a button or key to be pressed, or some other event to happen. Programs that make heavy use of the CPU are usually given a lower priority. This might seem counter-intuitive, but it helps insure that one program does not monopolize the whole system, turning it into an unresponsive block. The biggest pitfall of the multitasking system is that problems arise if different running programs step on each others' toes. If two programs try to access the same block of memory or use the same system resources at once, it would cause errors and confusion at best and bring down the entire system at worst. Because of this, Amiga programs had to be especially well-behaved to multitask. They had to ask permission from the system to use memory and other resources, and properly give them up when finished using them. It's almost like an internal bureaucracy. This took time and practice for programmers to get used to. Early on the Amiga took on a reputation for being crash-prone as the programmers worked out how to do things properly. In games, where speed and performance trumped all else, multitasking was usually tossed out along with most of the operating system, as negotiating for system resources would eat up too much time and processor cycles for 1980s game programmers.

Over the years, Windows PCs and Macs would try to catch up in the Multitasking game. Early efforts were clumsy compared to the Amiga, either "task switching," where multiple programs could be open at once but only one could actually run, or "cooperative" multitasking, where programs had to agree to share time and resources, often failing to do so. Instead of actively allocating or releasing memory as needed, Mac programs often had to have their total memory usage set at start, which led to problems when the estimates were poor. Eventually Windows (NT and 95) and Mac with OSX achieved full preemptive multitasking as well, thanks in no small part to standard availability of processors with included memory management units, which let the hardware do most of the hard work making sure different software tasks not step on each others' toes memory-wise. The Amiga started losing its multitasking advantage around this point, though having no real parent company didn't help either. Amiga made better use of smaller amounts of memory and drive space than the others, but that became less important over time as larger amounts were available for less. Amiga OS always had a stability issue, as it relied on all the software to behave, and any rogue task could conceivably take the system down with it. With the hardware support of an MMU, it became easier to shut down a bad program without it becoming a system-wide issue. Because the Amiga OS came from a time when MMUs were too pricey for consumer computers, it didn't have this luxury. Actually it could have if it did what Windows and Mac did. Their multitasking OS releases broke a lot of older software or weren't backward-compatible at all, and they relied on the software publishers to release new versions for the new system. Since Commodore was gone by 1994 and Amiga software publishers dropped like flies not long after, major everything­breaking changes were not really an option.

Sadly this carries some of the instability over to successor systems with Amiga legacy software support, such as Amiga OS4 and MorphOS. They do as much or more to be rock-solid stable as Amiga OS did before, even with MMU-aided CPUs, but errant old software can still cause problems as long as Amiga backward compatibility is needed to pump up the available software library. Sadly it's become a fact of life for us Amiga-and-compatible users. We might be less bulletproof than the big UNIX-derived consumer operating systems of today, but we were there running all our software at once damn near a decade before they were, and they're still hardly perfect (or completely bulletproof either, no matter what they say).