Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
changeset 278:2fc69e6c14ea Dev_ML
Dev_ML -- works in both sequential and concurrent modes
| author | Sean Halle <seanhalle@yahoo.com> |
|---|---|
| date | Fri, 08 Mar 2013 05:34:21 -0800 |
| parents | 1d7ea1b0f176 |
| children | 72ffdb11ad8e 15ee3fe10e3d |
| files | AnimationMaster.c CoreController.c PR.c PR__SS.c PR__WL.c PR__int.c PR__structs.h |
| diffstat | 7 files changed, 39 insertions(+), 26 deletions(-) [+] |
line diff
1.1 --- a/AnimationMaster.c Mon Mar 04 00:40:38 2013 -0800 1.2 +++ b/AnimationMaster.c Fri Mar 08 05:34:21 2013 -0800 1.3 @@ -74,9 +74,11 @@ 1.4 if( slot->workIsDone ) 1.5 { slot->workIsDone = FALSE; 1.6 slot->needsWorkAssigned = TRUE; 1.7 +printf("top handle request: %d | reqType: %d\n", slot->coreSlotIsOn, (int32)req->reqType );fflush(stdin); 1.8 1.9 //An Idle VP has no request to handle, so skip to assign.. 1.10 - if( slot->slaveAssignedToSlot->typeOfVP != IdleVP ) 1.11 + if( slot->slaveAssignedToSlot->typeOfVP != IdleVP && 1.12 + slot->slaveAssignedToSlot->typeOfVP != ShutdownVP) 1.13 { 1.14 HOLISTIC__Record_AppResponder_start; //TODO: update to check which process for each slot 1.15 MEAS__startReqHdlr; 1.16 @@ -93,7 +95,8 @@ 1.17 1.18 //Handle task create and end first -- they're special cases.. 1.19 switch( req->reqType ) 1.20 - { case TaskEnd: 1.21 + { 1.22 + case TaskEnd: 1.23 { //do PR handler, which calls lang's hdlr and does recycle of 1.24 // free task slave if needed -- PR handler checks for free task Slv 1.25 PRHandle__EndTask( req, slave ); break; 1.26 @@ -121,6 +124,11 @@ 1.27 MEAS__endReqHdlr; 1.28 HOLISTIC__Record_AppResponder_end; 1.29 }//if not idleVP 1.30 + else if( slot->slaveAssignedToSlot->typeOfVP == ShutdownVP ) 1.31 + { //ShutdownVP used, essentially, as a flag, to cause terminate here 1.32 + PR_int__release_master_lock(); 1.33 + terminateCoreCtlr( slot->slaveAssignedToSlot ); 1.34 + } 1.35 } //if have request to be handled 1.36 1.37 //NOTE: IF statement is leftover from when master managed many slots
2.1 --- a/CoreController.c Mon Mar 04 00:40:38 2013 -0800 2.2 +++ b/CoreController.c Fri Mar 08 05:34:21 2013 -0800 2.3 @@ -121,7 +121,7 @@ 2.4 2.5 HOLISTIC__CoreCtrl_Setup; 2.6 2.7 - DEBUG__printf1(TRUE, "started coreCtrlr", thisCoresIdx ); 2.8 + DEBUG__printf1(TRUE, "started coreCtrlr %d", thisCoresIdx ); 2.9 2.10 //====================== The Core Controller ====================== 2.11 while(1) 2.12 @@ -180,7 +180,6 @@ 2.13 { numTriesToGetLock = 0; pthread_yield(); } 2.14 } //while( currVP == NULL ) 2.15 MEAS__Capture_Post_Master_Lock_Point; 2.16 - 2.17 //have master lock, perform master function, which manages request 2.18 // handling and assigning work to this core's slot 2.19 foundWork = 2.20 @@ -214,7 +213,7 @@ 2.21 terminateCoreCtlr(SlaveVP *currSlv) 2.22 { 2.23 //first, free shutdown Slv that jumped here, then end the pthread 2.24 - PR_int__recycle_slaveVP( currSlv ); 2.25 +// PR_int__free_slaveVP( currSlv ); 2.26 pthread_exit( NULL ); 2.27 } 2.28
3.1 --- a/PR.c Mon Mar 04 00:40:38 2013 -0800 3.2 +++ b/PR.c Fri Mar 08 05:34:21 2013 -0800 3.3 @@ -160,12 +160,14 @@ 3.4 return process; 3.5 } 3.6 3.7 +void 3.8 PR__end_seedVP( SlaveVP *seedSlv ) 3.9 { 3.10 PR_WL__send_end_slave_req( NULL, (RequestHandler)&PRServ__handleDissipateSeed, seedSlv, 3.11 PRServ_MAGIC_NUMBER ); 3.12 } 3.13 3.14 +void 3.15 PR__end_process_from_inside( SlaveVP *seedSlv ) 3.16 { 3.17 PR_WL__send_lang_request( NULL, (RequestHandler)&PRServ__handle_end_process_from_inside,
4.1 --- a/PR__SS.c Mon Mar 04 00:40:38 2013 -0800 4.2 +++ b/PR__SS.c Fri Mar 08 05:34:21 2013 -0800 4.3 @@ -401,7 +401,8 @@ 4.4 SlaveVP *shutDownSlv; 4.5 AnimSlot **animSlots; 4.6 //create the shutdown processors, one for each core controller -- put them 4.7 - // directly into the Q -- each core will die when gets one 4.8 + // directly into the slots 4.9 + PR_int__get_master_lock(); 4.10 for( coreIdx = 0; coreIdx < NUM_CORES; coreIdx++ ) 4.11 { //Note, this is running in the master 4.12 shutDownSlv = PR_SS__create_shutdown_slave(); 4.13 @@ -409,20 +410,22 @@ 4.14 // shut down slave into first animulng slot. 4.15 animSlots = _PRTopEnv->allAnimSlots[ coreIdx ]; 4.16 animSlots[0]->slaveAssignedToSlot = shutDownSlv; 4.17 - animSlots[0]->needsWorkAssigned = FALSE; 4.18 - shutDownSlv->coreAnimatedBy = coreIdx; 4.19 - shutDownSlv->animSlotAssignedTo = animSlots[ 0 ]; 4.20 + animSlots[0]->workIsDone = TRUE; 4.21 + animSlots[0]->needsWorkAssigned = FALSE; 4.22 + shutDownSlv->coreAnimatedBy = coreIdx; 4.23 + shutDownSlv->animSlotAssignedTo = animSlots[ 0 ]; 4.24 } 4.25 + PR_int__release_master_lock(); 4.26 } 4.27 4.28 4.29 -SlaveVP* PR_SS__create_shutdown_slave() 4.30 +SlaveVP* PR_SS__create_shutdown_slave(int32 coreNum) 4.31 { 4.32 SlaveVP* shutdownVP; 4.33 4.34 - shutdownVP = PR_int__create_slaveVP_helper( &endOSThreadFn, NULL ); 4.35 - shutdownVP->typeOfVP = ShutdownVP; 4.36 - 4.37 + shutdownVP = PR_int__create_slaveVP_helper( &idle_fn, NULL ); 4.38 + shutdownVP->typeOfVP = ShutdownVP; 4.39 + 4.40 return shutdownVP; 4.41 } 4.42 4.43 @@ -494,6 +497,7 @@ 4.44 #ifdef DEBUG__TURN_ON_SEQUENTIAL_MODE 4.45 asmTerminateCoreCtlrSeq(animatingSlv); 4.46 #else 4.47 + return; 4.48 asmTerminateCoreCtlr(animatingSlv); 4.49 #endif 4.50 }
5.1 --- a/PR__WL.c Mon Mar 04 00:40:38 2013 -0800 5.2 +++ b/PR__WL.c Fri Mar 08 05:34:21 2013 -0800 5.3 @@ -239,7 +239,7 @@ 5.4 PR_WL__throw_exception( char *msgStr, SlaveVP *reqstSlv, PRExcp *excpData ) 5.5 { PRReqst req; 5.6 PRServiceReq langReq; 5.7 - 5.8 + printf("exception"); 5.9 req.reqType = Language; 5.10 req.langReq = &langReq; 5.11 req.nextReqst = reqstSlv->request; //gab any other preceeding
6.1 --- a/PR__int.c Mon Mar 04 00:40:38 2013 -0800 6.2 +++ b/PR__int.c Fri Mar 08 05:34:21 2013 -0800 6.3 @@ -709,7 +709,7 @@ 6.4 PRCollElem **coll; 6.5 //Note using size of a pointer to a coll element 6.6 int32 numBytes = sizeof(int32) + numInColl * sizeof(PRCollElem *); 6.7 - prolog = PR_WL__malloc( numBytes ); 6.8 + prolog = PR_int__malloc( numBytes ); 6.9 6.10 //operation of collection relies upon initial entries being NULL 6.11 memset(prolog, ZERO, numBytes>>2); //BUG: if size not multiple of 4
7.1 --- a/PR__structs.h Mon Mar 04 00:40:38 2013 -0800 7.2 +++ b/PR__structs.h Fri Mar 08 05:34:21 2013 -0800 7.3 @@ -121,17 +121,17 @@ 7.4 enum PRReqstType //avoid starting enums at 0, for debug reasons 7.5 { 7.6 TaskCreate = 1, 7.7 - TaskEnd, 7.8 - SlvCreate, 7.9 - SlvDissipate, 7.10 - Language, 7.11 - Service, //To invoke a PR provided equivalent of a language request (ex: probe) 7.12 - Hardware, 7.13 - IO, 7.14 - OSCall, 7.15 - LangShutdown, 7.16 - ProcessEnd, 7.17 - PRShutdown 7.18 + TaskEnd = 2, 7.19 + SlvCreate = 3, 7.20 + SlvDissipate = 4, 7.21 + Language = 5, 7.22 + Service = 6, //To invoke a PR provided equivalent of a language request (ex: probe) 7.23 + Hardware = 7, 7.24 + IO = 8, 7.25 + OSCall = 9, 7.26 + LangShutdown = 10, 7.27 + ProcessEnd = 11, 7.28 + PRShutdown = 12 7.29 }; 7.30 7.31
