# HG changeset patch # User Me # Date 1277928666 25200 # Node ID aa634ef7cc35b63b2d6d00492412b27356ce4722 # Parent 1dbc7f6e3e67bd591d4de7714f6349665aed3279 Full VMS test -- works diff -r 1dbc7f6e3e67 -r aa634ef7cc35 VMS.h --- a/VMS.h Wed Jun 30 13:10:59 2010 -0700 +++ b/VMS.h Wed Jun 30 13:11:06 2010 -0700 @@ -14,24 +14,28 @@ #include #include -//This value is the number of hardware threads in the shared memory -// machine -- make double that number scheduling slots, plus extra for master -#define NUM_CORES 4 -#define NUM_SCHED_SLOTS 9 + //This value is the number of hardware threads in the shared memory + // machine +#define NUM_CORES 4 + + // make double-num-cores scheduling slots, plus extra for master +#define NUM_SCHED_SLOTS (2 * NUM_CORES + 1) + + //128K stack.. compromise, want 10K virtPr +#define VIRT_PROCR_STACK_SIZE 0x100000 #define SUCCESS 0 //#define thdAttrs NULL //For PThreads typedef struct _SchedSlot SchedSlot; -typedef struct _SlaveReqst SlaveReqst; +typedef struct _SlaveReqst VMSReqst; typedef struct _VirtProcr VirtProcr; -typedef bool8 (*SlaveScheduler) ( SchedSlot *, void * ); -typedef void (*RequestHandler) ( SlaveReqst * ); -typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); -typedef void VirtProcrFn( void *, VirtProcr * ); - +typedef VirtProcr * (*SlaveScheduler) ( void * ); //semEnv +typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv +typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr +typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr typedef struct { @@ -51,20 +55,27 @@ }; //SchedSlot +enum ReqstType + { + semantic = 1, + dissipate, + IO + }; struct _SlaveReqst { - VirtProcr *slaveFrom; - int reqType; //for future when have I/O and OS services - void *semReqData; +// VirtProcr *virtProcrFrom; + enum ReqstType reqType; //used for dissipate and in future for IO requests + void *semReqData; - SlaveReqst *nextRequest; + VMSReqst *nextReqst; }; //SlaveReqst struct _VirtProcr { int procrID; //for debugging -- count up each time create int coreAnimatedBy; + void *startOfStack; void *stackPtr; void *framePtr; void *nextInstrPt; @@ -76,7 +87,7 @@ void *initialData; SchedSlot *schedSlot; - SlaveReqst *requests; + VMSReqst *requests; void *semanticData; }; @@ -136,11 +147,26 @@ VirtProcr * VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData ); +VirtProcr * +VMS__create_the_shutdown_procr(); + inline void VMS__send_sem_request( void *semReqData, VirtProcr *callingPr ); void -VMS__suspend_processor( VirtProcr *callingPr ); +VMS__send_dissipate_request( VirtProcr *procrToDissipate ); + +void +VMS__remove_and_free_top_request( VirtProcr *reqstingPr ); + +void +VMS__suspend_procr( VirtProcr *callingPr ); + +void +VMS__dissipate_procr( VirtProcr *prToDissipate ); + +void +VMS__shutdown(); //============================= Statistics ================================== @@ -157,7 +183,9 @@ inline TSCount getTSCount(); +//===================== Debug ========================== int numProcrsCreated; + #endif /* _VMS_H */