[Pvfs2-developers] concurrent sms

Walter B. Ligon III walt at clemson.edu
Tue Aug 15 14:05:21 EDT 2006


Sam,  all of the code is "written" but I am debugging it as we speak.
There will probably be some more interim checkins on the branch today,
but until my testing is done I won't start merging with the main branch.
Obviously I don't want to be too far from end end when I start that.

Here is some test code I wrote yesterday to start parallel children.  I
have inserted it into the server's get_config SM and it doesn't do 
anything but print some debug info, but it should be instructional.

Focus on state start_pjmp and the action functions start_pjmp_action
and end_pjmp_action

/********************************************************************/

machine pvfs2_get_config_sm(prelude, init, final_response, cleanup
         ,start_pjmp, end_pjmp)
{
         state prelude
         {
                 jump pvfs2_prelude_sm;
                 success => start_pjmp;
                 default => final_response;
         }
 

         state start_pjmp
         {
             pjmp start_pjmp_action
             {
                 1 => pvfs2_server_test_pjmp_sm;
             }
             default => end_pjmp;
         }
 

         state end_pjmp
         {
             run end_pjmp_action;
             default => init;
         }
 

         state init
         {
                 run getconfig_init;
                 default => final_response;
         }
 

         ... /* rest of get_config states are here */
}
 

machine pvfs2_server_test_pjmp_sm(st1, st2, st3)
{
     state st1
     {
         run st1_action;
         default => st2;
     }
 

     state st2
     {
         run st2_action;
         default => st3;
     }
 

     state st3
     {
         run st3_action;
         default => terminate;
     }
 

}
 

%%
 

/*******************/
static PINT_sm_action start_pjmp_action(
     struct PINT_smcb *smcb, job_status_s *js_p)
{
     int i;
     for (i = 0; i < 4; i++)
     {
         struct PINT_server_op *s_op = malloc(sizeof(struct 
PINT_server_op));
         s_op->op = i; /* used in print to ID task */
         PINT_sm_push_frame(smcb, 1, s_op);
     }
     return SM_ACTION_DEFERRED;
}
 

static PINT_sm_action end_pjmp_action(
     struct PINT_smcb *smcb, job_status_s *js_p)
{
     int i;
     for (i = 0; i < 4; i++)
     {
         struct PINT_server_op *s_op = PINT_sm_pop_frame(smcb);
         free(s_op);
     }
     return SM_ACTION_COMPLETE;
}
 

static PINT_sm_action st1_action(
     struct PINT_smcb *smcb, job_status_s *js_p)
{
     struct PINT_server_op *s_op = PINT_sm_frame(smcb, PINT_FRAME_CURRENT);
     fprintf("RUNNING ACTION: ST1 TASK: T%d\n", s_op->op);
     return SM_ACTION_COMPLETE;
}

... /* st2_action and st3_action are the same */

/************************/

/* rest of get_config action functions are here */

/**************************************************************************/

I'm sure you'll have questions, so take a look and fire away

Walt

Sam Lang wrote:
> 
> Hi Walt,
> 
> I've started looking at the concurrent state machine code in your  
> branch, to see what it would be like to write a state machine that  does 
> some concurrent child state machines.  It looks like most of the  
> framework is in place, but I couldn't find any examples of concurrent  
> state machines in action.  Could you give a basic example of setting  up 
> a concurrent state machine?
> 
> Also, I noticed that PINT_sm_start_child_frames has:
> 
>     for(i = smcb->framebaseptr; i < smcb->framebaseptr; i++)
> 
> I think this must be a bug preventing child state machines from  
> actually starting.  Do you know at what point this stuff will be  ready 
> to be merged to the trunk?
> 
> Thanks,
> 
> -sam
> _______________________________________________
> Pvfs2-developers mailing list
> Pvfs2-developers at beowulf-underground.org
> http://www.beowulf-underground.org/mailman/listinfo/pvfs2-developers

-- 
Dr. Walter B. Ligon III
Associate Professor
ECE Department
Clemson University


More information about the Pvfs2-developers mailing list