View previous topic :: View next topic |
Author |
Message |
xqz n00b
Joined: 04 Aug 2005 Posts: 7
|
Posted: Tue Sep 27, 2005 4:31 am Post subject: SMP Management |
|
|
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 |
|
|
ejmiddleton n00b
Joined: 12 Sep 2005 Posts: 34
|
Posted: Tue Sep 27, 2005 8:58 am Post subject: |
|
|
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 |
|
|
lightsout Tux's lil' helper
Joined: 13 Apr 2003 Posts: 113 Location: UK
|
Posted: Tue Sep 27, 2005 9:00 am Post subject: |
|
|
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 |
|
|
ejmiddleton n00b
Joined: 12 Sep 2005 Posts: 34
|
Posted: Tue Sep 27, 2005 10:08 am Post subject: This is how you do it. |
|
|
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 |
|
|
xqz n00b
Joined: 04 Aug 2005 Posts: 7
|
Posted: Tue Sep 27, 2005 2:52 pm Post subject: |
|
|
Thanks, much appreciated |
|
Back to top |
|
|
bitwise Tux's lil' helper
Joined: 20 Apr 2005 Posts: 104 Location: seattle
|
Posted: Tue Sep 27, 2005 5:58 pm Post subject: |
|
|
why would you want to? |
|
Back to top |
|
|
HackingM2 Apprentice
Joined: 26 Jul 2004 Posts: 245 Location: Cambridge, England
|
Posted: Sat Jun 03, 2006 3:57 pm Post subject: |
|
|
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 |
|
|
nephros Advocate
Joined: 07 Feb 2003 Posts: 2139 Location: Graz, Austria (Europe - no kangaroos.)
|
Posted: Sat Jun 03, 2006 4:04 pm Post subject: |
|
|
Very clever setup. Thanks for sharing _________________ Please put [SOLVED] in your topic if you are a moron. |
|
Back to top |
|
|
DaysSinceTheDoor n00b
Joined: 30 Oct 2004 Posts: 7
|
Posted: Mon Jun 26, 2006 5:12 pm Post subject: |
|
|
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 |
|
|
|