"Singe writer / multiple readers" strategy & OpeMP

General OpenMP discussion

"Singe writer / multiple readers" strategy & OpeMP

Postby arka » Thu Jan 19, 2017 7:55 am

Hi everyone,

With native API (Win7) it is not very difficult to develop compound object based on mutex, counting semaphore and event that allows to implement "single writer / multiple readers" strategy on shared data.
The question is: Does OpenMp allow to implement this strategy?

Thank you in advance,
arka
 
Posts: 4
Joined: Tue Jan 17, 2017 9:24 am

Re: "Singe writer / multiple readers" strategy & OpeMP

Postby MarkB » Thu Jan 19, 2017 8:37 am

I think it's a bit tricky - OpenMP lacks semaphores or condition variables. There is a algorithm based on two mutexes and a counter (https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes ), but that doesn't work with OpenMP locks as it requires a thread to be allowed to unlock a mutex it doesn't own. You would probably need to build something ground-up using atomics.
MarkB
 
Posts: 702
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Re: "Singe writer / multiple readers" strategy & OpeMP

Postby arka » Thu Jan 19, 2017 9:22 am

Thank you very much!
arka
 
Posts: 4
Joined: Tue Jan 17, 2017 9:24 am


Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 6 guests