[M3devel] thread local storage, but in C pieces of runtime... (jay, tony?)

mika at async.caltech.edu mika at async.caltech.edu
Fri May 10 17:22:47 CEST 2013


This is just one data point, but I remember testing the performance of thread locals
on pthreads, probably on an old FreeBSD system, and the performance was horrendously
bad.  There was a system call involved in obtaining the pointer to the thread-local
area.  I was had some clever algorithms I wanted to use thread locals for (since you
can do all sorts of things without locks then), but I gave up on it since it was way
more expensive than a lock on that system...

     Mika

=?utf-8?Q?Dragi=C5=A1a_Duri=C4=87?= writes:
>
>--Apple-Mail=_EEF8E283-B126-4B87-BA54-81432C085954
>Content-Transfer-Encoding: quoted-printable
>Content-Type: text/plain;
>	charset=utf-8
>
>It probably does=E2=80=A6 Because our interface to pthread specifics is =
>surely not inlined, and sp hacks most probably are. Still, to access =
>this C code, a procedure call is inserted=E2=80=A6 If sp hack is more =
>efficient even after that, then we probably need to think about =
>inserting such efficient handling into code we generate, in a way you =
>inserted ChecLoadTraceRef..something :).
>
>--
>Dragi=C5=A1a Duri=C4=87
>dragisha at m3w.org
>
>
>
>On Apr 30, 2013, at 9:21 AM, Tony Hosking wrote:
>
>> I used to use pthread specifics but I think jay changed it to C. Not =
>sure why unless compiler can generate more efficiently via sp hacks. =20
>>=20
>> Sent from my iPhone
>>=20
>> On 30/04/2013, at 3:42 PM, Dragi=C5=A1a Duri=C4=87 <dragisha at m3w.org> =
>wrote:
>>=20
>>> Is there a specific reason why TLS is done through C, and not through =
>pthread.(set|get)specific?
>>>=20
>>> dd
>>>=20
>>> --
>>> Dragi=C5=A1a Duri=C4=87
>>> dragisha at m3w.org
>>>=20
>>>=20
>>>=20
>
>
>--Apple-Mail=_EEF8E283-B126-4B87-BA54-81432C085954
>Content-Transfer-Encoding: quoted-printable
>Content-Type: text/html;
>	charset=utf-8
>
><html><head></head><body style=3D"word-wrap: break-word; =
>-webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">It =
>probably does=E2=80=A6 Because our interface to pthread specifics is =
>surely not inlined, and sp hacks most probably are. Still, to access =
>this C code, a procedure call is inserted=E2=80=A6 If sp hack is more =
>efficient even after that, then we probably need to think about =
>inserting such efficient handling into code we generate, in a way you =
>inserted ChecLoadTraceRef..something :).<div><br><div =
>apple-content-edited=3D"true">
><span class=3D"Apple-style-span" style=3D"border-collapse: separate; =
>color: rgb(0, 0, 0); font-family: Candara; font-style: normal; =
>font-variant: normal; font-weight: normal; letter-spacing: normal; =
>line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: =
>0px; text-transform: none; white-space: normal; widows: 2; word-spacing: =
>0px; -webkit-border-horizontal-spacing: 0px; =
>-webkit-border-vertical-spacing: 0px; =
>-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span =
>class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
>rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
>normal; font-weight: normal; letter-spacing: normal; line-height: =
>normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
>text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
>-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
>0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
>style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
>Helvetica; font-style: normal; font-variant: normal; font-weight: =
>normal; letter-spacing: normal; line-height: normal; orphans: 2; =
>text-align: -webkit-auto; text-indent: 0px; text-transform: none; =
>white-space: normal; widows: 2; word-spacing: 0px; =
>-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
>0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; =
>"><div>--</div></div></span></div></span><span class=3D"Apple-style-span" =
>style=3D"font-family: Helvetica; ">Dragi=C5=A1a Duri=C4=87</span><span =
>class=3D"Apple-style-span" style=3D"border-collapse: separate; color: =
>rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: =
>normal; font-weight: normal; letter-spacing: normal; line-height: =
>normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; =
>text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; =
>-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
>0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
>style=3D"border-collapse: separate; color: rgb(0, 0, 0); font-family: =
>Helvetica; font-style: normal; font-variant: normal; font-weight: =
>normal; letter-spacing: normal; line-height: normal; orphans: 2; =
>text-align: -webkit-auto; text-indent: 0px; text-transform: none; =
>white-space: normal; widows: 2; word-spacing: 0px; =
>-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
>0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; "><div><a =
>href=3D"mailto:dragisha at m3w.org">dragisha at m3w.org</a></div><div><br></div>=
></div></span></div></span></span><br class=3D"Apple-interchange-newline">
></div>
><br><div><div>On Apr 30, 2013, at 9:21 AM, Tony Hosking wrote:</div><br =
>class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><meta =
>http-equiv=3D"content-type" content=3D"text/html; charset=3Dutf-8"><div =
>dir=3D"auto"><div>I used to use pthread specifics but I think jay =
>changed it to C. Not sure why unless compiler can generate more =
>efficiently via sp hacks.  <br><br>Sent from my =
>iPhone</div><div><br>On 30/04/2013, at 3:42 PM, Dragi=C5=A1a Duri=C4=87 =
><<a href=3D"mailto:dragisha at m3w.org">dragisha at m3w.org</a>> =
>wrote:<br><br></div><blockquote type=3D"cite"><div>Is there a specific =
>reason why TLS is done through C, and not through =
>pthread.(set|get)specific?<div><br></div><div>dd</div><div><br><div =
>apple-content-edited=3D"true">
><span class=3D"Apple-style-span" style=3D"border-collapse: separate; =
>font-family: Candara; font-style: normal; font-variant: normal; =
>font-weight: normal; letter-spacing: normal; line-height: normal; =
>orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: =
>none; white-space: normal; widows: 2; word-spacing: 0px; =
>-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
>0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span =
>class=3D"Apple-style-span" style=3D"border-collapse: separate; =
>font-family: Helvetica; font-style: normal; font-variant: normal; =
>font-weight: normal; letter-spacing: normal; line-height: normal; =
>orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: =
>none; white-space: normal; widows: 2; word-spacing: 0px; =
>-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
>0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
>style=3D"border-collapse: separate; font-family: Helvetica; font-style: =
>normal; font-variant: normal; font-weight: normal; letter-spacing: =
>normal; line-height: normal; orphans: 2; text-align: -webkit-auto; =
>text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
>word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; =
>-webkit-border-vertical-spacing: 0px; =
>-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; =
>"><div>--</div></div></span></div></span><span class=3D"Apple-style-span" =
>style=3D"font-family: Helvetica; ">Dragi=C5=A1a Duri=C4=87</span><span =
>class=3D"Apple-style-span" style=3D"border-collapse: separate; =
>font-family: Helvetica; font-style: normal; font-variant: normal; =
>font-weight: normal; letter-spacing: normal; line-height: normal; =
>orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: =
>none; white-space: normal; widows: 2; word-spacing: 0px; =
>-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: =
>0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; "><span class=3D"Apple-style-span" =
>style=3D"border-collapse: separate; font-family: Helvetica; font-style: =
>normal; font-variant: normal; font-weight: normal; letter-spacing: =
>normal; line-height: normal; orphans: 2; text-align: -webkit-auto; =
>text-indent: 0px; text-transform: none; white-space: normal; widows: 2; =
>word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; =
>-webkit-border-vertical-spacing: 0px; =
>-webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: =
>auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div =
>style=3D"word-wrap: break-word; -webkit-nbsp-mode: space; =
>-webkit-line-break: after-white-space; "><div><a =
>href=3D"mailto:dragisha at m3w.org">dragisha at m3w.org</a></div><div><br></div>=
></div></span></div></span></span><br class=3D"Apple-interchange-newline">
></div>
>=
><br></div></div></blockquote></div></blockquote></div><br></div></body></h=
>tml>=
>
>--Apple-Mail=_EEF8E283-B126-4B87-BA54-81432C085954--



More information about the M3devel mailing list