Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how can I decrease my CPU usage

Status
Not open for further replies.

behrads

Vendor
Feb 24, 2001
2
IR
I am an UNIX programmer.
I have written many programs with gcc in SCO, Linux, Solaris, FreeBSD, UNIXWare…. But in very simple programs that have simple loops, my CPU process usage rises to 98%. How can I decrease my CPU usage to about 0% as other processes?

Thanks
Behrad

 
When ever possible, devide and conquor:
- Use MergeSort instead of Buble Sort, Insertion Sort or Selection sort when ever possible.
- Use Binary search trees as opposed to vectors.
- Use tail recurssion and an optimizer in stead of a loop when ever possible

Depending on prossessor:
- Instead of multipling/dividing by an even number, shift the bits for Intel chips PII or higher.
- Find online documents from the company that produces your target chip...
 
I don't know your program of course,but if your loops are endless,putting a sleep or usleep in them might perhaps help..
Greetz,

The Muppeteer.

themuppeteer@hotmail.com

Don't eat yellow snow...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top