User oshogbo//vx discusses seq, a FreeBSD lockless algorithm in this blog post. They go into detail about what the seq_write, seq_consistent, and other seq functions do for the algorithm. You may view the full post at the link below.
Those days locking algorithms are critical for operating systems, especially in a multi-threaded world. With time it turns out that classical locks, like mutex, are performance costly. Even when we are using techniques like having reads and writes mutex, synchronizing the state between CPUs can be costly. To optimize some cases, the lockless algorithm started to be used.
There are multiple places in the kernel where we need to read some variables very often, but there is a small number of cases when we write to them. For such cases, the seq interface was created. First, let’s see how the writers look:
/* Change the state of obj. */
Original post: https://oshogbo.vexillium.org/blog/50/