comparison SchedulingMaster.c @ 224:efcc6331a2a2

fixed stack handling in fn that points the slave to a top-level function
author Some Random Person <seanhalle@yahoo.com>
date Wed, 14 Mar 2012 23:21:01 -0700
parents c88ce1db91ef
children 309559064073
comparison
equal deleted inserted replaced
0:671a6194db2d 1:f053397e2c4d
24 /*This code is animated by the virtual Master processor. 24 /*This code is animated by the virtual Master processor.
25 * 25 *
26 *Polls each sched slot exactly once, hands any requests made by a newly 26 *Polls each sched slot exactly once, hands any requests made by a newly
27 * done slave to the "request handler" plug-in function 27 * done slave to the "request handler" plug-in function
28 * 28 *
29 *Any slots that need a Slv assigned are given to the "schedule" 29 *Any slots that need a Slv assigned are given to the "assign"
30 * plug-in function, which tries to assign a Slv (slave) to it. 30 * plug-in function, which tries to assign a Slv (slave) to it.
31 * 31 *
32 *When all slots needing a processor have been given to the schedule plug-in, 32 *When all slots needing a processor have been given to the assign plug-in,
33 * a fraction of the slaves successfully scheduled are put into the 33 * a fraction of the slaves successfully assigned are put into the
34 * work queue, then a continuation of this function is put in, then the rest 34 * work queue, then a continuation of this function is put in, then the rest
35 * of the Slvs that were successfully scheduled. 35 * of the Slvs that were successfully assigned.
36 * 36 *
37 *The first thing the continuation does is busy-wait until the previous 37 *The first thing the continuation does is busy-wait until the previous
38 * animation completes. This is because an (unlikely) continuation may 38 * animation completes. This is because an (unlikely) continuation may
39 * sneak through queue before previous continuation is done putting second 39 * sneak through queue before previous continuation is done putting second
40 * part of scheduled slaves in, which is the only race condition. 40 * part of assigned slaves in, which is the only race condition.
41 * 41 *
42 */ 42 */
43 43
44 /*May 29, 2010 -- birth a Master during init so that first core controller to 44 /*May 29, 2010 -- birth a Master during init so that first core controller to
45 * start running gets it and does all the stuff for a newly born -- 45 * start running gets it and does all the stuff for a newly born --
76 SlaveVP *schedSlaveVP; 76 SlaveVP *schedSlaveVP;
77 SchedSlot *currSlot, **schedSlots; 77 SchedSlot *currSlot, **schedSlots;
78 MasterEnv *masterEnv; 78 MasterEnv *masterEnv;
79 VMSQueueStruc *readyToAnimateQ; 79 VMSQueueStruc *readyToAnimateQ;
80 80
81 Sched_Assigner slaveAssigner; 81 SlaveAssigner slaveAssigner;
82 RequestHandler requestHandler; 82 RequestHandler requestHandler;
83 void *semanticEnv; 83 void *semanticEnv;
84 84
85 int32 thisCoresIdx; 85 int32 thisCoresIdx;
86 SlaveVP *masterVP; 86 SlaveVP *masterVP;
141 MEAS__endReqHdlr; 141 MEAS__endReqHdlr;
142 } 142 }
143 if( currSlot->needsSlaveAssigned ) 143 if( currSlot->needsSlaveAssigned )
144 { //give slot a new Slv 144 { //give slot a new Slv
145 schedSlaveVP = 145 schedSlaveVP =
146 (*slaveAssigner)( semanticEnv, thisCoresIdx ); 146 (*slaveAssigner)( semanticEnv, thisCoresIdx, currSlot );
147 147
148 if( schedSlaveVP != NULL ) 148 if( schedSlaveVP != NULL )
149 { currSlot->slaveAssignedToSlot = schedSlaveVP; 149 { currSlot->slaveAssignedToSlot = schedSlaveVP;
150 schedSlaveVP->schedSlot = currSlot; 150 schedSlaveVP->schedSlot = currSlot;
151 currSlot->needsSlaveAssigned = FALSE; 151 currSlot->needsSlaveAssigned = FALSE;