Results 1 to 2 of 2
Hello
I am having a problem while running my app in a shared environment because it is very cpu intensive. Is there anyway I can get the app to take ...
- 02-06-2008 #1Just Joined!
- Join Date
- Jan 2008
- Posts
- 22
CPU utilization time
Hello
I am having a problem while running my app in a shared environment because it is very cpu intensive. Is there anyway I can get the app to take it easy on the cpu (my coding in sleeps ets).
Here is what is happenning
I have about 16 socket connections , on which I issue a select statement and keep processing the messages from these sockets as and when they are received. The only problem is that I am being flooded with important messages which I handle very well but this sucks the cpu dry, and others on the machine start complaining.
I then resorted to something like this
Is there an alternate way to do this. I was told by someone that its not good to code in sleeps.Code://Induce a sleep every 4000 msgs to minimize CPU usage if((mmap_counter%4000 == 0) && !do_not_sleep) { oeslog(log_fp, LOG_STAT, "Sleeping for 4 secs;mmap_counter=%d",mmap_counter); sleep(4); }
thanks
- 02-06-2008 #2Hope this helps.Code:
man 2 nice man 2 setpriority
--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote