If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

User threads versus kernel threads

Okay, multithreading 101: threading can be done either in user mode or kernel mode, or some combination thereof. The advantage of user mode threading is that you don't have expensive kernel-mode function calls to worry about. The advantage of kernel mode threading is that a blocking kernel call can be made to block only one thread rather than the entire process.

What I'm not entirely clear on is to what degree each of the various threading packages uses each paradigm, and what optimization options are available when, for instance, you know that user-mode synchronization is good enough and you don't want to pay for a kernel call.

Re: User threads versus kernel threads

First of all, user mode "threads" (fibers) are not actually threads in the sense that they do not allow one to utilize parallel hardware. They are useful only as a replacement for explicit state machines and continuations. They are no more than "a syntactic sugar" in the context of parallel hardware.

Moreover, provided cooperative user mode scheduling blocked fiber does not have to block the entire underlying thread. Take a look at a Windows 7 UMS (user mode scheduling).

As a bottom line. If you need to utilize parallel hardware you must use kernel threads. User threads is a mean for program structuring and have nothing to do with concurrency.

There is also quite popular nowadays abstraction of tasks, which are basically lightweight user threads. Modern libraries usually use kernel threads for concurrency, and tasks (which run on top of kernel threads) for program structuring.

* The Perfect Platform for Game Developers: Android
Developing rich, high performance Android games from the ground up is a daunting task. Intel has provided Android developers with a number of tools that can be leveraged by Android game developers.

* The Best Reasons to Target Windows 8
Learn some of the best reasons why you should seriously consider bringing your Android mobile development expertise to bear on the Windows 8 platform.