comparison MasterLoop.c @ 135:0b49fd35afc1

distributed free working -app sends a VMSSemReqst to his Master which send a request to a different Master -Master send the request directly -The request structure is freed by the sender, when the request was handled There are still problems on shutdown. The shutdownVPs are all allocated by one Master which is likly to be terminated
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 16 Sep 2011 20:08:28 +0200
parents a9b72021f053
children 99343ffe1918
comparison
equal deleted inserted replaced
39:2dc716be808c 40:16f6d7d5ef20
10 #include <stddef.h> 10 #include <stddef.h>
11 11
12 #include "VMS.h" 12 #include "VMS.h"
13 #include "ProcrContext.h" 13 #include "ProcrContext.h"
14 #include "scheduling.h" 14 #include "scheduling.h"
15 #include "inter_VMS_request_handlers.h" 15 #include "inter_VMS_requests.h"
16 #include "inter_VMS_requests_handler.h"
16 17
17 //=========================================================================== 18 //===========================================================================
18 void inline 19 void inline
19 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ, 20 stealWorkInto( SchedSlot *currSlot, VMSQueueStruc *readyToAnimateQ,
20 VirtProcr *masterPr); 21 VirtProcr *masterPr);
125 requestHandler = masterEnv->requestHandler; 126 requestHandler = masterEnv->requestHandler;
126 slaveScheduler = masterEnv->slaveScheduler; 127 slaveScheduler = masterEnv->slaveScheduler;
127 semanticEnv = masterEnv->semanticEnv; 128 semanticEnv = masterEnv->semanticEnv;
128 129
129 //First, check for requests from other MasterVPs, and handle them 130 //First, check for requests from other MasterVPs, and handle them
130 InterMasterReqst* currReq = masterEnv->interMasterRequestsFor[thisCoresIdx]; 131 InterMasterReqst* currReqst = masterEnv->interMasterRequestsFor[thisCoresIdx];
131 while(currReq) 132 while(currReqst)
132 { 133 {
133 handleInterMasterReq( currReq, semanticEnv, masterPr ); 134 handleInterMasterReq( currReqst, semanticEnv, masterPr );
134 currReq = currReq->nextReqst; 135 currReqst = currReqst->nextReqst;
135 } 136 }
137 masterEnv->interMasterRequestsFor[thisCoresIdx] = NULL;
138
139 //Second, check for own request that were handled for other MasterVPs
140 currReqst = masterEnv->interMasterRequestsSentBy[thisCoresIdx];
141 while(currReqst && currReqst->obsolete)
142 {
143 InterMasterReqst *nextReqst = currReqst->nextSentReqst;
144 VMS__free(currReqst);
145 currReqst = nextReqst;
146 }
147 masterEnv->interMasterRequestsSentBy[thisCoresIdx] = currReqst;
136 148
137 //Now, take care of the SlaveVPs 149 //Now, take care of the SlaveVPs
138 //Go through the slots -- if Slave there newly suspended, handle its request 150 //Go through the slots -- if Slave there newly suspended, handle its request
139 // then, either way, ask assigner to fill each slot 151 // then, either way, ask assigner to fill each slot
140 numSlotsFilled = 0; 152 numSlotsFilled = 0;
226 void inline 238 void inline
227 handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr ) 239 handleInterVMSCoreReq( InterVMSCoreReqst *currReq, VirtProcr *masterPr )
228 { 240 {
229 switch( currReq->reqType ) 241 switch( currReq->reqType )
230 { 242 {
231 case transfer_free_ptr: handleTransferFree( currReq, masterPr ); 243 case transfer_free_ptr:
232 break; 244 handleTransferFree( currReq, masterPr );
245 currReq->obsolete = 1; //now the sender can free the structure
246 break;
233 default: 247 default:
234 break; 248 break;
235 } 249 }
236 } 250 }
237 251