Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison MasterLoop.c @ 205:cb888346c3e0
Changed include paths, but version still does not work because of accidental merge
| author | Merten Sach <msach@mailbox.tu-berlin.de> |
|---|---|
| date | Fri, 17 Feb 2012 18:28:59 +0100 |
| parents | 7cff4e13d5c4 |
| children |
comparison
equal
deleted
inserted
replaced
| 56:0592d4ef428f | 57:929def51e09e |
|---|---|
| 14 | 14 |
| 15 | 15 |
| 16 //=========================================================================== | 16 //=========================================================================== |
| 17 void inline | 17 void inline |
| 18 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, | 18 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, |
| 19 VirtProcr *masterPr ); | 19 SlaveVP *masterPr ); |
| 20 | 20 |
| 21 //=========================================================================== | 21 //=========================================================================== |
| 22 | 22 |
| 23 | 23 |
| 24 | 24 |
| 69 * to the MasterVP. Note, don't have to worry about latency of requests much | 69 * to the MasterVP. Note, don't have to worry about latency of requests much |
| 70 * because most requests generate work for same core -- only latency issue | 70 * because most requests generate work for same core -- only latency issue |
| 71 * is case when other cores starved and one core's requests generate work | 71 * is case when other cores starved and one core's requests generate work |
| 72 * for them -- so keep max in queue to 3 or 4.. | 72 * for them -- so keep max in queue to 3 or 4.. |
| 73 */ | 73 */ |
| 74 void masterLoop( void *initData, VirtProcr *animatingPr ) | 74 void masterLoop( void *initData, SlaveVP *animatingPr ) |
| 75 { | 75 { |
| 76 int32 slotIdx, numSlotsFilled; | 76 int32 slotIdx, numSlotsFilled; |
| 77 VirtProcr *schedVirtPr; | 77 SlaveVP *schedVirtPr; |
| 78 SchedSlot *currSlot, **schedSlots; | 78 SchedSlot *currSlot, **schedSlots; |
| 79 MasterEnv *masterEnv; | 79 MasterEnv *masterEnv; |
| 80 VMSQueueStruc *readyToAnimateQ; | 80 VMSQueueStruc *readyToAnimateQ; |
| 81 | 81 |
| 82 SlaveScheduler slaveScheduler; | 82 SlaveScheduler slaveScheduler; |
| 83 RequestHandler requestHandler; | 83 RequestHandler requestHandler; |
| 84 void *semanticEnv; | 84 void *semanticEnv; |
| 85 | 85 |
| 86 int32 thisCoresIdx; | 86 int32 thisCoresIdx; |
| 87 VirtProcr *masterPr; | 87 SlaveVP *masterPr; |
| 88 volatile VirtProcr *volatileMasterPr; | 88 volatile SlaveVP *volatileMasterPr; |
| 89 | 89 |
| 90 volatileMasterPr = animatingPr; | 90 volatileMasterPr = animatingPr; |
| 91 masterPr = (VirtProcr*)volatileMasterPr; //used to force re-define after jmp | 91 masterPr = (SlaveVP*)volatileMasterPr; //used to force re-define after jmp |
| 92 | 92 |
| 93 //First animation of each MasterVP will in turn animate this part | 93 //First animation of each MasterVP will in turn animate this part |
| 94 // of setup code.. (VP creator sets up the stack as if this function | 94 // of setup code.. (VP creator sets up the stack as if this function |
| 95 // was called normally, but actually get here by jmp) | 95 // was called normally, but actually get here by jmp) |
| 96 //So, setup values about stack ptr, jmp pt and all that | 96 //So, setup values about stack ptr, jmp pt and all that |
| 118 //======================================================================== | 118 //======================================================================== |
| 119 | 119 |
| 120 masterEnv = (MasterEnv*)_VMSMasterEnv; | 120 masterEnv = (MasterEnv*)_VMSMasterEnv; |
| 121 | 121 |
| 122 //GCC may optimize so doesn't always re-define from frame-storage | 122 //GCC may optimize so doesn't always re-define from frame-storage |
| 123 masterPr = (VirtProcr*)volatileMasterPr; //just to make sure after jmp | 123 masterPr = (SlaveVP*)volatileMasterPr; //just to make sure after jmp |
| 124 thisCoresIdx = masterPr->coreAnimatedBy; | 124 thisCoresIdx = masterPr->coreAnimatedBy; |
| 125 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; | 125 readyToAnimateQ = masterEnv->readyToAnimateQs[thisCoresIdx]; |
| 126 schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; | 126 schedSlots = masterEnv->allSchedSlots[thisCoresIdx]; |
| 127 | 127 |
| 128 requestHandler = masterEnv->requestHandler; | 128 requestHandler = masterEnv->requestHandler; |
| 200 /*This has a race condition -- the coreloops are accessing their own queues | 200 /*This has a race condition -- the coreloops are accessing their own queues |
| 201 * at the same time that this work-stealer on a different core is trying to | 201 * at the same time that this work-stealer on a different core is trying to |
| 202 */ | 202 */ |
| 203 void inline | 203 void inline |
| 204 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, | 204 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, |
| 205 VirtProcr *masterPr ) | 205 SlaveVP *masterPr ) |
| 206 { | 206 { |
| 207 VirtProcr *stolenPr; | 207 SlaveVP *stolenPr; |
| 208 int32 coreIdx, i; | 208 int32 coreIdx, i; |
| 209 VMSQueueStruc *currQ; | 209 VMSQueueStruc *currQ; |
| 210 | 210 |
| 211 stolenPr = NULL; | 211 stolenPr = NULL; |
| 212 coreIdx = masterPr->coreAnimatedBy; | 212 coreIdx = masterPr->coreAnimatedBy; |
| 304 * | 304 * |
| 305 */ | 305 */ |
| 306 void inline | 306 void inline |
| 307 gateProtected_stealWorkInto( SchedSlot *currSlot, | 307 gateProtected_stealWorkInto( SchedSlot *currSlot, |
| 308 VMSQueueStruc *myReadyToAnimateQ, | 308 VMSQueueStruc *myReadyToAnimateQ, |
| 309 VirtProcr *masterPr ) | 309 SlaveVP *masterPr ) |
| 310 { | 310 { |
| 311 VirtProcr *stolenPr; | 311 SlaveVP *stolenPr; |
| 312 int32 coreIdx, i, haveAVictim, gotLock; | 312 int32 coreIdx, i, haveAVictim, gotLock; |
| 313 VMSQueueStruc *victimsQ; | 313 VMSQueueStruc *victimsQ; |
| 314 | 314 |
| 315 volatile GateStruc *vicGate; | 315 volatile GateStruc *vicGate; |
| 316 int32 coreMightBeInProtected; | 316 int32 coreMightBeInProtected; |
