SAM function SAM-Memory-region-protect()

From SoOS

Jump to: navigation, search

Contents

[edit] Name

SAM_Memory_region_protect - Protect a memory region within a SAM context

[edit] Synopsis

#include <sam.h>
 
void SAM_Memory_region_protect(SAM_t sam, void *addr);

[edit] Description

The SAM_Memory_region_protect() function is used to make the SAM Structure object sam protect a region of memory that has been previously registered. That a region memory is protected means that that the workers threads will be flashed back according to the flash back policy if they read from this region and a data dependency is detected or if they speculatively write to this memory region; and the writing will not be considered valid.

To protect a region that has not been previously registered will result in undefined behavior.

[edit] Return value

None.

[edit] Errors

None, assumes correct input parameters.

[edit] Examples

Example 3 A - Executing speculatively and flashing back a worker thread (inefficient version)
Example 3 B - Executing speculatively and flashing back a worker thread (efficient version)
Example 4 - Executing speculatively, flashing back, and speculative writing
Example 5 - Using multiple protected memory regions within the same SAM context

[edit] See also

SAM_Memory_address_register(), SAM_Memory_region_register(), SAM_Memory_region_unregister(), SAM_Memory_region_release(), SAM_Memory_region_is_protected(), <sam.h>.