View Single Post
  #112   Report Post  
BillW50
 
Posts: n/a
Default Cooperative and Preemptive Multitasking [ Why aren't computer clocks as accurate as cheap quartz watches?]


"Bob Masta" wrote in message
...
Date: Sun, 30 Oct 2005 13:35:58 GMT

On Sun, 30 Oct 2005 11:53:25 GMT, "BillW50" wrote:

All DOS applications ran under Windows 3.1 preemptively.


I hadn't heard of this before. Can you explain how it worked?


I'll try. grin

I had the impression that the DOS application took over and
Windows apps didn't get any time at all. If there were time
slices for Windows apps, do you recall how they did this?


Well the OS itself requires CPU time for itself as well. But we will
skip that part and just focus on the applications. Now Windows 3.1 (as
well as other Windows 16-bit) applications (which are cooperative
tasking) under W31/NT/W9x/W2K/XP always throws them into one single VDM
(virtual DOS machine). And if this is all of the applications running,
multitasking is generally just fine and runs very well. Although while I
have found it to be very rare, one bad cooperative application can ruin
it for the other cooperative applications.

Now add one DOS application which gets its own VDM. And this one DOS
application supposedly gets 50% of the CPU time while the total number
of the other cooperative applications shares the other 50%. Which can be
bad right? Yes it can be. But not always. As Windows 3.1, OS/2, etc.
tries to guess about these preemptive sessions when these DOS and 32-bit
applications are not really doing anything useful. Like running a
keyboard scan in a loop until it gets something. For example, WordStar
for DOS runs very well under Windows and OS/2. And it isn't using up 50%
of the CPU time in this example.

Now add a second DOS application. Thus the two DOS applications
theoretically gets 33.3% of the CPU each, and the cooperative
applications all have to share 33.3%. See how this does in those
cooperative applications?

All 16-bit applications (whether DOS or Windows) gets a VDM. Although
every DOS application gets its own VDM. 32-bit applications don't get a
VDM at all, but gets environment 32-bit subsystems instead. Which in a
weak way, might be thought like being VDMs as far as multitasking goes.

To really understand this stuff in detail, see like:

http://www.microsoft.com/technet/pro...8/proch36.mspx

______________________________________________
Bill (using a Toshiba 2595XDVD & Windows 2000)
-- written and edited within Word 2000