I have read that Windows 3.11 uses cooperative multitasking, which means that the OS does not do process scheduling whenever it wants, but rather the currently running process "yield" the execution to the OS whenever the process wants, and then the OS chooses the next process to run.

But what I want to know is what is this "yield" functionality, is it a Windows API function that a process must call in multiple places in the process's code?


2 Answers 2


It was done in the GetMessage call.

The heart of a windows application is something like:

while(GetMessage(&Msg, NULL, 0, 0) > 0)

Each iteration gets a message and dispatches it. If there isn't a message available, it blocks until a message is available. Under 16-bit Windows, the CPU was yielded while waiting for a new message.

Some other calls like Yield or SendMessage would work the same way. But GetMessage was the one that most GUI applications would have primarily used.


  • 2
    Right. I vaguely recall long ago tracing through a GetMessage call (in SoftICE) until it returned into another application. That's the way I remember win16 cooperative multitasking. When you call GetMessage() windows might return to some other app, process their message, then later return to you after some other app makes a yielding call. GetMessage() was not the only yielding call. GetMessage() made your app and other apps coroutines of each other.
    – joshp
    Jun 12, 2017 at 17:31

Aside from the explicit request to Yield(), there are other APIs provided by Windows which potentially have to wait for another process to provide an answer, like the heart of the message pump GetMessage(), asking a window for information with SendMessage() and many more.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.