What is false sharing What is false sharing? When CPUs and their cores read and update atomic variables, special hardware protocols make it correct and efficient, while keeping each core’s caches consistent. The coordination doesn’t happen per-address: these protocols work on cache-line-sized chunks. What happens when two atomic variables happen to reside on the same cache line? For example: an array of atomics where each atomic is used by a separate thread (e.g. per-thread counters); a queue with two atomic pointers where a writer updates the tail and a reader updates the head. Of course, you declare both pointers in the same struct and they have adjacent addresses! Each update operation makes the cache line dirty and requires coordination between CPUs. The CPUs are essentially playing ping pong with the chunk of memory. ...
C in "C" means "confusion"
And in “C++” too.
AARCHMRS dataset for AArch64 instruction synthesis in Rust
Arm Limited, the company behind the ARM architecture, publishes AARCHMRS dataset – “Arm Architecture Machine Readable Specification”, a detailed description of an ARM processor as a set of JSON files. Today I published a set of crates: aarchmrs-parser: a set of definitions that allows parsing the AARCHMRS dataset, but only instructions description file. aarchmrs-instructions: a set of functions derived from the AARCHMRS that allow you to build instruction codes. aarchmrs-types: a helper crate with useful types for aarchmrs-instructions, which now contains only generated code. The license is the same as the original dataset: BSD-3-Clause. ...
Baby-step-giant-step algorithm in functional encryption
The Shanks’ baby-step-giant step (BSGS) algorithm is the final stage of certain functional encryption schemes based on elliptic curve pairings. This article discusses how the application of BSGS in these schemes differs from the classical one. Boundaries The textbook implementations use the group’s order $q$ as an input parameter. However, it would make the functional encryption scheme infeasible, as the order of the pairing target group is large enough to ensure cryptographic security. ...
A ZKP Joke
I’ve got a ZKP joke, but I’m not gonna to tell you. Nevertheless, this is a proof that it is funny.
Rust Coroutines on AArch64 (ARM64)
The amazing book Asynchronous Programming in Rust by Carl Fredrik Samson has a chapter on implementing stackful coroutines (fibers) in Rust for x86_64 architecture, both Linux and MacOS. But unlike the other chapters, no AArch64 implementation was included for the sake of simplicity. I tried to port it to AArch64, and this post describes my approach. This text is just an additional material for the book. I presume you are familiar either with it or with the original code at ch05/c-fibers. ...
Introductory Post
Hi! My name is Ivan Boldyrev, I am software engineer born in Novosibirsk, Russia. My main areas of interest are functional programming, Rust, and parallel programming. Since the start of 2024 I live in Barcelona, Spain. My favourite projects are: StarJs – astronomical library for JavaScript. FUCC – LALR parser generator for Common Lisp. harm – WIP dynamic ARM assembler DSL for Rust. I am big fan of Emacs, Rust language and Apple Macbook Air M1. My other hobbies include studying French language, ink pens, sailing and reading. ...