View previous topic :: View next topic |
Author |
Message |
number_nine Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 05 May 2005 Posts: 136
|
Posted: Tue Dec 18, 2007 5:11 pm Post subject: Kernel thread migration |
|
|
In a multiprocessor system, does the kernel dynamically move threads to different processors on-the-fly?
For example, say I have two threads, t1 and t2, running on two CPUs, cpu1 and cpu2 (respectively).
Another process comes along and creates a huge iowait on cpu1. Will the kernel migrate t1 to cpu2? Or is t1 "stuck" waiting on the IO as well?
Thanks! |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
rommel Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
![](images/avatars/4044a6693d4383c435461.jpg)
Joined: 19 Apr 2002 Posts: 1145 Location: Williamsburg Virginia
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gentoo_ram Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 25 Oct 2007 Posts: 515 Location: San Diego, California USA
|
Posted: Tue Dec 18, 2007 10:52 pm Post subject: |
|
|
To more directly answer your question. Yes, the kernel can move threads between processors. It may decide not to do so (to prevent invalidating processor caches), but it could.
And your example is a bad example. If a thread is blocked waiting for I/O, it does not "tie up" the processor. It will be "sleep" until the I/O completes and will wake up when the I/O completes. While the blocked thread sleeps, the processor may be used for other things.
When it wakes up, the I/O thread may or may not be on the same processor. You don't need to worry about it as a programmer. That's what the Operating System is for. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|