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

Incorrect logic in readers writers problem #1

Open
SinghCoder opened this issue Mar 20, 2021 · 0 comments
Open

Incorrect logic in readers writers problem #1

SinghCoder opened this issue Mar 20, 2021 · 0 comments

Comments

@SinghCoder
Copy link

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
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