Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#9008 closed Bugs (fixed)

[Boost.Interprocess] conditions variables fast enough only when opening a multiprocess browser

Reported by: Marcello <marcello.pietrobon@…> Owned by: Ion Gaztañaga
Milestone: To Be Determined Component: interprocess
Version: Boost 1.54.0 Severity: Problem
Keywords: Cc:


Hi Boost team, getting a weird behaviour on XP SP3 Boost 1.54.0 (with stlport)

Interprocess library example with:


When running some speed tests the time between two messages (round-trip) is of 15 ms (quite slow for what I need), but if I open a multiprocess browser (Chrome or Firefox 4.0, not with IE8) the speed instantly increases to 1.5 ms which starts to be acceptable to me. If If I minimize the browser the program slows down again.

Any idea why is this happening? Is there any fix or workaround for this?

Attachments (0)

Change History (4)

comment:1 Changed 4 years ago by Marcello Pietrobon <marcello.pietrobon@…>

I've applied the workaround suggested by Gav Wood in and that seem to be able to completely fix the problem.

Even though this problem seems to be entirely due to the inner working of Windows OS, is it possible to optionally implement Gav's workaround in the library, despite all the sensible reservation expressed in the above post, considering that that gives an increase in performance up to almost 1000 times?

comment:2 Changed 4 years ago by Ion Gaztañaga

Component: Noneinterprocess
Owner: set to Ion Gaztañaga

I've replaced all thread_yield with a new yield(unsigned) call that is based on Boost.SmartPointer?'s "yield_k" functions. This function increasingly tries to use heavier wait functions. First mm_pause, then SwitchToThread/Sleep?(0) and finally Sleep(1).

Iteration thresholds are taken from Boost.SmartPointer? code, and those might not be optimal for all CPU types, number of concurrent threads, etc. I'll fix the bug with the commit, but reopen it if this doesn't solve the issue.

comment:3 Changed 4 years ago by Ion Gaztañaga

Resolution: fixed
Status: newclosed

(In [85401]) Fixes #9008

comment:4 Changed 4 years ago by marcello.pietrobon@…

I've run some tests on it and it has improved the performance, but not completely.

Clearly this problem is not limited to your interprocess library so I thought to open a different thread discussion for it i the forum:

I've done some profiling plus some tests and so it's clear to me that the test program is still slowed down around the ::sleep(1) instruction, and so the value 32 in yield.hpp needs to be replaced with a much higher value.

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain Ion Gaztañaga.
The resolution will be deleted.

Add Comment

E-mail address and name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.