Skip to content

Race condition in the shared memory implementation, missing sync in read_sm and write_sm #195

Closed

Description

@GREENRAT-K405

Currently, In the shared memory c++ implementation If the writer updates the simulation state while the reader is reading it, the reader might get corrupted data (half old state, half new state).

The write_SM function writes to the shared memory buffer using without acquiring a lock, which will let the read_sm function 'read' simultaneously when write_Sm is running 'write'. This should not happen, this will result in corrupted data to the reader.

Activity

  1. GREENRAT-K405 commented on Feb 2, 2026

    @GREENRAT-K405
    ContributorAuthor

    @pradeeban I would be interested in solving this issue. I had just learned something of similar concept(locking) in university the previous semester (in DBMS course). Would love to practically implement the concept.

  2. GREENRAT-K405 commented on Feb 3, 2026

    @GREENRAT-K405
    ContributorAuthor

    @pradeeban do you think we should have some more samples in demo especially for languages other than python? If so do let me know I will create an separate issue for that.

    I will be signing off for today, will try to get as many issues resolved by tomorrow!

  3. pradeeban commented on Feb 4, 2026

    @pradeeban
    Member

    @GREENRAT-K405 More samples are always nice. But as of now, without the real use case running on, these will likely become toy samples, which I do not like much. Let's see.

  4. added 4 commits that reference this issue on Jun 28, 2026
    ee5500f
    1a783c1
    e85941d
    7e979af
  5. pradeeban commented on Jun 30, 2026

    @pradeeban
    Member

    Thanks, merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions