diff VMS.h @ 23:aa634ef7cc35

Full VMS test -- works
author Me
date Wed, 30 Jun 2010 13:11:06 -0700
parents c3e6c3fda84e
children 2b161e1a50ee
line diff
     1.1 --- a/VMS.h	Wed Jun 30 13:10:59 2010 -0700
     1.2 +++ b/VMS.h	Wed Jun 30 13:11:06 2010 -0700
     1.3 @@ -14,24 +14,28 @@
     1.4  #include <windows.h>
     1.5  #include <winbase.h>
     1.6  
     1.7 -//This value is the number of hardware threads in the shared memory
     1.8 -// machine -- make double that number scheduling slots, plus extra for master
     1.9 -#define NUM_CORES      4
    1.10 -#define NUM_SCHED_SLOTS  9
    1.11 +   //This value is the number of hardware threads in the shared memory
    1.12 +   // machine
    1.13 +#define NUM_CORES        4
    1.14 +
    1.15 +   // make double-num-cores scheduling slots, plus extra for master
    1.16 +#define NUM_SCHED_SLOTS  (2 * NUM_CORES + 1)
    1.17 +
    1.18 +   //128K stack.. compromise, want 10K virtPr
    1.19 +#define VIRT_PROCR_STACK_SIZE 0x100000
    1.20  
    1.21  #define SUCCESS 0
    1.22  
    1.23  //#define thdAttrs NULL  //For PThreads
    1.24  
    1.25  typedef struct _SchedSlot  SchedSlot;
    1.26 -typedef struct _SlaveReqst SlaveReqst;
    1.27 +typedef struct _SlaveReqst VMSReqst;
    1.28  typedef struct _VirtProcr  VirtProcr;
    1.29  
    1.30 -typedef bool8 (*SlaveScheduler)  ( SchedSlot *, void * );
    1.31 -typedef void  (*RequestHandler)  ( SlaveReqst * );
    1.32 -typedef void  (*VirtProcrFnPtr)  ( void *, VirtProcr * );
    1.33 -typedef void  VirtProcrFn( void *, VirtProcr * );
    1.34 -
    1.35 +typedef VirtProcr * (*SlaveScheduler)  ( void * );        //semEnv
    1.36 +typedef void  (*RequestHandler)  ( VirtProcr *, void * ); //prWReqst, semEnv
    1.37 +typedef void  (*VirtProcrFnPtr)  ( void *, VirtProcr * ); //initData, animPr
    1.38 +typedef void    VirtProcrFn      ( void *, VirtProcr * ); //initData, animPr
    1.39  
    1.40  typedef struct
    1.41   {
    1.42 @@ -51,20 +55,27 @@
    1.43   };
    1.44  //SchedSlot
    1.45   
    1.46 +enum ReqstType
    1.47 + {
    1.48 +   semantic = 1,
    1.49 +   dissipate,
    1.50 +   IO
    1.51 + };
    1.52  
    1.53  struct _SlaveReqst
    1.54   {
    1.55 -   VirtProcr   *slaveFrom;
    1.56 -   int          reqType;   //for future when have I/O and OS services
    1.57 -   void        *semReqData;
    1.58 +//   VirtProcr   *virtProcrFrom;
    1.59 +   enum ReqstType  reqType;  //used for dissipate and in future for IO requests
    1.60 +   void           *semReqData;
    1.61  
    1.62 -   SlaveReqst  *nextRequest;
    1.63 +   VMSReqst *nextReqst;
    1.64   };
    1.65  //SlaveReqst
    1.66  
    1.67  struct _VirtProcr
    1.68   { int         procrID;  //for debugging -- count up each time create
    1.69     int         coreAnimatedBy;
    1.70 +   void       *startOfStack;
    1.71     void       *stackPtr;
    1.72     void       *framePtr;
    1.73     void       *nextInstrPt;
    1.74 @@ -76,7 +87,7 @@
    1.75     void       *initialData;
    1.76  
    1.77     SchedSlot  *schedSlot;
    1.78 -   SlaveReqst *requests;
    1.79 +   VMSReqst   *requests;
    1.80  
    1.81     void       *semanticData;
    1.82   };
    1.83 @@ -136,11 +147,26 @@
    1.84  VirtProcr *
    1.85  VMS__create_procr( VirtProcrFnPtr fnPtr, void *initialData );
    1.86  
    1.87 +VirtProcr *
    1.88 +VMS__create_the_shutdown_procr();
    1.89 +
    1.90  inline void
    1.91  VMS__send_sem_request( void *semReqData, VirtProcr *callingPr );
    1.92  
    1.93  void
    1.94 -VMS__suspend_processor( VirtProcr *callingPr );
    1.95 +VMS__send_dissipate_request( VirtProcr *procrToDissipate );
    1.96 +
    1.97 +void
    1.98 +VMS__remove_and_free_top_request( VirtProcr *reqstingPr );
    1.99 +
   1.100 +void
   1.101 +VMS__suspend_procr( VirtProcr *callingPr );
   1.102 +
   1.103 +void
   1.104 +VMS__dissipate_procr( VirtProcr *prToDissipate );
   1.105 +
   1.106 +void
   1.107 +VMS__shutdown();
   1.108  
   1.109  //============================= Statistics ==================================
   1.110  
   1.111 @@ -157,7 +183,9 @@
   1.112  
   1.113  inline TSCount getTSCount();
   1.114  
   1.115 +//===================== Debug ==========================
   1.116  int numProcrsCreated;
   1.117  
   1.118 +
   1.119  #endif	/* _VMS_H */
   1.120