
Introduction |
| The Amiga, as we all know, is a multitasking computer. It can seemingly run multiple tasks at the same time, so we can get our work done quicker or listen to some music while we format our disks. In fact, our humble Amiga probably runs more tasks in the background than you may think. My Amiga currently runs 27 Tasks, of which I started only three myself. The operating system and user applications started the rest. |
| In this feature article we will examine how multitasking works on the Amiga and how to create programs which are themselves multitasking. The end result will be a multitasking helloworld program, which will print "Hello World" in two processes. |
Basics |
| At the basis of any multitasking system lies with the principle of timesharing. The computer shares the available processor time it has between one or more tasks. If this is done fast enough, the computer will generate the illusion of running more than one program at a time. |
| There are a number of ways to create multitasking. The most common two are Cooperative Multitasking and Pre-emptive Multitasking. Both these systems might also incorporate a system of task Priorities. |
Cooperative multitasking |
| In cooperative multitasking the operating system can run multiple tasks, but it will not interrupt a running task. This means a task will keep on running until it voluntarily releases CPU-time for other tasks. The most well known example of cooperative multitasking is of course Windows 3.1. |
Pre-emptive multitasking |
| In pre-emptive multitasking the operating system runs multiple tasks by forcing tasks to give CPU-time to other tasks. This means a task will only get a small amount of CPU-time before a new task is allowed to run. Examples of pre-emptive multitasking include Unixoids, Windows95/98 and of course the Amiga-OS. |
Priorities |
| In some cases having a timesharing operating system can cause some trouble, since you might have a task which needs to get more CPU-time than others, or a task which must be run at more regular intervals. The system most operating systems use for this is one of priorities. The task(s) with the highest priorities will get the most CPU-time allocated to them. This way Amiga-OS can assure us that we will have a moving mouse-pointer, regardless of system load, since the input.device ( which handles this and other things ) is ran at a higher priority than most other tasks. |
Please click here to continue.