diff VMS.h @ 0:a5fe730dfc2e

Initial add -- for sourceforge repositories
author Me
date Sat, 22 May 2010 19:37:58 -0700
parents
children 6c518bda83fe
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/VMS.h	Sat May 22 19:37:58 2010 -0700
     1.3 @@ -0,0 +1,105 @@
     1.4 +/*
     1.5 + *  Copyright 2009 OpenSourceStewardshipFoundation.org
     1.6 + *  Licensed under GNU General Public License version 2
     1.7 + *
     1.8 + * Author: seanhalle@yahoo.com
     1.9 + *
    1.10 + */
    1.11 +
    1.12 +#ifndef _VMS_H
    1.13 +#define	_VMS_H
    1.14 +
    1.15 +
    1.16 +#include "VMS_primitive_data_types.h"
    1.17 +#include "Queue_impl/BlockingQueue.h"
    1.18 +
    1.19 +//This value is the number of hardware threads in the shared memory
    1.20 +// machine
    1.21 +#define NUM_WORKERS 4
    1.22 +#define NUM_SLAVES  8
    1.23 +
    1.24 +#define SUCCESS 0
    1.25 +
    1.26 +#define thdAttrs NULL
    1.27 +
    1.28 +typedef struct WorkUnit   WorkUnit;
    1.29 +typedef struct VMSProcr   VMSProcr;
    1.30 +typedef struct SlaveReqst SlaveReqst;
    1.31 +
    1.32 +typedef bool8 (*SlaveScheduler)    ( void * );
    1.33 +typedef void  (*RequestHandler)  ( SlaveReqst * );
    1.34 +
    1.35 +typedef struct
    1.36 + {
    1.37 +   QueueStruc     *workQ;
    1.38 +   unsigned int    id;
    1.39 + }
    1.40 +ThdParams;
    1.41 +
    1.42 +//This is application-level data of the scheduler that runs in the master
    1.43 +// virtual processor.  This data is at a higher level than the slave data-
    1.44 +// struc, which is part of the virtualization infrastructure..  this
    1.45 +// MasterEnv sits on top of that level
    1.46 +typedef struct
    1.47 + {
    1.48 +   VMSProcr    virtSlaves[ NUM_SLAVES ];
    1.49 +   VMSProcr    virtMaster;
    1.50 +   
    1.51 +   SlaveScheduler  slaveScheduler;
    1.52 +   RequestHandler  requestHandler;
    1.53 +
    1.54 +   int         stillRunning;
    1.55 +   WorkUnit   *masterWorkUnit;
    1.56 +   
    1.57 +   VMSProcr  **scheduledSlaves;
    1.58 +   int         numScheduled;
    1.59 +
    1.60 +   void       *OSEventStruc;
    1.61 +   void       *semanticEnv;
    1.62 + }
    1.63 +MasterEnv;
    1.64 +
    1.65 +
    1.66 +struct WorkUnit
    1.67 + {
    1.68 +   VMSProcr   *slaveAssignedTo;
    1.69 +   void       *addrToJumpTo;
    1.70 +   void       *workData;
    1.71 +
    1.72 +   void       *pluginSpecific;
    1.73 + };
    1.74 +
    1.75 +
    1.76 +struct VMSProcr
    1.77 + {
    1.78 +   WorkUnit    *workUnitToDo;
    1.79 +   SlaveReqst  *requestsToMaster;
    1.80 +   int          workIsDone;
    1.81 +   int          needsWorkAssigned;
    1.82 + };
    1.83 +
    1.84 +struct SlaveReqst
    1.85 + {
    1.86 +   VMSProcr    *slaveFrom;
    1.87 +   int          reqType;
    1.88 +   void        *reqData;
    1.89 +
    1.90 +   SlaveReqst  *nextRequest;
    1.91 + };
    1.92 +
    1.93 +
    1.94 +
    1.95 +void * coreLoop( void *paramsIn );  //standard PThreads fn prototype
    1.96 +
    1.97 +
    1.98 +//=====================  Global Vars ===================
    1.99 +
   1.100 +pthread_t      coreLoopThds[ NUM_WORKERS ];  // std struc, holds thread info
   1.101 +QueueStruc    *workQ;
   1.102 +ThdParams      thdParams[ NUM_WORKERS ];
   1.103 +
   1.104 +MasterEnv     *masterEnv;
   1.105 +
   1.106 +
   1.107 +#endif	/* _VMS_H */
   1.108 +