Slashdot Mirror


How do Linux Threads Compare to NT Threads?

BurnMage asks: "I run a small network at a company that does heavy web and graphic work, as well as digital video production. The DV stuff is absolutely wonderful, cutting edge really nice hardware that costs thousands of dollars... and is only supported on the Windows platform. My personal experience with the machines has really been a constant nightmare until recently; we have gotten things running relatively smoothly. We use the DVRex and RexFX from Canopus, beautiful stuff and great tech support... but a few small messages asking why not port to Linux had a couple people muttering that threads in Linux 'aren't properly implemented'. I have also heard the same about NT. What's the story? I want a clear answer to post on their site."

1 of 6 comments (clear)

  1. Looks like your co-workers read Russinovich by tilly · · Score: 5

    Linux threads are fine. The following letter may be a good thing to point to. And here is a follow-up.

    The basic story is that Linux, unlike most operating systems, does not have a hard distinction between a thread and a process. Instead it has the idea of a context of execution, and with the clone() call a context of execution can reproduce a copy of itself, and decide how much is copied. The last is important, clone() can be anything from spawning another thread to a traditional fork.

    This threading model is somewhat different than what most operating systems provide, but it is quite sufficient to provide a full POSIX thread implementation with very good speed on a context-switch between threads or processes. (In fact Linux does a faster context switch between processes than most operating systems do switches between threads on the same hardware.)

    By contrast NT has a different problem. NT has tremendous difficulty with processes. The time to create a process is abysmal. Context switches are not cheap. And once you start paging, the paging algorithm has beeen found to literally worse than straight chance!

    However NT has a pretty good time on context switches between threads and (on paper) some nice specs for working with them. But NT's threading model is somewhat different from the POSIX model and anyone who is experienced with Microsoft knows that what is on paper and what really happens are not always the same...

    Cheers,
    Ben Tilly

    --
    My usual seat in the cluetrain is at A HREF="http://pub4.ezboard.com/biwethey.ht