Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.h @ 26:668278fa7a63
Sequential -- just starting to add sequential version
| author | Me |
|---|---|
| date | Mon, 26 Jul 2010 15:25:53 -0700 |
| parents | c556193f7211 |
| children | 8b9e4c333fe6 |
comparison
equal
deleted
inserted
replaced
| 7:563990bca016 | 8:ba282221bc18 |
|---|---|
| 10 #define _VMS_H | 10 #define _VMS_H |
| 11 #define __USE_GNU | 11 #define __USE_GNU |
| 12 | 12 |
| 13 #include "VMS_primitive_data_types.h" | 13 #include "VMS_primitive_data_types.h" |
| 14 #include "Queue_impl/BlockingQueue.h" | 14 #include "Queue_impl/BlockingQueue.h" |
| 15 #include "pthread.h" | 15 #include <pthread.h> |
| 16 | 16 |
| 17 //This value is the number of hardware threads in the shared memory | 17 //This value is the number of hardware threads in the shared memory |
| 18 // machine | 18 // machine |
| 19 #define NUM_CORES 4 | 19 #define NUM_CORES 4 |
| 20 | 20 |
| 21 // make double-num-cores scheduling slots, plus extra for master | 21 // make double-num-cores scheduling slots, plus extra for master |
| 22 #define NUM_SCHED_SLOTS (2 * NUM_CORES + 1) | 22 #define NUM_SCHED_SLOTS (2 * NUM_CORES + 1) |
| 23 | 23 |
| 24 //128K stack.. compromise, want 10K virtPr | 24 //128K stack.. compromise, want 10K virtPr |
| 25 #define VIRT_PROCR_STACK_SIZE 0x100000 | 25 #define VIRT_PROCR_STACK_SIZE 0x10000 |
| 26 | 26 |
| 27 #define SUCCESS 0 | 27 #define SUCCESS 0 |
| 28 | 28 |
| 29 #define writeVMSQ writePThdQ | |
| 30 #define readVMSQ readPThdQ | |
| 31 #define makeVMSQ makePThdQ | |
| 32 #define VMSQueueStruc PThdQueueStruc | |
| 33 | |
| 29 //#define thdAttrs NULL //For PThreads | 34 //#define thdAttrs NULL //For PThreads |
| 30 | 35 |
| 31 typedef struct _SchedSlot SchedSlot; | 36 typedef struct _SchedSlot SchedSlot; |
| 32 typedef struct _VMSReqst VMSReqst; | 37 typedef struct _VMSReqst VMSReqst; |
| 33 typedef struct _VirtProcr VirtProcr; | 38 typedef struct _VirtProcr VirtProcr; |
| 34 | 39 |
| 35 typedef VirtProcr * (*SlaveScheduler) ( void * ); //semEnv | 40 typedef VirtProcr * (*SlaveScheduler) ( void * ); //semEnv |
| 36 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv | 41 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv |
| 37 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr | 42 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr |
| 101 SlaveScheduler slaveScheduler; | 106 SlaveScheduler slaveScheduler; |
| 102 RequestHandler requestHandler; | 107 RequestHandler requestHandler; |
| 103 | 108 |
| 104 SchedSlot **schedSlots; | 109 SchedSlot **schedSlots; |
| 105 SchedSlot **filledSlots; | 110 SchedSlot **filledSlots; |
| 106 int numFilled; | 111 int numToPrecede; |
| 107 | 112 |
| 108 int stillRunning; | 113 volatile int stillRunning; |
| 109 | 114 |
| 110 VirtProcr *masterVirtPr; | 115 VirtProcr *masterVirtPr; |
| 111 | 116 |
| 112 void *semanticEnv; | 117 void *semanticEnv; |
| 113 void *OSEventStruc; //for future, when add I/O to BLIS | 118 void *OSEventStruc; //for future, when add I/O to BLIS |
| 114 | 119 |
| 115 void *coreLoopShutDownPt; //addr to jump to to shut down a coreLoop | 120 void *coreLoopShutDownPt; //addr to jump to to shut down a coreLoop |
| 116 | 121 |
| 117 int setupComplete; | 122 int setupComplete; |
| 118 pthread_mutex_t suspend_mutex; | |
| 119 pthread_cond_t suspend_cond; | |
| 120 } | 123 } |
| 121 MasterEnv; | 124 MasterEnv; |
| 122 | 125 |
| 123 | 126 |
| 124 //========================================================== | 127 //========================================================== |
| 128 | 131 |
| 129 | 132 |
| 130 //===================== Global Vars =================== | 133 //===================== Global Vars =================== |
| 131 | 134 |
| 132 | 135 |
| 133 pthread_t coreLoopThdHandles[ NUM_CORES ]; //pthread's virt-procr state | 136 pthread_t coreLoopThdHandles[ NUM_CORES ]; //pthread's virt-procr state |
| 134 ThdParams *coreLoopThdParams[ NUM_CORES ]; | 137 ThdParams *coreLoopThdParams [ NUM_CORES ]; |
| 138 pthread_mutex_t suspendLock; | |
| 139 pthread_cond_t suspend_cond; | |
| 135 | 140 |
| 136 volatile MasterEnv *_VMSMasterEnv; | 141 volatile MasterEnv *_VMSMasterEnv; |
| 137 | 142 |
| 138 //workQ is global, static, and volatile so that core loop has its location | 143 //workQ is global, static, and volatile so that core loop has its location |
| 139 // hard coded, and reloads every time through the loop -- that way don't | 144 // hard coded, and reloads every time through the loop -- that way don't |
| 140 // need to save any regs used by core loop | 145 // need to save any regs used by core loop |
| 141 volatile CASQueueStruc *_VMSWorkQ; | 146 volatile VMSQueueStruc *_VMSWorkQ; |
| 142 | 147 |
| 143 //========================== | 148 //========================== |
| 144 void | 149 void |
| 145 VMS__init(); | 150 VMS__init(); |
| 146 | 151 |
