Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: loom won't simulate data races in current test #4

Open
OliverNChalk opened this issue Apr 21, 2024 · 0 comments
Open

test: loom won't simulate data races in current test #4

OliverNChalk opened this issue Apr 21, 2024 · 0 comments

Comments

@OliverNChalk
Copy link

OliverNChalk commented Apr 21, 2024

Not sure if the current test is runnable but with BUF_LEN > ELEMENTS the ring buffer will never loop and thus the writer will never write the same cell twice. This means you don't test the contention resolution algorithm (i.e. readers never spin).

Furthermore, I'm pretty sure loom will just report the data race and then panic. So I'm not entirely sure seqlocks can be proven sound with loom alone.

Referenced code:

const BUF_LEN: usize = 2_usize.pow(7);
const PAYLOAD: [u8; 8] = [0, 0, 0, 0, 0, 0, 0, 0];
const THREADS: [usize; 3] = [1, 2, 4];
const ELEMENTS: usize = 10;

// Snip

        for _ in 0..ELEMENTS {
            writer.push_back(PAYLOAD);
            std::thread::yield_now();
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant