SAM library sam.h

From SoOS

Jump to: navigation, search

Contents

[edit] Name

sam.h - Speculative Access to Memory

[edit] Synopsis

#include <sam.h>

[edit] Description

The <sam.h> header defines the following symbols:

SAM_FIRST_WORK_ID
SAM_TYPE_MAIN
SAM_TYPE_WORKER
SAM_TYPE_INVALID
SAM_FBPOLICY_RETRY
SAM_FBPOLICY_HALT
SAM_FBPOLICY_DEFAULT
SAM_FB_RETRY_DELAY
SAM_WORKER_STATUS_NOTINIT
SAM_WORKER_STATUS_PREPARED
SAM_WORKER_STATUS_RUNNING
SAM_WORKER_STATUS_INFB
SAM_WORKER_STATUS_HALTED
SAM_WORKER_STATUS_CANCELED
SAM_WORKER_STATUS_WAITJOIN
SAM_WORKER_STATUS_FINISHED


The <sam.h> header includes definitions for the following types:

SAM_t
Used for keeping a SAM context. Needed by all library calls. It is a pointer to an internal structure, so there is no data replication when it is just passed by value.

SAM_Workerid_t
Used as unique identifier of a worker thread.

SAM_Thread_type_t
Used as the type of thread.

SAM_Worker_fb_policy_t
Used for the flashback policy information.

SAM_Worker_status_t
Used for the worker status information.

SAM_pdif_t
Used for the parameter needed to use the macro for speculative memory writing.


The following are declared as functions and may also be declared as macros. Function prototypes must be provided for use with an ISO C compiler.

void SAM_Init(SAM_t *);
void SAM_Destroy(SAM_t *);
void SAM_Memory_address_register(SAM_t, void *);
void SAM_Memory_region_register(SAM_t, void *, unsigned int);
void SAM_Memory_region_unregister(SAM_t, void *);
void SAM_Memory_region_protect(SAM_t, void *);
void SAM_Memory_region_release(SAM_t, void *);
int SAM_Memory_region_is_protected(SAM_t, void *);
SAM_Workerid_t SAM_Execution_create(SAM_t, void *(*)(void *), void *);
void * SAM_Execution_join(SAM_t, SAM_Workerid_t);
void SAM_Execution_start(void *, SAM_t *, void **);
void SAM_Execution_finish(SAM_t);
void SAM_Execution_restart(SAM_t, SAM_Workerid_t);
void SAM_Execution_cancel(SAM_t, SAM_Workerid_t);
void SAM_Memory_speculative_read(SAM_t, SAM_Workerid_t, void *);
SAM_pdif_t SAM_Memory_speculative_write_prepare(SAM_t, void *);
void SAM_Memory_write_prepare(SAM_t, void *);
void SAM_Memory_write(SAM_t, void *);
SAM_Worker_fb_policy_t SAM_Worker_fb_policy_get(SAM_t, SAM_Workerid_t);
SAM_Worker_fb_policy_t SAM_Worker_fb_policy_set(SAM_t, SAM_Workerid_t, SAM_Worker_fb_policy_t);
SAM_Thread_type_t SAM_My_type(SAM_t);
SAM_Workerid_t SAM_My_workid(SAM_t);
pthread_t SAM_My_pthreadid();
SAM_Worker_status_t SAM_Check_execution_status(SAM_t, SAM_Workerid_t);
void SAM_Delete_execution_info(SAM_t, SAM_Workerid_t);
useconds_t SAM_Execution_fb_delay_get(SAM_t, SAM_Workerid_t);
useconds_t SAM_Execution_fb_delay_set(SAM_t, SAM_Workerid_t, useconds_t);
char * SAM_Version_string();
char * SAM_Date_string();


The following are declared as macros.

__SAM_ADDR__(x, y)


Inclusion of the <sam.h> header will make visible symbols defined in the headers of <pthread.h> and <time.h>. If compiled with SAM_DEBUG defined then <stdio.h> will also be exposed.

[edit] Application usage

None.

[edit] Future Directions

None.

[edit] Known Bugs

[edit] See also

SAM_Init(), SAM_Destroy(), SAM_Memory_address_register(), SAM_Memory_region_register(), SAM_Memory_region_unregister(), SAM_Memory_region_protect(), SAM_Memory_region_release(), SAM_Memory_region_is_protected(), SAM_Execution_create(), SAM_Execution_join(), SAM_Execution_start(), SAM_Execution_finish(), SAM_Execution_restart(), SAM_Execution_cancel(), SAM_Memory_speculative_read(), SAM_Memory_speculative_write_prepare(), SAM_Memory_write_prepare(), SAM_Memory_write(), SAM_Worker_fb_policy_get(), SAM_Worker_fb_policy_set(), SAM_My_type(), SAM_My_workid(), SAM_My_pthreadid(), SAM_Check_execution_status(), SAM_Delete_execution_info(), SAM_Execution_fbdelay_get(), SAM_Execution_fbdelay_set(), SAM_Version_string(), SAM_Date_string(), <pthread.h>, <time.h>, <stdio.h>.