Re: Two questions about scheduling and threading.

From: Dan Noe
Date: Thu May 08 2008 - 11:47:44 EST


On 5/8/2008 11:15, Brian McGrew wrote:
Also, I know that we're supposed to sit back and let the scheduler do all
the work for us; but, in the 2.6.16.16 kernel, is there a way to assign a
specific thread and/or process to a designated processor??? I really need
to be able to do this because even with the preemptive scheduling, I'm still
real-time and it's not quite real-time enough!

There are some functions to set CPU affinity from user space:

sched_setaffinity()
sched_getaffinity()

And a user space program:

taskset

All have decent man pages. They'll allow you to pin a process to a particular CPU, or set the normal behavior, which is to try and keep a process on the same CPU as long as possible. There are some other utilities mentioned in the related section of the manpages - they allow you to tweak scheduler behavior.

Hope that helps.

Cheers,
Dan

--
/--------------- - - - - - -
| Dan Noe
| http://isomerica.net/~dpn/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/