Memory Access -- Busy Wait

General OpenMP discussion

Memory Access -- Busy Wait

Postby alorenzon » Mon Apr 29, 2013 11:52 am

Hello,
I'm Arthur Lorenzon and I'm doing the trace memory access of a program parallelized with OpenMP. The trace collects information from memory address accessed by any thread (reading and writing).
Analyzing trace output, I visualized that there are two addresses that are frequently accessed by both threads at certain times of the application, as follows:
- Thread 0 writes at address 0x26e1774
- Thread 0,1,2,3 perform read-only on this address for many times
- After several read accesses,
- Thread 0 writes this address and the others perform the reading.
- After reading this, finalize access to this address.
This behavior occurs for access to another similar address (0x26e1e44).
At the end of the application, occurs only reading both threads to the last address. There are many readings with no writing. After a while, the slave threads have no more access.

This behavior refers to the busy waiting? Fork-Join?

For simple conference, the code is as follows:
# include <omp.h>
# include
int main () {
# pragma omp parallel
{
printf ("Thread% d \ n", omp_get_thread_num ());
}
return 0;
}

Thank you!
alorenzon
 
Posts: 1
Joined: Mon Apr 29, 2013 11:30 am

Re: Memory Access -- Busy Wait

Postby MarkB » Tue Apr 30, 2013 2:38 am

Hi Arthur,

Worker threads busy-waiting for a flag variable to be set by the master thread is a common way on implementing the fork at the start of an OpenMP parallel region. This pattern can also be used to release threads from a barrier once they have all arrived.

Hope that helps,
Mark.
MarkB
 
Posts: 432
Joined: Thu Jan 08, 2009 10:12 am


Return to Using OpenMP

Who is online

Users browsing this forum: Google [Bot] and 4 guests