Home Page The Club Computers News Links Glossary EYAWTK
Before Amiga Background ICS OCS ECS AGA ??? PPC
History Lorraine Amiga OS PMT Arexx Custom Chips Memory Kickstart

Pre-emptive Multi-Tasking

The first question must be "What is Multi-tasking", to which the answer is "The ability to run more than one program at the same time on a single computer". To do this the programs must be able to share memory and other resources, such as disk drives and printers, and do so in a way that does not conflict with the other. To a large extent this is the job of the Operating System, but programs also need to be written in such a manner than multi-tasking can occur, and this depends on the way that the Operating System performs multi-tasking. There are three common methods:

Task-switching (as used by Microsoft Windows prior to Windows 95)

Co-operative multi-tasking (as used by Mac-OS prior to System7)

Pre-emptive multi-tasking (as used by AmigaDOS, Windows 95 & later, and System 7 & later)

Task-switching is the simplest form of multi-tasking in that multiple programs can be loaded into memory, but only one can run at any time. In Windows 3.1 for example, if you switch from one window to another, the program associated with the first window stops as soon as the second window is opened (or selected), and remains stopped until you reopen the window, at which point the second program stops. In this way there is no contention for resources and the only problem may be where one program attempts to overwrite another program or its address space. This technique does not make very good use of the computer, because while the active task is waiting for keyboard responses or disk activity, no other programs can utilise the waiting time.

Co-operative multi-tasking is similar to task-switching but is performed by the operation system rather than opening windows. Each program is allowed to run for a specified period of time at which point it is stopped, so that another program can. When that program exceeds it time limit, the next program in turn is activated and so on until it cycles back round to the first program again. The correct name for this process is "time-slicing", where the slice that each program is allocated can be changed within the operating system. This technique makes better use of the computer, because while one task is waiting, the time slice can expire and pass control to another program. By the time the time-slicing process cycles back round the wait.

Pre-emptive multi-tasking on the other hand works on a priority system where the operating system is balancing the processing based on the relative priority of each program and the nature of the processing that it wishes to do. As soon as a high priority task issues a wait, the next highest priority task is offered the processor and so on until one of the higher priority tasks completes its wait, at which point that task is restarted and the process continues. This effectively means the computer can run multiple applications simultaneously in a way that each appears to run continuously, albeit a little slower than if it was running stand-alone, and in so doing make the maximum use of the processor time available. For example, when a program requests information from disk, this may take up to half a second (which is a long time in computer terms because computers can performs thousands of instructions per second), so the operating system can activate another program while it is waiting for the data to be returned from disk. The same thing applies to various other activities including reading keys from the keyboard when using a word processing program or whatever. The main disadvantage with this type of multi-tasking is that a single program can hog the processor and lock out other programs, so the operating system needs to allow for this type of processing to be interrupted or limited if necessary.

So the next question is "Do you really need it?", to which the answer is a definite "yes". On most Amigas there will typically be a number of programs running in the background at a lower priority than the other applications (such as menu programs and virus checkers etc), which are started when the Operating System is booted up, and most Amiga owners generally have at least another 5 or 6 running for one reason or another. The big advantage is that individual programs do not have to be large monolithic pieces of code - instead a number of small specialist pieces of code can work together utilising multi-tasking to perform the same tasks, and these are typically more reliable. In computer jargon, this type of program construction is called Object Oriented Programming.

One problem with many multi-tasking systems is the ability for one program to overwrite or corrupt another, and AmigaDos is no exception. This was principally due to the fact that the Motorola 68000 process did not have a Memory Management Unit (MMU). Some of the later processors did have an MMU but it was not well implemented within the Operating System, so still allowed some cross-memory problems, particularly in regard to Chip RAM.

Copyright 2005 Amiga Auckland Inc. All rights reserved.
Revised: September 25, 2005.