BDMPI - Big Data Message Passing Interface  Release 0.1
Functions for critical sections

Detailed Description

These functions and the -nr option of bdmprun are used to implement a generalized mutex-like synchronization protocol involving the slave processes that were spawned by the same master process. For the rest of this discussion we will refer to the set of slaves spawned by the same master process as related slaves.

In the context of BDMPI, a critical section is a part of the code that can be executed by fewer slaves than the number of related slaves that can be concurrently running (i.e., as controlled by the -nr option of bdmprun).

BDMPI uses POSIX semaphores to implement critical sections.

Functions

int BDMPI_Entercritical (void)
 
int BDMPI_Exitcritical (void)
 

Function Documentation

int BDMPI_Entercritical ( void  )

BDMPI_Entercritical() is used to indicate the start of the critical section. If the number of related slaves that are already executing in their critical sections is equal to -nr, then the calling process blocks until one of the other processes exits its critical section (by calling BDMPI_Exitcritical()). At that point, if no other process wants to enter its critical section, the function returns control to the calling process. If there is another process that wants to enter its critical section, the one that called BDMPI_Entercritical() will be allowed to proceed. Note that the blocking of a slave process performed by BDMPI_Entercritical() does not change its execution state w.r.t. BDMPI. That is, the slave process is still considered to be running.

int BDMPI_Exitcritical ( void  )

BDMPI_Entercritical() is used to indicate that the calling process is exiting its critical section.