If I may kick several of you under the girdle, AmigaOS didn't do any protection either. Why didn't it suffer from these things, or if it did, isn't that because it was in a protected (fan-only) environment? Wouldn't it have been even worse than Windows had it been so widespread?Tim Robinson wrote: No, lack of memory protection was the main reason why Windows 3.1 was unstable (and it's the same main reason why the Win9x series was unstable too).
When implementing multitasking you have the choice to do cooperative, or cooperative with preemptive (you COULD do without cooperative, but that'd completely suck in terms of performance). Preemptive requires mutexes, semaphores and thinking whereas cooperative doesn't. If your code is fit for preemptive, it's always fit for cooperative (in terms of concurrency).In practice, programs use cooperative multitasking more often than preemptive. Every time you do a read(), or a select(), or a WaitForSingleObject() -- in fact, any time you issue a blocking call -- you are cooperatively multitasking. By calling a blocking function, you are saying to the OS, "I don't want to do anything until this function completes". During that time, the OS is free to schedule other threads as it wishes.
In other words, if you forgot an "UNTIL" in VB under the 9x series, you'd be hard pressed to get it to work again. I sure did find a good reason to quit basic forgood...Preemptive multitasking exists to correctly handle the case when two or more threads are non-blocked at the same time. For instance, if you had one program drawing a fractal, and another calculating pi, and another running Seti@home, you rely on preemptive multitasking to keep all three running at the same time.
Cooperative multitasking is based on the idea that programs cooperate and play nice. The real world is that programs do NOT cooperate, and most certainly do not play nice, intentionally or because of a bug. The only time cooperative is truly fit is when you are /SURE/ the only program that's ever going to run is going to be written by you or somebody trustable. Unfortunately, this is impossible except for pacemakers etc.
But I'm going off topic even more.
For DOS, it's useless to make a GUI. There are two parts about DOS, both of which you'll have to rewrite to get it to work. That's the IO interface which needs work for any half-new device, and the command line which is exactly what the gui is meant to replace.
Solution: make your own OS.