Boost logo

Boost :

Subject: Re: [boost] [Boost.Interprocess] Chronic performance on Win7
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2011-08-19 19:39:34


El 19/08/2011 12:52, Gav Wood escribió:

> Comments?

Thanks for the report. I must admit that process-shared synchronization
implemenation in windows is awful at best. I have some ideas to
implement those using named mutexes or events, but the fact is that I
don't know any open source that emulates PTHREAD_PROCESS_SHARED properly.

Sleep(0) is a problem because emulated mutexes can't implement Priority
inheritance (only kernel sync mechanisms can do that). Sleep(1) gives a
chance to lower priority threads. The spin count until 20ms depends on
the processor speed, which is not nice. Gav Wood (thanks!) has proposed
SwitchToThread but I read here that:

http://msdn.microsoft.com/en-us/library/ms686352%28v=vs.85%29.aspx

"Windows 2003 warning!
If you plan to use SwitchToThread inside a function that is going to be
called heavily, and your program is going to run on Windows 2003 server
(whatever flavor), you better be careful. SwitchToThread executes
painfully slow on w2003. My benchmarks show that a program running under
Windows XP can call a function that performs a useful job and has
SwitchToTherad on it, 40 million times in less than 2 minutes, while the
same process (running on the same hardware) will take almost 40 minutes
on Windows 2003."

I don't know if this is applicable also to other Windows versions.

Could you measure SwitchToThread version?

Best,

Ion


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk