Print

Print


In light of this new evidence, I think we don't need the full memory barrier. Please insert asm volatile("": : :"memory") before line 66 and after line 90 in XrdClMessageUtils.hh. If this helps, I will create a nicer patch for the built-in semaphores.

The semaphores are better here because we just need a very trivial synchronization mechanism. Posting/waiting on a semaphore involves just one atomic update and one syscall in case of congestion. Condvars are far more complex and, typically, involve multiple locks and multiple updates.

You would typically use a condvar if you have:
1. a complex condition for signaling
2. need to bump the owning thread's priority either because the critical section (the mutex) has a priority ceiling or because you're blocking a thread of higher priority and the mutex is in the inheritance mode.

If you're interested in how a condvar may be implemented, take a look at this: tb-condvar.c. I was once bored and implemented pretty much all of the pthread functions NPTL-style mostly in simple C: https://github.com/ljanyst/thread-bites


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.

{"api_version":"1.0","publisher":{"api_key":"05dde50f1d1a384dd78767c55493e4bb","name":"GitHub"},"entity":{"external_key":"github/xrootd/xrootd","title":"xrootd/xrootd","subtitle":"GitHub repository","main_image_url":"https://cloud.githubusercontent.com/assets/143418/17495839/a5054eac-5d88-11e6-95fc-7290892c7bb5.png","avatar_image_url":"https://cloud.githubusercontent.com/assets/143418/15842166/7c72db34-2c0b-11e6-9aed-b52498112777.png","action":{"name":"Open in GitHub","url":"https://github.com/xrootd/xrootd"}},"updates":{"snippets":[{"icon":"PERSON","message":"@ljanyst in #404: In light of this new evidence, I think we don't need the full memory barrier. Please insert `asm volatile(\"\": : :\"memory\")` before line 66 and after line 90 in [XrdClMessageUtils.hh](https://github.com/xrootd/xrootd/blob/master/src/XrdCl/XrdClMessageUtils.hh). If this helps, I will create a nicer patch for the built-in semaphores.\r\n\r\nThe semaphores are better here because we just need a very trivial synchronization mechanism. Posting/waiting on a semaphore involves just one atomic update and one syscall in case of congestion. Condvars are far more complex and, typically, involve multiple locks and multiple updates.\r\n\r\nYou would typically use a condvar if you have:\r\n1. a complex condition for signaling\r\n2. need to bump the owning thread's priority either because the critical section (the mutex) has a priority ceiling or because you're blocking a thread of higher priority and the mutex is in the inheritance mode.\r\n\r\nIf you're interested in how a condvar may be implemented, take a look at this: [tb-condvar.c](https://github.com/ljanyst/thread-bites/blob/master/tb-condvar.c#L61). I was once bored and implemented pretty much all of the pthread functions NPTL-style mostly in simple C: https://github.com/ljanyst/thread-bites"}],"action":{"name":"View Issue","url":"https://github.com/xrootd/xrootd/issues/404#issuecomment-241016278"}}}

Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1