Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.programming.threads > #1500
| From | Melzzzzz <mel@zzzzz.com> |
|---|---|
| Newsgroups | comp.programming.threads |
| Subject | Re: Thread scaling in Windows |
| Date | 2013-05-31 04:18 +0200 |
| Organization | albasani.net |
| Message-ID | <ko919m$4ro$1@news.albasani.net> (permalink) |
| References | <XnsA1CFD0BECDBADmyfirstnameosapriee@216.196.109.131> <51a7c499$0$6565$9b4e6d93@newsspool4.arcor-online.net> <XnsA1D1132254871myfirstnameosapriee@216.196.109.131> |
On Thu, 30 May 2013 17:52:51 -0500 Paavo Helde <myfirstname@osa.pri.ee> wrote: > Marcel Müller <news.5.maazl@spamgourmet.org> wrote in news:51a7c499$0 > $6565$9b4e6d93@newsspool4.arcor-online.net: > > > On 29.05.13 19.31, Paavo Helde wrote: > >> We have a portable C++ app using Boost mutexes and doing some > >> memory > and > >> cpu intensive calculations. The problem is it seems to scale much > better > >> in Linux than in Windows. > > > > Either the different boost mutex implementation is the key or you > > are doing a job in the mutex, that is synchronized on Windows but > > not on Linux, like File I/O including close. > > I/O is likely not the culprit here, there is relatively little of it, > just reading the source data into memory. > > > Most likely you enter the mutexes very often during calculation. > > This > is > > bad practice. If you want to run in parallel, then run in parallel > > and do not talk to each other over an over. > > Mutexes are indeed entered quite often, but most of the cases there > should be no contention and the mutex is locked for a very short > time, like updating a shared object reference count by a > smartpointer. I have understood that mutex lock is next to harmless > if there is no contention, does this change in multicore? NUMA? No. If thread does not go to sleep it is slow but thread works. > > In the VTune Amplifier I see many "Synchronization context switches" > (about 1000 per second, 10 times more than "Preemption context > switches"). Are these caused by mutex lockings? Are these numbers too > large? Probably (Or conditions variables or such). 1000 times per second for a context switch I guess is plenty. That means your threads are mainly sleeping on some synchronization primitive... > > It also tells me that the CPI rate (cycles per instruction retired) > is too high (1.691, ideal would be something like 0.25) and lists > memory stalls as the first possible cause. That is probably caused by excess lock prefixed instructions... Culprit is probably how Windows implements mutexes. Probably mutex lock is better implemented in Linux, I guess. All in all you should try just empty threads without any locking, then add just locking without collisions and test. Then add locking with some collisions and test. You should see.
Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar
Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-05-29 12:31 -0500
Re: Thread scaling in Windows Robert Miles <robertmilesxyz@gmail.com> - 2013-05-29 17:26 -0700
Re: Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-05-30 16:11 -0500
Re: Thread scaling in Windows Gerald Breuer <Gerald.Breuer@googlemail.com> - 2013-05-31 03:44 +0200
Re: Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-05-31 00:29 -0500
Re: Thread scaling in Windows Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-05-30 23:28 +0200
Re: Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-05-30 17:52 -0500
Re: Thread scaling in Windows Melzzzzz <mel@zzzzz.com> - 2013-05-31 04:18 +0200
Re: Thread scaling in Windows Robert Wessel <robertwessel2@yahoo.com> - 2013-05-31 01:11 -0500
Re: Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-06-01 12:15 -0500
Re: Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-06-01 16:52 -0500
Re: Thread scaling in Windows [SOLVED] Paavo Helde <myfirstname@osa.pri.ee> - 2013-06-03 12:00 -0500
Re: Thread scaling in Windows [SOLVED] Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2013-06-04 08:16 +0000
Re: Thread scaling in Windows [SOLVED] Noob <root@127.0.0.1> - 2013-06-04 10:25 +0200
Re: Thread scaling in Windows Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-05-31 15:53 +0200
Re: Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-05-31 12:57 -0500
Re: Thread scaling in Windows Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-05-31 22:59 +0200
Re: Thread scaling in Windows Paavo Helde <myfirstname@osa.pri.ee> - 2013-06-01 03:06 -0500
Re: Thread scaling in Windows Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-06-01 15:20 +0200
Re: Thread scaling in Windows Drazen Kacar <dave@fly.srk.fer.hr> - 2013-06-02 06:35 +0000
Re: Thread scaling in Windows Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2013-06-01 12:34 +0000
Re: Thread scaling in Windows Marcel Müller <news.5.maazl@spamgourmet.org> - 2013-06-01 15:09 +0200
Re: Thread scaling in Windows Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2013-06-01 17:12 +0000
csiph-web