LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 05-01-2011, 10:06 AM   #1
Jack Guo
LQ Newbie
 
Registered: May 2011
Posts: 1

Rep: Reputation: 0
mq_receive consumes too high CPU time


Hi,

When I run the below test, occasionally the CPU time of process B is high.

Process A:
for ( unsigned long i=0; ; i++)
{
mq_send( mq_a, ...)
if ( ! (i/15) ) sleep for 1/1000 seconds
}

Process B:
while(1)
{
mq_receive( mq_a, ...)
}

In most of the testings, the CPU time consumted by either process A or B is quite low. But occasionaly (2 or 3 times in 10 testins), process B consumes a high CPU time, say 30% ~ 50%), mainly because of high sys time.

Could anyone share with me why the CPU time for process B is high? busy waiting the lock in kernel mode? And how to solve this issue?

The testing environment: CPU - 2 cores, linuex - redhat, message queue is NOT set to NONBLOKCED.

Thanks,
Jack
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Linux shell script .sh file consumes high memory dsksiva Linux - General 3 09-09-2010 07:12 AM
Select() call consumes CPU barunparichha Linux - Software 1 03-31-2010 07:14 AM
Kill process with high CPU usage after X time? touser Linux - Newbie 4 12-27-2009 09:52 PM
pdftotext consumes 100%cpu power alaios Linux - Software 1 04-02-2007 06:27 PM
beagle consumes cpu alaios Linux - General 6 12-16-2006 11:05 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 04:42 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