Reputation: 1374
Which is the threading model of c++ boost threading library use ?
1:1 (Kernel-level threading)
N:1 (User-level threading)
M:N (Hybrid threading)
The difference between these models (from wiki): http://en.wikipedia.org/wiki/Thread_(computing)#Models
I checked the boost site and it does not mentioned about the threading model it uses.
I guess it is a 1:1, because it does not provide function like yield
or reschedule
,but i'm not sure...
Upvotes: 5
Views: 661
Reputation: 7673
It is native threads, namely, it will use platform threads, at least in Linux, Windows and Mac.
As far as I know, the thread mapping is going to be 1:1 with a kernel thread in Windows, Linux and MAC for each spawned thread.
I am not sure if for other platforms it could be implemented in other ways, but I don't know of any non-kernel thread implemenation with boost.thread API.
For user-level "threads", with cooperative multitasking, boost.coroutine can be used. There is also the upcoming boost.fiber library, which is almost like boost.coroutine, but it adds a user-level "thread" (which is a fiber in library terminology) API and a user-level fiber scheduler.
Upvotes: 1