DHGATE

SEARCH

Google

Friday, May 9, 2008

Methods of Multitasking

Multitasking refers to the running of multiple independent computer programs on the same computer, giving the appearance that it is performing the tasks at the same time. Since most computers can do at most one or two things at one time, this is generally done via time sharing, which means that each program uses a share of the computer's time to execute.
An operating system kernel contains a piece of software called a scheduler which determines how much time each program will spend executing, and in which order execution control should be passed to programs. Control is passed to a process by the kernel, which allows the program access the CPU and memory. At a later time control is returned to the kernel through some mechanism, so that another program may be allowed to user the CPU. This so-called passing of control between the kernel and applications is called a context switch.
An early model which governed the allocation of time to programs was called cooperative multitasking. In this model, when control is passed to a program by the kernel, it may execute for as long as it wants before explicitly returning control to the kernel. This means that a malfunctioning program may prevent any other programs from using the CPU.
The philosophy governing preemptive multitasking is that of ensuring that all programs are given regular time on the CPU. This implies that all programs must be limited in how much time they are allowed to spend on the CPU without being interrupted. To accomplish this, modern operating system kernels make use of a timed interrupt. A protected mode timer is set by the kernel which triggers a return to supervisor mode after the specified time has elapsed. (See above sections on Interrupts and Dual Mode Operation.)
On many single user operating systems cooperative multitasking is perfectly adequate, as home computers generally run a small number of well tested programs. Windows 95 was the first version of Microsoft Windows for the home user market which included full preemptive multitasking capability, although older legacy 16bit applications from Windows 3.0 still ran cooperatively via the 16bit mutext in Windows 95.
Windows XP was the first version of Microsoft Windows for the home user market which included full preemptive multitasking capability, since is was the first version of Windows NT designed for the home user market. Windows NT was originally designed with preemptive multitaking as a core feature, but was initially designed for professional users and business consumers.
Early UNIX also did not provide preemptive multitasking, as it was not supported on the hardware. It did however provide cooperative multitasking as it was designed from minicomputer concepts that expected multiple users accessing the system via remote terminals. Later UNIX was redesigned and written in C so that it could be ported to other hardware easier, and this is when UNIX was first capable of preemptive multitasking based on the hardware available.
Windows Vista is the first mainstream operating system that extends the concepts of CPU preemptive multitasking to the video GPU. With the intoduction of the WDDM (Windows Display Driver Model) in Windows Vista, the operating system has preemptive control for scheduling GPU operations. This is how Windows Vista can easily manage a 3D desktop metaphor while allowing 3D applications to run concurrently on the screen at the same time, or multiple 3D application at the same time onscreen, without being held hostage to 3D applcation cooperative yielding.
The WDDM in Windows Vista is technically advanced; however, it also hurt Windows Vista because the drivers available at the time of release were freshly written from scratch by the GPU manufacturers, and had no application optimizations like drivers from the previous version of Windows. Windows Vista drivers also added many other features to work with the GPU multitasking concepts, and these were very new to deal with in terms of how to effectively use them from the GPU manufacturer's viewpoint. After several months of real user feedback and time to adapt to the new features of the WDDM, GPU manufacturers started providing drivers that were finally able to perform as well or better than drivers from the previous version of Windows, while still providing all the new features of the WDDM to Windows Vista and video dependant applications like games.
Prior to Windows Vista GPU multitasking was cooperative when it was available, as OpenGL and DirectX applications had to yield the 3D aspects of the GPU to the OS and other applications, which resulted in a significant reduction in 3D performance unless the 3D application was specfically written to constantly yield as some 3D desktop composer software does.

No comments: