-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsm.h
More file actions
62 lines (53 loc) · 1.72 KB
/
sm.h
File metadata and controls
62 lines (53 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/* DSM Assignment: Shared memory library - API
*
* Author : Manuel M. T. Chakravarty
* Created: 16 March 2000
*
* Version $Revision: 1.2 $ from $Date: 2003/04/11 08:45:04 $
*
* Copyright (c) [2000..2001] MMT Chakravarty & University of New South Wales
*
* DESCRIPTION ---------------------------------------------------------------
*
* This header defines the shared memory API for node processes.
*
* DOCU ----------------------------------------------------------------------
*
* language: ANSI C header
*
* TODO ----------------------------------------------------------------------
*
*/
#ifndef _SM_H
#define _SM_H
#include <stdlib.h>
/* Register a node process with the SM allocator.
*
* - Returns 0 upon successful completion; otherwise, -1.
* - Command arguments have to be passed in; all dsm-related arguments are
* removed, such that only the arguments for the user program remain.
* - The number of node processes and the node identification of the current
* node process are returned in `nodes' and `nid', respectively.
*/
int sm_node_init (int *argc, char **argv[], int *nodes, int *nid);
/* Deregister node process.
*/
void sm_node_exit (void);
/* Allocate object of `size' byte in SM.
*
* - Returns NULL if allocation failed.
*/
void *sm_malloc (size_t size);
/* Barrier synchronisation
*
* - Barriers are not guaranteed to work after some node processes have quit.
*/
void sm_barrier (void);
/* Broadcast an address
*
* - The address at `*addr' located in node process `root_nid' is transferred
* to the memory area referenced by `addr' on the remaining node processes.
* - `addr' may not refer to shared memory.
*/
void sm_bcast (void **addr, int root_nid);
#endif /* !_SM_H */