+ 1
Threads type and core and context switching
Thread in c++ created are user level thread or kernel level thread ? Also, if those threads are always doing context switching or can work on different core if available ? If they can be on different core , our memory of one perticular process is accessible to all cores or one or two? We can't be sharing process memory to all cores. Right ? Also, thread are example of concurrency or parallelism ?
6 Respostas
+ 1
Wow! I bet you won't find an exhaustive answer to your question here. It assumes the deep understanding of this topic from the responders. :)
I tried to answer your question, but after some time trying to find proofs to my answer, I realized that I'm not fluent enough in this topic. There's too much ambiguity in terms and fuzzy borders there.
0
I understand limitation any answer. Would like to get your answer when if it is half cooked and will have discussion going on
0
I think it is safe to say that threads are always created with the underlying API for threads in the OS, no matter what Interface you use: POSIX Threads, std::thread, boost::thread.
0
Okay. So they are always kernel level threads. Right ?
0
Right. I don't really understand what you mean by user level threads in this context.
To be at the same page, when you say "threads" which one of the implementations are you referring to? Std::thread from the C++ standard library?
0
Yes, std::threads are kernel level threads . Correct? We are not required to manage scheduling of these and context switching as well. So are there kernel level threads ?
If so, then how to ensure that each threads of some process do remain on one core only ? Or is it not in our control? Is process data not bound to each core ? Does sharing data on more core makes threads slow apart from context switching?