Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > SSR_impls > SSR__MC_shared_impl
view SSR.h @ 18:cee3eecc5c22
Fixed transaction bug -- didn't init with semantic data
| author | Me |
|---|---|
| date | Mon, 08 Nov 2010 04:02:50 -0800 |
| parents | bf57b83019e5 |
| children | b549ad140f18 |
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
9 #ifndef _SSR_H
10 #define _SSR_H
12 #include "VMS/Queue_impl/PrivateQueue.h"
13 #include "VMS/Hash_impl/PrivateHash.h"
14 #include "VMS/VMS.h"
17 //===========================================================================
19 #define NUM_STRUCS_IN_SEM_ENV 1000
21 //===========================================================================
22 /*This header defines everything specific to the SSR semantic plug-in
23 */
24 typedef struct _SSRSemReq SSRSemReq;
25 typedef void (*PtrToAtomicFn ) ( void * ); //executed atomically in master
26 //===========================================================================
28 /*Semantic layer-specific data sent inside a request from lib called in app
29 * to request handler called in MasterLoop
30 */
31 enum SSRReqType
32 {
33 send_type = 1,
34 send_from_to,
35 receive_any, //order and grouping matter -- send before receive
36 receive_type, // and receive_any first of the receives -- Handlers
37 receive_from_to,// rely upon this ordering of enum
38 transfer_to,
39 transfer_out,
40 malloc_req,
41 free_req,
42 singleton,
43 atomic,
44 trans_start,
45 trans_end
46 };
48 struct _SSRSemReq
49 { enum SSRReqType reqType;
50 VirtProcr *sendPr;
51 VirtProcr *receivePr;
52 int32 msgType;
53 void *msg;
54 SSRSemReq *nextReqInHashEntry;
56 void *initData;
57 VirtProcrFnPtr fnPtr;
58 int32 coreToScheduleOnto;
60 int32 sizeToMalloc;
61 void *ptrToFree;
63 int32 singletonID;
64 void *endJumpPt;
66 PtrToAtomicFn fnToExecInMaster;
67 void *dataForFn;
69 int32 transID;
70 }
71 /* SSRSemReq */;
74 typedef struct
75 {
76 VirtProcr *VPCurrentlyExecuting;
77 PrivQueueStruc *waitingVPQ;
78 }
79 SSRTrans;
81 typedef struct
82 {
83 PrivQueueStruc **readyVPQs;
84 HashTable *commHashTbl;
85 int32 numVirtPr;
86 int32 nextCoreToGetNewPr;
87 int32 primitiveStartTime;
89 //fix limit on num with dynArray
90 int32 singletonHasBeenExecutedFlags[NUM_STRUCS_IN_SEM_ENV];
91 SSRTrans transactionStrucs[NUM_STRUCS_IN_SEM_ENV];
92 }
93 SSRSemEnv;
96 typedef struct _TransListElem TransListElem;
97 struct _TransListElem
98 {
99 int32 transID;
100 TransListElem *nextTrans;
101 };
102 //TransListElem
104 typedef struct
105 {
106 int32 highestTransEntered;
107 TransListElem *lastTransEntered;
108 }
109 SSRSemData;
111 //===========================================================================
113 void
114 SSR__create_seed_procr_and_do_work( VirtProcrFnPtr fn, void *initData );
116 int32
117 SSR__giveMinWorkUnitCycles( float32 percentOverhead );
119 void inline
120 SSR__start_primitive();
122 int32 inline
123 SSR__end_primitive_and_give_cycles();
125 int32
126 SSR__giveIdealNumWorkUnits();
128 int32
129 SSR__give_number_of_cores_to_schedule_onto();
131 //=======================
133 void
134 SSR__init();
136 void
137 SSR__cleanup_after_shutdown();
139 //=======================
141 inline VirtProcr *
142 SSR__create_procr_with( VirtProcrFnPtr fnPtr, void *initData,
143 VirtProcr *creatingPr );
145 inline VirtProcr *
146 SSR__create_procr_with_affinity( VirtProcrFnPtr fnPtr, void *initData,
147 VirtProcr *creatingPr, int32 coreToScheduleOnto);
149 void
150 SSR__dissipate_procr( VirtProcr *procrToDissipate );
152 //=======================
153 void *
154 SSR__malloc_to( int numBytes, VirtProcr *ownerPr );
156 void
157 SSR__free( void *ptrToFree, VirtProcr *owningPr );
159 void
160 SSR__transfer_ownership_of_from_to( void *data, VirtProcr *oldOwnerPr,
161 VirtProcr *newOwnerPr );
163 void
164 SSR__add_ownership_by_to( VirtProcr *newOwnerPr, void *data );
166 void
167 SSR__remove_ownership_by_from( VirtProcr *loserPr, void *dataLosing );
169 void
170 SSR__transfer_ownership_to_outside( void *dataToTransferOwnershipOf );
174 //=======================
175 void
176 SSR__send_of_type_to( VirtProcr *sendPr, void *msg, const int type,
177 VirtProcr *receivePr);
179 void
180 SSR__send_from_to( void *msg, VirtProcr *sendPr, VirtProcr *receivePr);
182 void *
183 SSR__receive_type_to( const int type, VirtProcr *receivePr );
185 void *
186 SSR__receive_from_to( VirtProcr *sendPr, VirtProcr *receivePr );
189 //======================= Concurrency Stuff ======================
190 void
191 SSR__start_singleton( int32 singletonID, void *endSingletonLabelAddr,
192 VirtProcr *animPr );
194 void
195 SSR__animate_short_fn_in_isolation( PtrToAtomicFn ptrToFnToExecInMaster,
196 void *data, VirtProcr *animPr );
198 void
199 SSR__start_transaction( int32 transactionID, VirtProcr *animPr );
201 void
202 SSR__end_transaction( int32 transactionID, VirtProcr *animPr );
205 //========================= Internal use only =============================
206 void
207 SSR__Request_Handler( VirtProcr *requestingPr, void *_semEnv );
209 VirtProcr *
210 SSR__schedule_virt_procr( void *_semEnv, int coreNum );
213 #endif /* _SSR_H */
