LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-10-2012, 11:58 PM   #1
chaits3
LQ Newbie
 
Registered: Oct 2012
Posts: 1

Rep: Reputation: Disabled
What type of mutex which when acquired doesn't hog CPU resources.


For my application I am currently using a ACE Thread Semaphore which is acquired for 2 minutes and after a timer expiry i gets released. I see that this is unnecessarily hogging CPU resources. Could any1 please recommend other way to do the same thing without hogging CPU resources when acquired.
Also, is there some way in which i spawn a thread say in idle mode when it is not doing anything until signaled, with an optimized CPU resource utilization.
 
Old 10-12-2012, 02:29 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,846

Rep: Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309Reputation: 7309
I think the semaphore itself is not able to do that.
Idle threads should use sleep, yield or probably join.
 
  


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
gam_server CPU Hog SqdnGuns Slackware 14 06-12-2019 01:27 AM
Opera CPU hog? SVwander Linux - General 3 10-11-2006 05:22 AM
frostrwire cpu hog lou Linux - Software 4 03-28-2006 08:36 AM
frosrwire cpu hog lou Linux - Software 2 03-26-2006 07:59 PM
Resources hog in KDE in Mandy 9.2 rdoucet Mandriva 2 11-17-2003 02:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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