mastodontech.de ist einer von vielen unabhängigen Mastodon-Servern, mit dem du dich im Fediverse beteiligen kannst.
Offen für alle (über 16) und bereitgestellt von Markus'Blog

Serverstatistik:

1,5 Tsd.
aktive Profile

#Atomics

1 Beitrag1 Beteiligte*r0 Beiträge heute
Felix Palmen :freebsd: :c64:<p>Please help me spread the link to <a href="https://mastodon.bsd.cafe/tags/swad" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swad</span></a> 😎</p><p><a href="https://github.com/Zirias/swad" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">github.com/Zirias/swad</span><span class="invisible"></span></a></p><p>I really need some users by now, for those two reasons:</p><p>* I'm at a point where I fully covered my own needs (the reasons I started coding this), and getting some users is the only way to learn about what other people might need<br>* The complexity "exploded" after supporting so many OS-specific APIs (like <a href="https://mastodon.bsd.cafe/tags/kqueue" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>kqueue</span></a>, <a href="https://mastodon.bsd.cafe/tags/epoll" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>epoll</span></a>, <a href="https://mastodon.bsd.cafe/tags/eventfd" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>eventfd</span></a>, <a href="https://mastodon.bsd.cafe/tags/signalfd" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>signalfd</span></a>, <a href="https://mastodon.bsd.cafe/tags/timerfd" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>timerfd</span></a>, <a href="https://mastodon.bsd.cafe/tags/eventports" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>eventports</span></a>) and several <a href="https://mastodon.bsd.cafe/tags/lockfree" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>lockfree</span></a> implementations based on <a href="https://mastodon.bsd.cafe/tags/atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomics</span></a> while still providing fallbacks for everything that *should* work on any <a href="https://mastodon.bsd.cafe/tags/POSIX" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>POSIX</span></a> systems ... I'm definitely unable at this point to think of every possible edge case and test it. If there are <a href="https://mastodon.bsd.cafe/tags/bugs" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>bugs</span></a> left (which is somewhat likely), I really need people reporting these to me</p><p>Thanks! 🙃</p>
Felix Palmen :freebsd: :c64:<p>This redesign of <a href="https://mastodon.bsd.cafe/tags/poser" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>poser</span></a> (for <a href="https://mastodon.bsd.cafe/tags/swad" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>swad</span></a>) to offer a "multi-reactor" (with multiple <a href="https://mastodon.bsd.cafe/tags/threads" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>threads</span></a> running each their own event loop) starts to give me severe headaches.</p><p>There is *still* a very rare data <a href="https://mastodon.bsd.cafe/tags/race" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>race</span></a> in the <a href="https://mastodon.bsd.cafe/tags/lockfree" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>lockfree</span></a> <a href="https://mastodon.bsd.cafe/tags/queue" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>queue</span></a>. I *think* I can spot it in the pseudo code from the paper I used[1], see screenshot. Have a look at lines E7 and E8. Suppose the thread executing this is suspended after E7 for a "very long time". Now, some dequeue operation from some other thread will eventually dequeue whatever "Q-&gt;Tail" was pointing to, and then free it after consumption. Our poor thread resumes, checks the pointer already read in E6 for NULL successfully, and then tries a CAS on tail-&gt;next in E9, which is unfortunately inside an object that doesn't exist any more .... If the CAS succeeds because at this memory location happens to be "zero" bytes, we corrupted some random other object that might now reside there. 🤯 </p><p>Please tell me whether I have an error in my thinking here. Can it be ....? 🤔 </p><p>Meanwhile, after fixing and improving lots of things, I checked the alternative implementation using <a href="https://mastodon.bsd.cafe/tags/mutexes" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mutexes</span></a> again, and surprise: Although it's still a bit slower, the difference is now very very small. And it has the clear advantage that it never crashes. 🙈 I'm seriously considering to drop all the lock-free <a href="https://mastodon.bsd.cafe/tags/atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomics</span></a> stuff again and just go with mutexes.</p><p>[1] <a href="https://dl.acm.org/doi/10.1145/248052.248106" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">dl.acm.org/doi/10.1145/248052.</span><span class="invisible">248106</span></a></p>
C++ on Sea<p>C++OnSea 2025 SESSION ANNOUNCEMENT: Beyond Sequential Consistency by Christopher Fretz</p><p><a href="https://cpponsea.uk/2025/session/beyond-sequential-consistency" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">cpponsea.uk/2025/session/beyon</span><span class="invisible">d-sequential-consistency</span></a></p><p>Register now at <a href="https://cpponsea.uk/tickets/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">cpponsea.uk/tickets/</span><span class="invisible"></span></a></p><p><a href="https://vmst.io/tags/atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomics</span></a> <a href="https://vmst.io/tags/cplusplus" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>cplusplus</span></a> <a href="https://vmst.io/tags/cpp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>cpp</span></a> <a href="https://vmst.io/tags/threading" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>threading</span></a></p>
Felix Palmen :freebsd: :c64:<p>I recently took a dive into <a href="https://mastodon.bsd.cafe/tags/C11" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>C11</span></a> <a href="https://mastodon.bsd.cafe/tags/atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomics</span></a> to come up with alternative queue implementations not requiring locking some <a href="https://mastodon.bsd.cafe/tags/mutex" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mutex</span></a>.</p><p>TBH, I have a hard time understanding the <a href="https://mastodon.bsd.cafe/tags/memory" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>memory</span></a> <a href="https://mastodon.bsd.cafe/tags/ordering" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ordering</span></a> constraints defined by C11. I mean, I code <a href="https://mastodon.bsd.cafe/tags/assembler" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>assembler</span></a> on a <a href="https://mastodon.bsd.cafe/tags/mos6502" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>mos6502</span></a> (for the <a href="https://mastodon.bsd.cafe/tags/c64" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>c64</span></a>), so caches, pipelines and all that modern crap is kind of alien rocket science anyways 😆.</p><p>But seriously, they try to abstract from what the hardware provides (different kinds of memory barrier instructions, IMHO somewhat easier to understand), so the compiler can pick the appropriate one depending on the target CPU. But wrapping your head around their definition really hurts the brain 🙈.</p><p>Yesterday, I found a source telling me that <a href="https://mastodon.bsd.cafe/tags/amd64" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>amd64</span></a> (or <a href="https://mastodon.bsd.cafe/tags/x86" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>x86</span></a> in general?) always has strong ordering for reads, so no matter which oderding constraint you put in your atomic_load and friends, the compiler will generate the same code and it will work. Oh boy, how should I ever verify my code works on e.g. aarch64 without owning such hardware?</p>
Felix Palmen :freebsd: :c64:<p>Hm, is <a href="https://mastodon.bsd.cafe/tags/valgrind" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>valgrind</span></a>'s <a href="https://mastodon.bsd.cafe/tags/helgrind" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>helgrind</span></a> useless for code using <a href="https://mastodon.bsd.cafe/tags/atomic" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomic</span></a> operations? Example, it complains about this:</p><p>==9505== Possible data race during read of size 4 at 0xADD57F4 by thread #14<br>==9505== Locks held: none<br>==9505== at 0x23D0F1: PSC_ThreadPool_cancel (threadpool.c:761)<br>[....]<br>==9505== This conflicts with a previous write of size 4 by thread #6<br>==9505== Locks held: none<br>==9505== at 0x23CDDE: worker (threadpool.c:373)</p><p>so, here's threadpool.c:761:</p><p> if ((pthrno = atomic_load_explicit(<br> &amp;job-&gt;pthrno, memory_order_consume)) &gt;= 0)</p><p>and here's threadpool.c:373:</p><p> atomic_store_explicit(&amp;currentJob-&gt;pthrno, -1,<br> memory_order_release);</p><p>Ok, I *think* this should be fine? Do I miss something?</p><p>(screenshots for readability ...)</p><p><a href="https://mastodon.bsd.cafe/tags/c" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>c</span></a> <a href="https://mastodon.bsd.cafe/tags/coding" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>coding</span></a> <a href="https://mastodon.bsd.cafe/tags/c11" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>c11</span></a> <a href="https://mastodon.bsd.cafe/tags/atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomics</span></a></p>
Hacker News<p>Atomics and Concurrency</p><p><a href="https://redixhumayun.github.io/systems/2024/01/03/atomics-and-concurrency.html" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">redixhumayun.github.io/systems</span><span class="invisible">/2024/01/03/atomics-and-concurrency.html</span></a></p><p><a href="https://mastodon.social/tags/HackerNews" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>HackerNews</span></a> <a href="https://mastodon.social/tags/Atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Atomics</span></a> <a href="https://mastodon.social/tags/Concurrency" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Concurrency</span></a> <a href="https://mastodon.social/tags/Systems" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Systems</span></a> <a href="https://mastodon.social/tags/Programming" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Programming</span></a> <a href="https://mastodon.social/tags/Tech" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Tech</span></a> <a href="https://mastodon.social/tags/News" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>News</span></a></p>
C++ on Sea<p>C++OnSea 2025 SESSION ANNOUNCEMENT: Beyond Sequential Consistency by Christopher Fretz</p><p><a href="https://cpponsea.uk/2025/session/beyond-sequential-consistency" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">cpponsea.uk/2025/session/beyon</span><span class="invisible">d-sequential-consistency</span></a></p><p>Register now at <a href="https://cpponsea.uk/tickets/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="">cpponsea.uk/tickets/</span><span class="invisible"></span></a></p><p><a href="https://vmst.io/tags/atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomics</span></a> <a href="https://vmst.io/tags/cplusplus" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>cplusplus</span></a> <a href="https://vmst.io/tags/cpp" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>cpp</span></a> <a href="https://vmst.io/tags/threading" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>threading</span></a></p>
Bytes Europe<p>General Atomics, UC San Diego Collaborate to Launch Historic Fusion Data Science and Digital Engineering Center in San Diego <a href="https://www.byteseu.com/842432/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://www.</span><span class="">byteseu.com/842432/</span><span class="invisible"></span></a> <a href="https://pubeurope.com/tags/and" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>and</span></a> <a href="https://pubeurope.com/tags/Atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Atomics</span></a> <a href="https://pubeurope.com/tags/center" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>center</span></a> <a href="https://pubeurope.com/tags/Collaborate" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Collaborate</span></a> <a href="https://pubeurope.com/tags/Data" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Data</span></a> <a href="https://pubeurope.com/tags/Diego" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Diego</span></a> <a href="https://pubeurope.com/tags/digital" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>digital</span></a> <a href="https://pubeurope.com/tags/engineering" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>engineering</span></a> <a href="https://pubeurope.com/tags/Fusion" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Fusion</span></a> <a href="https://pubeurope.com/tags/General" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>General</span></a> <a href="https://pubeurope.com/tags/Historic" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Historic</span></a> <a href="https://pubeurope.com/tags/in" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>in</span></a> <a href="https://pubeurope.com/tags/launch" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>launch</span></a> <a href="https://pubeurope.com/tags/san" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>san</span></a> <a href="https://pubeurope.com/tags/Science" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Science</span></a> <a href="https://pubeurope.com/tags/to" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>to</span></a> <a href="https://pubeurope.com/tags/uc" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>uc</span></a></p>
IT News<p>Programming Ada: Atomics and Other Low-Level Details - Especially within the world of multi-threaded programming does atomic access becom... - <a href="https://hackaday.com/2025/01/02/programming-ada-atomics-and-other-low-level-details/" rel="nofollow noopener" translate="no" target="_blank"><span class="invisible">https://</span><span class="ellipsis">hackaday.com/2025/01/02/progra</span><span class="invisible">mming-ada-atomics-and-other-low-level-details/</span></a> <a href="https://schleuss.online/tags/softwaredevelopment" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>softwaredevelopment</span></a> <a href="https://schleuss.online/tags/hackadaycolumns" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>hackadaycolumns</span></a> <a href="https://schleuss.online/tags/atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>atomics</span></a> <a href="https://schleuss.online/tags/ada" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>ada</span></a></p>
Ben Clifford<p>did something change about += becoming more threadsafe between Python 3.7 and Python 3.10? I have some vague memory that it did but can't find any documentation, and running a few test programs seems to suggest so?</p><p><a href="https://mastodon.hawaga.org.uk/tags/Python" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Python</span></a> <a href="https://mastodon.hawaga.org.uk/tags/Threads" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Threads</span></a> <a href="https://mastodon.hawaga.org.uk/tags/Atomics" class="mention hashtag" rel="nofollow noopener" target="_blank">#<span>Atomics</span></a></p>