55 karma · joined Sep 12, 2014 (12y ago) · 49 submissions
comment 4mo ago · link · parent
If you align and pad each slot there won't be any false sharing and the stream prefetcher can kick in if there's only one producer or consumer.
If you use bijective hashing you reduce false sharing without aligning and padding. This can save memory at the expense of the stream prefetcher never kicking in.
comment 4mo ago · link · parent
comment 4mo ago · link · parent
comment 10mo ago · link · parent
comment 10mo ago · link · parent
comment 1y ago · link · parent
I agree both FFT and belief propagation can be expressed as message passing algorithms.
comment 3y ago · link · parent
comment 4y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
Also keep in mind that C++11 specifies std::mutex::lock() to have acquire semantics and unlock() to have release semantics on the lock object. In order for std::mutex to actually work the reordering of m1.unlock(); m2.lock(); to m2.lock(); m1.unlock(); must be disallowed. But since m1 and m2 are separate objects m1.unlock() has no happens before relationship with m2.lock(). This seems to be a problem in the C++11 memory model. The arguments I have heard from some WG21 people is that there is no problem since transforming a wellformed terminating program into a non-terminating program is not allowed. I can't find the wording in the C++ standard that asserts this. But oh well, it works right now on gcc/llvm/msvc.
comment 5y ago · link · parent
Taking a lock only needs to be an acquire operation and a compiler barrier for other lock operations. Using seq_cst or acq_rel semantics is stronger than needed. From my reading and discussions with people from WG21 the current argument for why taking a lock only requires acq semantics is that a compiler optimization that transforms a non-deadlocking program into a potentially deadlocking program is not allowed. There's an interesting twitter thread where we discuss this I can't find anymore :(.
comment 5y ago · link · parent
comment 5y ago · link · parent
Basically a compiler can not optimize a non-deadlocking program into a potentially deadlocking one.
comment 5y ago · link · parent
You can still get this deadlock if you actually write the code like that: lock1.lock(); lock2.unlock();
comment 5y ago · link · parent
comment 5y ago · link · parent
comment 5y ago · link · parent
Sometimes you don't have time to do things perfectly and might use a spinlock when initializing some cache on first use... Only light contention, not great not, not terrible :).
comment 5y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
comment 6y ago · link · parent
Have you tried "A full task-isolation mode for the kernel": https://lwn.net/Articles/816298/ ?
Running only a single thread per core, I see no difference between SCHED_FIFO vs SCHED_OTHER. Except SCHED_FIFO can cause lockups if running 100% since cores are not completely isolated (ie vmstat timer and some other stuff).
Yes, it's annoying you cannot disable compaction. There is also work on pro-active compaction now: https://nitingupta.dev/post/proactive-compaction/