CPUs
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsComputer HardwareCPUs

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 19th, 2003, 06:01 AM
ygdrasyl ygdrasyl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: BCN
Posts: 84 ygdrasyl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 4 sec
Reputation Power: 7
Send a message via Yahoo to ygdrasyl
CPU usage in select based server.

Hi all,

I'm programming a kind-of-messenger server based on winsock and select to avoid blocking.
What I do is the classica:
while(1){
select(0,read,write,exp); //0 Win32
bla bla processing.
}
I've seen that when running the program consumes almost 50-60 % of CPU, the rest goes to CSRSS.exe. Is it normal? And, what is this CSRSS service?

Thanks.

Reply With Quote
  #2  
Old August 20th, 2003, 01:56 PM
achacha achacha is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 12 achacha User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 38 m
Reputation Power: 0
select in a tight loop will consume high CPU on windows, put a small sleep command in there or use the asynch model of WinSock if CPU time is a real issue.

As a general rule-of-thumb, using select() on windows is less optimal than message-pump based asynch system that WinSock has (sends a message when a requested event occured on a socket, instead of polling). On many systems select is implemented in terms on poll and can be quite CPU intensive.

Reply With Quote
  #3  
Old August 20th, 2003, 02:46 PM
ygdrasyl ygdrasyl is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: BCN
Posts: 84 ygdrasyl User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 1 m 4 sec
Reputation Power: 7
Send a message via Yahoo to ygdrasyl
Hi,

Thanks. I don't really know if cpu usage will be an issue or not. I'll try the sleep approach. Anyway, do you know any place where I can find examples of the Winsock event approach? I confess complete ignorance about that!

Reply With Quote
Reply

Viewing: Dev Shed ForumsComputer HardwareCPUs > CPU usage in select based server.


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT