Question

I am not sure if there is a certain hardware requirement on the CPU for multitasking? would it possible to do multitasking on 8086 chip?

Was it helpful?

Solution

Yes and no. There are several kinds of multitasking methods and each one requires a different degree of hardware support.

The 8086 chip is capable of multitasking but only a type of multitasking called cooperative multitasking (Early version of windows, ie, 3.0 used this). How it works is every program on the system must yield control back to the operating system every so often. The operating system in turn passes control onto the next program, which then must yield control back to the operating system after some time.

There are some obvious drawbacks, what if a program never yields control back to the operating system? Then the entire system hangs and there is no way to terminate that bad program.

The type of multitasking used today is called pre-emptive multitasking. It works by interrupting each program and passing control onto another one. Programs do not need to be aware of the multitasking at all, they can be written to assume that they are the only program running on the computer, so the actual multitasking element is transparent to them. This kind of multitasking needs hardware support in the form of what is called virtual memory. The operating system needs to be able to separate the addresses spaces of each program so that each program is not directly aware of each other. Then hardware interrupt timers are used to interrupt each program so that the operating system can move from one task to the next.

Different architectures have different methods of actually doing the task switching. It's possible to do it all entirely in software with just the support of virtual memory and hardware timers, however some architectures support constructs to simplify this process, such as x86 which has the Load Task Register. This isn't strictly necessary however to implement multitasking and most operating systems that I am aware of do their own task switching.

For more information on pre-emptive multitasking and how it works in the x86 architecture, I recommend this article: http://wiki.osdev.org/Multitasking_Systems

EDIT:

The MP/M-86 operating system used what can be considered a preemptive multitasking model on the 8086 by using a hardware timer to interrupt processes and move onto the next one, so the 8086 is capable of a form or preemption; however many of the same issues raised above are still a concern. For example, each process has access to other processes memory spaces. There is also nothing keeping a process from hijacking the system by disabling the hardware timer interrupt. In order to have a robust multitasking environment a large degree of hardware support is necessary.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top