Re:Garbage Collection for Systems Programmers
by yvdriess on Saturday March 30, 2024 @11:20AM
(#39875668)
Saying this as a big hardware atomics enjoyer: Static atomic variables are not fast, are not parallel and definitely are the worst kind of cache misses.
Atomics are also atomic only on that one single operation, such as manipulating a single number in a struct or swapping out a pointer from one version of an object to another. To atomically expose a set of changes to a datastructure, you either use a lock or swap the old for the new, which is the driving example in the article.
Re:Garbage Collection for Systems Programmers
by bugbuddy on Saturday March 30, 2024 @11:12AM
(#39875595)
This is false. Depending on the CPU Arch, updating a shared static atomic variable may cause cache invalidation. How fast depends on how hot and tight you critical sections are.
Re:Garbage Collection for Systems Programmers
by neonsunset on Saturday March 30, 2024 @12:20PM
(#39876235)
It's called C# (supporting plain C structs is just a small part of its low-level features)
Re:Garbage Collection for Systems Programmers
by pjmlp on Saturday March 30, 2024 @01:17PM
(#39876673)
Or D, available as official fronted language on GCC and LLVM projects, :)
Re:Garbage Collection for Systems Programmers
by gmokki on Sunday March 31, 2024 @01:55AM
(#39881810)
Modern Java does support directly calling C functions, with structs.
And also upcalls back to java.
All without any JNI style preprocessing or stubs.
https://docs.oracle.com/en/java/javase/21/core/calling-c-lib...
I mean it wont solve your race conditions but it also wont crash.
And it will be VERY fast because parallelism without cache misses!
I wish there was a Java with C struct JNI access.