Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Kernel thread migration
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
number_nine
Tux's lil' helper
Tux's lil' helper


Joined: 05 May 2005
Posts: 136

PostPosted: Tue Dec 18, 2007 5:11 pm    Post subject: Kernel thread migration Reply with quote

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
View user's profile Send private message
rommel
Veteran
Veteran


Joined: 19 Apr 2002
Posts: 1145
Location: Williamsburg Virginia

PostPosted: Tue Dec 18, 2007 6:57 pm    Post subject: Reply with quote

http://www.ibm.com/developerworks/linux/library/l-linux-kernel/
Back to top
View user's profile Send private message
gentoo_ram
Guru
Guru


Joined: 25 Oct 2007
Posts: 515
Location: San Diego, California USA

PostPosted: Tue Dec 18, 2007 10:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware All times are GMT
Page 1 of 1

 
Jump to:  
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