Non-preemptive multitasking


Now that memory is more prevelant and we have powerful multi core CPU, can we get non-preemptive multi tasking?

Why was this concept bandpned?

Comments (23)

23 responses to “Non-preemptive multitasking”

  1. jimchamplin

    In reply to hrlngrv:

    Did Xenix offer preemptive multitasking on the 808x? I can't remember off the top of my head.

  2. waethorn

    Does anyone want to describe how preemptive multitasking relates to CPU prefetch and look-ahead? You know, the thing that gives modern CPU's their "secret sauce" to getting faster burst speed over non-indexed lookups that is the cause of all of the CPU security problems discovered in the past few years?

    • beckoningeagle

      In reply to Waethorn:

      It doesn't. The multi-tasking happens at the OS level where it schedules the use of the CPU by the different processes. The pre-fetch and look-ahead happens in the processor to execute these instructions faster by taking shortcuts such as branch prediction.

      • waethorn

        In reply to BeckoningEagle:

        Well considering that mitigation can be bandaged up with software, albeit with a huge performance hit (hardware fixes via firmware patches still slow things down, although not as much), I'm not convinced the design of the software around hardware features isn't part of the problem. Branch prediction doesn't exist in every processor either. But where it does, it leaves a big security hole open. SMT/Hyperthreading and VT are just a catalyst.

    • wright_is

      In reply to Waethorn:

      They aren't really related. In fact, the less multi-tasking a processor does (regardless of the sort), the more efficient the look-ahead works (and the safer it is, because you are not sharing the processor between tasks).

      Look-ahead still works with multi-tasking, but it needs more cache and better branch prediction. And that is what causes the problems with Spectre & Co. The processor design is optimized for performance, whereas in a modern OS you need to optimize for security.

      But who is going to buy a "slower" PC next time round, just because it is "safer"?

      • waethorn

        In reply to wright_is:

        But who is going to buy a "slower" PC next time round, just because it is "safer"?

        Anyone concerned with security and is fed up with the cutting of more and more corners on modern CPU architecture.

        Any anyone why they buy systems from companies like Purism and System76 with older processors and Intel ME completely disabled as well as open source firmware (albeit with Intel's FSP as a binary blob which is still a requirement because Intel still won't allow outside code auditing by open-sourcing it).

  3. ErichK

    In reply to hrlngrv:

    It really seems like over the years of its lifespan, the percentage of applications that existed that "behaved well" by only calling DOS and BIOS function calls were in the single digits.

  4. jimchamplin

    You're talking about cooperative multitasking. Windows 3.x and the classic Mac OS used this system... and it stinks. One errant application can hog the CPU, and if it crashes, control doesn't get returned to the OS. On a single-core system that means the whole system's dead. On a multicore system...

    ... I honestly can't see it going any different. Lose a core?

    Cooperative multitasking is simply inferior.

    • ErichK

      In reply to jimchamplin:

      I was just about to ask you why we didn't just do pre-emptive multitasking right from the start, but it looks like that's been answered -- for PCs it was too processor intensive...?

      Boy when I bought my boxed copy of Windows 95 when it came out and I saw that it said "Pre-emptive Multitasking" right on the package (for 32-bit apps, anyway), I breathed a sigh of relief and said, "Finally."

      • jimchamplin

        In reply to ErichK:

        Some systems did, but it really depended on the CPU. Amigas did preemptive on the 68000 while Mac Systems 1-6 were cooperative mainly because the system was designed to only run a single application at a time. Tools like Switcher and Multifinder added more modern abilities but even then it was only task switching only one application had control at a time. System 7-OS 9.2.2 were fully cooperative. On the other hand, A/UX which was Apple's GUI-based UNIX was preemptive.

        Some versions of UNIX I think could handle preemptive multitasking on relatively lowly hardware. Don't quote me on that.

        Edit: Minor typos.

  5. harrymyhre

    What I don’t like about today’s systems is what happened while I was typing the first message. A background process did something to my browser session while I was typing.

    we have notification centers now so nothing should be allowed to take away the focus from my application. But it happens all the time. I never even used OS/2 but I knew exactly what they were trying to do.

    • jimchamplin

      In reply to Harrymyhre:

      OS/2 was preemptively multitasked. Both at the OS/2 prompt and in the Presentation Manager/Workplace Shell.

      And @hrlngrv is correct. That's not the multitasking model, that's software design.

    • hrlngrv

      In reply to Harrymyhre:

      Sounds like you mean focus stealing. That's not the OS's fault. That's ill-behaved application software including extensions. Well, semantics: if an OS provides a mechanism for one process taking focus without explicit user interaction, then the OS provides the mechanism for focus stealing, but it's not the intent of the OS developer that processes steal focus when actual users are actively interacting with another process.

  6. wright_is

    Are you talking co-operative, as in Windows 3, task switching (as in Mac System pre OS X) or do you mean a real time kernel?

    Co-op and task switching were dropped for good reasons, as @jimchamplin says. Mainframes, with hundreds or thousands of users use pre-emptive multi-tasking long before Windows tried multi-tasking. Windows 3 did co-op, because the processor wasn't powerful enough for the overhead of pre-emptive. As soon as they could write a dedicated Kernel that could do pre-emptive multi-tasking and the processors were powerful enough, they switched (Windows NT). Windows 9x lagged behind for a long time, due to compatibility issues, but it was eventually dropped for "real multi-tasking".

    Microsoft did play with a real time Kernel for Windows, but it was very niche and never mainstream - most tasks just don't need it.

    Linux has a real time Kernel option, as does QNX. They are certified. But, again, it only has limited use. Mainly things like automotive or industrial controls. Normal computing just don't need this level of control - it can actually have negative consequences for a normal, desktop operating system.

  7. hrlngrv

    What do you believe is wrong with preemptive multitasking?

Leave a Reply