@Don,
      Read, Write locks would do I guess. pthread_rwlock_read/write? Stevens
IPC book, has an implementation of read write locks using mutexs and
conditional variables. In case of semaphore how do we allow high priority to
writers when there is too much contention between readers and writers?

-
Azhar.

On Thu, Aug 11, 2011 at 9:23 PM, Don <dondod...@gmail.com> wrote:

> Sounds like you need some sort of semaphore system to lock cells in
> the hash table. Essentially it would only give one user access to a
> particular cell at any given time. Make sure that the cells have a
> restricted interface so that they can only be accessed through the
> semaphore-controlled interface. The write interface would attempt to
> get the semaphore, and if successful, write the data and then release
> the semaphore. If it failed, it would return a failure notice to the
> caller. The read interface would check the semaphore and if it was
> open, get the data.
> Don
>
> On Aug 11, 5:15 am, Navneet Gupta <navneetn...@gmail.com> wrote:
> > Q. Design a concurrent hash table with as much as concurrency as
> possible.
> > System has multiple readers and writers. System will crash if a reader or
> > writer is reading or writing from a location which is being updated by
> some
> > writer. We need to prevent crash.
> >
> > It is pretty much an open-ended question, so basically looking for
> > strategies.
> >
> > --
> > Regards,
> > Navneet
>
> --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to