Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
SMP Management
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
xqz
n00b
n00b


Joined: 04 Aug 2005
Posts: 7

PostPosted: Tue Sep 27, 2005 4:31 am    Post subject: SMP Management Reply with quote

Hello,

I was wondering if there is anyway to easily manage dual core processor, allow programs to 1 cpu and another to the other processor? thanks
Back to top
View user's profile Send private message
ejmiddleton
n00b
n00b


Joined: 12 Sep 2005
Posts: 34

PostPosted: Tue Sep 27, 2005 8:58 am    Post subject: Reply with quote

This is generally handled by the operating system (and will probably do a better job of allocating resources) but it is possiable. Take a look at the article on http://www.linuxjournal.com/article/6799 It has a command line tool for setting process affinity.
Back to top
View user's profile Send private message
lightsout
Tux's lil' helper
Tux's lil' helper


Joined: 13 Apr 2003
Posts: 113
Location: UK

PostPosted: Tue Sep 27, 2005 9:00 am    Post subject: Reply with quote

Under RHEL there is a command called "taskset" which allows you to bind processes to specific CPU cores. So this can do what you want, it just does't appear available under Gentoo.

May wish to google for taskset, see if you can find some more information it.
Back to top
View user's profile Send private message
ejmiddleton
n00b
n00b


Joined: 12 Sep 2005
Posts: 34

PostPosted: Tue Sep 27, 2005 10:08 am    Post subject: This is how you do it. Reply with quote

method 1
Code:
# emerge sys-process/schedtool

to set a process to run on CPU1
Code:
# schedtool -a 1 <pid>

to run a program to run on CPU1
Code:
# schedtool -a 1 -e <program>


method 2
Code:
# emerge sys-process/schedutils

to set a process to run on CPU1
Code:
# taskset -p 0x00000002 <pid>

to run a program to run on CPU1
Code:
# taskset 0x00000002 -- <program>
Back to top
View user's profile Send private message
xqz
n00b
n00b


Joined: 04 Aug 2005
Posts: 7

PostPosted: Tue Sep 27, 2005 2:52 pm    Post subject: Reply with quote

Thanks, much appreciated
Back to top
View user's profile Send private message
bitwise
Tux's lil' helper
Tux's lil' helper


Joined: 20 Apr 2005
Posts: 104
Location: seattle

PostPosted: Tue Sep 27, 2005 5:58 pm    Post subject: Reply with quote

why would you want to?
Back to top
View user's profile Send private message
HackingM2
Apprentice
Apprentice


Joined: 26 Jul 2004
Posts: 245
Location: Cambridge, England

PostPosted: Sat Jun 03, 2006 3:57 pm    Post subject: Reply with quote

Saburo wrote:
why would you want to?

Lots of reasons.

As an example I use Asterisk PBX software and Digium TDM interfaces which require very low latency. I have a multi processor system (2 x Pentium Pro 200) which, under normal circumstances, is far too slow to be usable for Asterisk. This is manifested by lots of clicking and dropouts on the line.

Closer examination of the problem revealed IRQ latency to be the problem. By setting the CPU affinity of all IRQs and processes to CPU0, and setting the CPU affinity for Asterisk and its driver to CPU1 the problems can be completely solved.

I can now hit the server as hard as I like and Asterisk just keep sailing along as if it is on its own server, which in some ways it is. :) In fact in some ways it is better than being on its own server as all the IRQs for disk/net access, etc. and processes for logging and TCP/IP, etc. are handled by a different CPU.
Back to top
View user's profile Send private message
nephros
Advocate
Advocate


Joined: 07 Feb 2003
Posts: 2139
Location: Graz, Austria (Europe - no kangaroos.)

PostPosted: Sat Jun 03, 2006 4:04 pm    Post subject: Reply with quote

Very clever setup. Thanks for sharing ;)
_________________
Please put [SOLVED] in your topic if you are a moron.
Back to top
View user's profile Send private message
DaysSinceTheDoor
n00b
n00b


Joined: 30 Oct 2004
Posts: 7

PostPosted: Mon Jun 26, 2006 5:12 pm    Post subject: Reply with quote

HackingM2,

We do this for the same exact reason... accept we are handling a much higher call volume. In order to squeeze every last possible call out of the system we loaded a stripped down gentoo install (no portage, gcc, etc) into ram using a modified initrd and ran that. Works great. The best part about doing it this way is that we have the linuxrc script of the initrd call schedtool and it executes init on the first core (we have four) so that the whole system is on a single core and we move asterisk and the zaptel driver to the other 3 once the system is up and running. Sound quality is amazing and we are recording both sides of every single phone call, using sox to merge them into one stereo wav file with the caller and the callie on their own channel, and compressing them with lame.
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