I want to implement the famous reader writer model using actor model. We can have multiple reader reading but only one writer can write. Also when a writer writes no reader can read and vice versa.
To solve this problem i thought of using a superviser actor which maintains a set for reader actors and a queue for writer actors. Now a writer can be dequeued and start writing when the set for readers are empty. Also when the writer completes all reader actors from the set can start reading.
Can we have a better problem of solving this famous problem using actor model?
Also is this model better than the original reader writer problem soved using read or write locks?