Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.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 | f1374d5dbb98 |
comparison
equal
deleted
inserted
replaced
| 59:cac64ab4b0f6 | 60:7e64f7549292 |
|---|---|
| 109 int i; | 109 int i; |
| 110 for(i=0; i<NUM_CORES; i++) | 110 for(i=0; i<NUM_CORES; i++) |
| 111 { | 111 { |
| 112 _VMSMasterEnv->freeListHead[i] = VMS_ext__create_free_list(); | 112 _VMSMasterEnv->freeListHead[i] = VMS_ext__create_free_list(); |
| 113 _VMSMasterEnv->interMasterRequestsFor[i] = NULL; | 113 _VMSMasterEnv->interMasterRequestsFor[i] = NULL; |
| 114 _VMSMasterEnv->interMasterRequestsSentBy[i] = NULL; | |
| 114 } | 115 } |
| 115 _VMSMasterEnv->currentMasterProcrID = 0; | 116 _VMSMasterEnv->currentMasterProcrID = 0; |
| 116 | 117 |
| 117 | 118 |
| 118 //============================= MEASUREMENT STUFF ======================== | 119 //============================= MEASUREMENT STUFF ======================== |
| 560 { VMSSemReq *semReq; | 561 { VMSSemReq *semReq; |
| 561 IntervalProbe *newProbe; | 562 IntervalProbe *newProbe; |
| 562 | 563 |
| 563 semReq = req->semReqData; | 564 semReq = req->semReqData; |
| 564 | 565 |
| 565 newProbe = VMS__malloc( sizeof(IntervalProbe) ); | 566 switch(semReq->reqType){ |
| 566 newProbe->nameStr = VMS__strDup( semReq->nameStr ); | 567 case createProbe: |
| 567 newProbe->hist = NULL; | 568 newProbe = VMS__malloc( sizeof(IntervalProbe) ); |
| 568 newProbe->schedChoiceWasRecorded = FALSE; | 569 newProbe->nameStr = VMS__strDup( (char*)semReq->data ); |
| 569 | 570 newProbe->hist = NULL; |
| 570 //This runs in masterVP, so no race-condition worries | 571 newProbe->schedChoiceWasRecorded = FALSE; |
| 571 newProbe->probeID = | 572 |
| 572 addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo ); | 573 //This runs in masterVP, so no race-condition worries |
| 573 | 574 newProbe->probeID = |
| 574 requestingPr->dataRetFromReq = newProbe; | 575 addToDynArray( newProbe, _VMSMasterEnv->dynIntervalProbesInfo ); |
| 575 | 576 requestingPr->dataRetFromReq = newProbe; |
| 576 (*resumePrFnPtr)( requestingPr, semEnv ); | 577 break; |
| 578 case interMasterReqst: | |
| 579 sendInterMasterReqst(semReq->receiverID, | |
| 580 (InterMasterReqst*)semReq->data); | |
| 581 break; | |
| 582 default: | |
| 583 break; | |
| 584 } | |
| 585 | |
| 586 resumePrFnPtr( requestingPr, semEnv ); | |
| 577 } | 587 } |
| 578 | 588 |
| 579 | 589 |
| 580 | 590 |
| 581 /*This must be called by the request handler plugin -- it cannot be called | 591 /*This must be called by the request handler plugin -- it cannot be called |
| 607 // been alloc'd with VMS__malloc, or freed by the level above animPr. | 617 // been alloc'd with VMS__malloc, or freed by the level above animPr. |
| 608 //So, all that's left to free here is the stack and the VirtProcr struc | 618 //So, all that's left to free here is the stack and the VirtProcr struc |
| 609 // itself | 619 // itself |
| 610 //Note, should not stack-allocate initial data -- no guarantee, in | 620 //Note, should not stack-allocate initial data -- no guarantee, in |
| 611 // general that creating processor will outlive ones it creates. | 621 // general that creating processor will outlive ones it creates. |
| 612 VMS__free( animatingPr->startOfStack ); | 622 |
| 613 VMS__free( animatingPr ); | 623 |
| 624 /* | |
| 625 * call the core specific version, because the creating master can already be dead | |
| 626 */ | |
| 627 //VMS__free_in_lib( animatingPr->startOfStack, animatingPr ); | |
| 628 //VMS__free_in_lib( animatingPr, animatingPr); | |
| 614 } | 629 } |
| 615 | 630 |
| 616 | 631 |
| 617 //TODO: look at architecting cleanest separation between request handler | 632 //TODO: look at architecting cleanest separation between request handler |
| 618 // and master loop, for dissipate, create, shutdown, and other non-semantic | 633 // and master loop, for dissipate, create, shutdown, and other non-semantic |
| 769 freeDynArrayDeep( _VMSMasterEnv->dynIntervalProbesInfo, &VMS__free_probe); | 784 freeDynArrayDeep( _VMSMasterEnv->dynIntervalProbesInfo, &VMS__free_probe); |
| 770 #endif | 785 #endif |
| 771 //======================================================================== | 786 //======================================================================== |
| 772 */ | 787 */ |
| 773 //These are the only two that use system free | 788 //These are the only two that use system free |
| 774 VMS_ext__free_free_list( _VMSMasterEnv->freeListHead); | 789 int i; |
| 790 for(i=0; i<NUM_CORES; i++) | |
| 791 VMS_ext__free_free_list( _VMSMasterEnv->freeListHead[i]); | |
| 775 free( (void *)_VMSMasterEnv ); | 792 free( (void *)_VMSMasterEnv ); |
| 776 } | 793 } |
| 777 | 794 |
| 778 | 795 |
| 779 //================================ | 796 //================================ |
