LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-02-2010, 11:12 PM   #1
shahhe
Member
 
Registered: Nov 2003
Location: Chicago
Distribution: RHEL 5.4 on HP servers
Posts: 44

Rep: Reputation: 15
Unhappy How force multiple processes to run on separate processors?


Folks,

I have written a multiprocess application that uses message queue to communicate with each other.

Here is what I am doing, when I start my application it creates a message queue and forks a process. The child process reads multicast packets from the network and writes to message queue. The parent process reads packets from message queue and compares source ip and sequence number (it is part of payload) with last 64K packets received to see if it has received a duplicate packet. I am using message queue as a buffer because I do not want child process to drop any packets while it is comparing it with previously received packets. The message queue is large enough to contain 64K packets. To compare the old packets I am using array of structures as circular buffer. During a spike I may receive 100 - 120 packets per milli second.

When I run my application, the parent process keeps up with the child process, I can see that with "ipcs -q". After about 30 seconds it cannot keep up and the size of message queue keeps increasing until it is full. When I run "top" I can see that one CPU/core is hundred percent busy while other 7 cores are idle. It seems that both processes are running on same core and the child process gets interrupts everytime there is a packet on the net and starves the parent process.

I am running RHEL 5. The system has 24GB memory and my application is the only application running on it. It is a HP G6 server.

How can I find out if they are both running on same CPU/core?
How can I force them to run on different CPU?

I tried to use taskset command but it did not make any difference.

Thanks.
 
Old 09-02-2010, 11:39 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Do you have irqbalance running ? .. this will distribute interrupts across all cpu's

cheers
 
Old 09-04-2010, 05:43 PM   #3
shahhe
Member
 
Registered: Nov 2003
Location: Chicago
Distribution: RHEL 5.4 on HP servers
Posts: 44

Original Poster
Rep: Reputation: 15
I will check when I get back to office.

Thanks.
 
Old 09-04-2010, 07:40 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Regardless of the interrupts (independent) userspace processes should be farmed out across engines.
I was thinking maybe a coding problem - multi-threaded isn't automatically multi-processor aware (for example, how are you managing the queue ?).
But taskset not helping is a worry - did you check the return code to make sure it actually worked ?. I don't use taskset, I use cgroups to separate work, but children would be an issue (I usually isolate them to the same CPU subset). Could be done by pid.
"top" will show you the CPU last dispatched on - once running, enter "f" (lower case) then "j". Can be saved to a config file - see the manpage.
Another (better) option would be to look at installing collectl - it has very good processes based data if you have the kernel support in.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
John the Ripper brute-force attack and multi-core processors m4rtin Linux - Security 2 02-19-2010 06:02 AM
how does the OS handle multiple processors? mkrems Linux - General 3 05-01-2008 09:20 PM
Multiple processes open when java app is run ciuc Slackware 3 02-02-2007 03:17 PM
Load Average with Multiple Processors The00Dustin Linux - Software 5 05-03-2006 08:21 AM
Multiple Processors KneeLess Linux - Hardware 1 08-22-2003 08:23 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration