Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!cs.utexas.edu!uunet!mcsun!unido!gmdzi!strobl From: strobl@gmdzi.UUCP (Wolfgang Strobl) Newsgroups: comp.windows.ms Subject: Re: How are multiple Windows applications scheduled? Message-ID: <3272@gmdzi.UUCP> Date: 30 Aug 90 22:34:14 GMT References: <920@digi.lonestar.org> Organization: GMD, Sankt Augustin, F. R. Germany Lines: 35 cwinemil@digi.lonestar.org (Chris Winemiller) writes: >How does Windows 3.0 achieve the "simultaneous" execution of multiple >Windows applications? (Note: I am excluding "simultaneous" execution of >multiple DOS sessions in the 386 enhanced mode.) Must the Windows >applications be written in such a way as to voluntarily "relinquish" >control of the CPU occasionally? Or are the Windows applications >written as if each is the only one running on the CPU? In other words, >does Windows do non-preemptive "scheduling" or preemptive "scheduling"? Windows 3.0 does it the same way as Windows 1.0 did. Windows does non-preemptive multitasking. Task switches occur only if applications return control back to Windows. In fact, there is a API call named Yield(), but ... it's almost never used. This is because a Windows program is normally interactive and user driven, not data driven. There are a few "event" generators: the mouse, the keyboard, and the timer. All these events get time stamped and added to a "message queue". A Windows program is a "message loop" dispatching these messages to a set of "window functions" processing these messages and returning control back to Windows. As long as this processing is fast enough, there is no need to give control back to Windows in between. >Or is it some other scheme? I'd be particularly interested in comments >from those who have actually developed Windows applications. I don't >have the SDK and have not written any Windows applications (obviously), >otherwise I wouldn't need to ask! :-) Get "Charles Petzold: Programming Windows, Microsoft Press, ISBN 0-914845-91-8", it explains all this, and more. Wolfgang Strobl #include