Skip to content

Incorrect logic in readers writers problem #1

@SinghCoder

Description

@SinghCoder

Hey,
Thanks for this organized collection of notes.
Was reading through Threads and concurrency Section
The solution to Readers-Writers it says is:

if ((read_count == 0) & (read_count == 0))
    R okay, W okay
if (read_count > 0)
    R okay    
if (read_count == 1)
    R not-okay, W not-okay  

I think it should be instead

if ((read_count == 0) & (write_count == 0))
    R okay, W okay
if (read_count > 0)
    R okay    
if (write_count == 1)
    R not-okay, W not-okay

Metadata

Metadata

Assignees

No one assigned

    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