Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
diff VMS.h @ 5:6c518bda83fe
About to chg to win thds -- good except for that
| author | Me |
|---|---|
| date | Mon, 31 May 2010 19:15:14 -0700 |
| parents | a5fe730dfc2e |
| children | f96e4b3b35c7 |
line diff
1.1 --- a/VMS.h Mon May 31 15:24:42 2010 -0700 1.2 +++ b/VMS.h Mon May 31 19:15:14 2010 -0700 1.3 @@ -9,25 +9,27 @@ 1.4 #ifndef _VMS_H 1.5 #define _VMS_H 1.6 1.7 - 1.8 #include "VMS_primitive_data_types.h" 1.9 #include "Queue_impl/BlockingQueue.h" 1.10 1.11 //This value is the number of hardware threads in the shared memory 1.12 -// machine 1.13 -#define NUM_WORKERS 4 1.14 -#define NUM_SLAVES 8 1.15 +// machine -- make double that number scheduling slots, plus extra for master 1.16 +#define NUM_WORKERS 4 1.17 +#define NUM_SCHED_SLOTS 9 1.18 1.19 #define SUCCESS 0 1.20 1.21 #define thdAttrs NULL 1.22 1.23 -typedef struct WorkUnit WorkUnit; 1.24 -typedef struct VMSProcr VMSProcr; 1.25 -typedef struct SlaveReqst SlaveReqst; 1.26 +typedef struct _WorkUnit WorkUnit; 1.27 +typedef struct _VirtProcr VirtProcr; 1.28 +typedef struct _SlaveReqst SlaveReqst; 1.29 +typedef struct _SchedSlot SchedSlot; 1.30 1.31 -typedef bool8 (*SlaveScheduler) ( void * ); 1.32 +typedef bool8 (*SlaveScheduler) ( SchedSlot *, void * ); 1.33 typedef void (*RequestHandler) ( SlaveReqst * ); 1.34 +typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); 1.35 +typedef void VirtProcrFn( void *, VirtProcr * ); 1.36 1.37 typedef struct 1.38 { 1.39 @@ -36,53 +38,56 @@ 1.40 } 1.41 ThdParams; 1.42 1.43 -//This is application-level data of the scheduler that runs in the master 1.44 -// virtual processor. This data is at a higher level than the slave data- 1.45 -// struc, which is part of the virtualization infrastructure.. this 1.46 -// MasterEnv sits on top of that level 1.47 +struct _SchedSlot 1.48 + { 1.49 + int workIsDone; 1.50 + int needsProcrAssigned; 1.51 + VirtProcr *procrAssignedToSlot; 1.52 + }; 1.53 + 1.54 + 1.55 +struct _VirtProcr 1.56 + { 1.57 + void *stackPtr; 1.58 + void *framePtr; 1.59 + void *nextInstrPt; 1.60 + void *coreLoopStartPt; //allows proto-runtime to be linked later 1.61 + 1.62 + void *initialData; 1.63 + 1.64 + SchedSlot *schedSlot; 1.65 + SlaveReqst *requests; 1.66 + 1.67 + void *semanticData; 1.68 + }; 1.69 + 1.70 + 1.71 +//When optimize make a separate flat array in here for each flag in SchedSlot 1.72 +//So that polling done flags is fast.. not sure even worth it, though.. 1.73 typedef struct 1.74 { 1.75 - VMSProcr virtSlaves[ NUM_SLAVES ]; 1.76 - VMSProcr virtMaster; 1.77 + SlaveScheduler slaveScheduler; 1.78 + RequestHandler requestHandler; 1.79 1.80 - SlaveScheduler slaveScheduler; 1.81 - RequestHandler requestHandler; 1.82 - 1.83 + SchedSlot **schedSlots; 1.84 + SchedSlot **filledSlots; 1.85 + int numFilled; 1.86 + 1.87 int stillRunning; 1.88 - WorkUnit *masterWorkUnit; 1.89 1.90 - VMSProcr **scheduledSlaves; 1.91 - int numScheduled; 1.92 - 1.93 - void *OSEventStruc; 1.94 + VirtProcr *masterVirtPr; 1.95 void *semanticEnv; 1.96 + void *OSEventStruc; //for future, when add I/O to BLIS 1.97 } 1.98 MasterEnv; 1.99 1.100 1.101 -struct WorkUnit 1.102 + 1.103 +struct _SlaveReqst 1.104 { 1.105 - VMSProcr *slaveAssignedTo; 1.106 - void *addrToJumpTo; 1.107 - void *workData; 1.108 - 1.109 - void *pluginSpecific; 1.110 - }; 1.111 - 1.112 - 1.113 -struct VMSProcr 1.114 - { 1.115 - WorkUnit *workUnitToDo; 1.116 - SlaveReqst *requestsToMaster; 1.117 - int workIsDone; 1.118 - int needsWorkAssigned; 1.119 - }; 1.120 - 1.121 -struct SlaveReqst 1.122 - { 1.123 - VMSProcr *slaveFrom; 1.124 - int reqType; 1.125 - void *reqData; 1.126 + VirtProcr *slaveFrom; 1.127 + int reqType; //for future when have I/O and OS services 1.128 + void *semReqData; 1.129 1.130 SlaveReqst *nextRequest; 1.131 }; 1.132 @@ -94,11 +99,16 @@ 1.133 1.134 //===================== Global Vars =================== 1.135 1.136 + 1.137 pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info 1.138 -QueueStruc *workQ; 1.139 ThdParams thdParams[ NUM_WORKERS ]; 1.140 1.141 -MasterEnv *masterEnv; 1.142 +volatile MasterEnv *_VMSMasterEnv; 1.143 + 1.144 + //workQ is global, static, and volatile so that core loop has its location 1.145 + // hard coded, and reloads every time through the loop -- that way don't 1.146 + // need to save any regs used by core loop (will see if this really works) 1.147 +volatile QueueStruc *_VMSWorkQ; 1.148 1.149 1.150 #endif /* _VMS_H */
