Grzyb wrote on 2023-06-14, 20:59:
I'm wondering about one thing...
- Windows 1.x/2.x/3.x all use cooperative multitasking, and so does Windows 9x for Win16 apps - Win16 apps are supposed to return control to the system pretty often, as already mentioned
- Windows NT uses preemptive multitasking, and so does Windows 9x for Win32 apps - it's not required for Win32 apps to interrupt long operations on their own, it's the system that's supposed to preempt the apps
I think that's right. Cooperative Multitasking, -or non-Preemptive Multitasking as some folks call it-, uses a more democratic approach.
There's a message-based system and applications are given time in a time-slice scheme (time sharing).
Though the second perhaps affects DOS programs (non-Windows programs) on Windows mainly.
The attachment timeslice.png is no longer available
Windows 3.x applications, by design, are supposed to give back control to Windows/CPU once they're finished.
However, some badly written or misbehaving Windows applications don't do this. They "hog" the system.
That's why Windows 3.1x had merely limited multimedia capabilities, also.
It could happen that two different tasks were competing for CPU time or failed to share the System Timer.
Keeping video and audio in perfect sync, thus wasn't easy sometimes, for example.
However, if only a few applications were running, Cooperative Multitasking could be quite quick,
if not quicker than Preemptive Multitasking. It depended on the situation. 🤷
Grzyb wrote on 2023-06-14, 20:59:
But what about Win32s apps?
Are they required to behave like Win16 apps?
Or is there preemptive multitasking for them in WIndows 3.1x ?
Well, yes, most of the time. Win32s sits atop of Windows 3.1x and translates Win32 API calls to Win16. And vice versa.
To my knowledge, Win32s compatible applications run in Cooperative Multitasking and share one single address space.
This means that Win32s compatible applications can talk to each other and use same DLL in memory.
This causes the special scenario that Win32s compatible programs can do many forbidden things that Win16 programs can do.
To my understanding, they can intermix 16-/32-Bit DLLs and do other funny things, for example.
That's something that isn't possible on Windows NT or Win 9x, making Win32s an exception.
Win32s also has a set of dummy functions that do nothing, except keeping Win32 applications from crashing.
The console output can be considered to be one of them, maybe. Win32 console programs do run on Win32s, but there's no i/o window.
For command-line utilities, this is still good enough, maybe. The do their job, then quit. Switches like "/ or - or :" are supported.
The attachment win32s_arch.jpg is no longer available
Edit: I'm speaking under correction here, of course. I'm not without errors, either. 🤷
"Time, it seems, doesn't flow. For some it's fast, for some it's slow.
In what to one race is no time at all, another race can rise and fall..." - The Minstrel
//My video channel//