Re: ::select() and threads question, hopefully posed better :-)
Re: ::select() and threads question, hopefully posed better :-)
- Subject: Re: ::select() and threads question, hopefully posed better :-)
- From: "Mark F. Murphy" <email@hidden>
- Date: Wed, 11 Apr 2007 13:16:34 -0700
At 12:41 PM -0700 4/11/07, email@hidden wrote:
I've a bunch of C++ code that runs on Windows and OSX. 99% of the
code is portable, and the 1% that isn't mostly has to do with file
operations (seeking the POSIX way is slow on Windows, so we had to
use the Win32 APIs for that stuff). Anyway, with such a large
majority of our code the same across both operating systems, I was
expecting to see more-or-less-comparable CPU usage. However, when I
run the code, I see the OSX version taking up 4-5x (or more,
sometimes 10x) as much CPU as it does under Windows -- this is on my
dual 2ghz G5 as well as my 2ghz Core Duo MacBook.
Usually when porting apps of this nature and run into issues such as
this, you have to look to see if calls are executing in the same way
on the new target environment.
My guess without seeing your code (and it seems others are guessing
this as well)... is that your call to select() is returning a lot
more on Mac OS X than it does on your Windows version.
Usually when you see CPU being churned in this way, it means there's
a tight loop occurring (which may or may not be valid depending on
your app). The loop that might be occurring is a return from
select() in Mac OS X when such a return would not occur in Windows.
In other words, Windows is blocking where as Mac OS X shows different
behavior, is not blocking, and returns.
Have you compared how many times you're calling select() in Mac OS X
versus how many times you call it in Windows?
It might give a glue if the two ports are vastly different.
mark
--
---------------------------------------------------------------------------
Mark F. Murphy, Director Software Development <mailto:email@hidden>
Tyrell Software Corp <http://www.tyrell.com>
---------------------------------------------------------------------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden