Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
comparison VMS.h @ 34:609c7222e4a6
Added tag Pin2Core for changeset e69579a0e797
| author | Me |
|---|---|
| date | Wed, 01 Sep 2010 08:26:46 -0700 |
| parents | c8823e0bb2b4 |
| children | 17d20e5cf924 |
comparison
equal
deleted
inserted
replaced
| 11:073454e80208 | 12:77fe3230b77d |
|---|---|
| 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 //When DEBUG is defined, VMS does sequential exe in the main thread | |
| 18 // It still does co-routines and all the mechanisms are the same, it just | |
| 19 // has only a single thread and animates VPs one at a time | |
| 20 //#define DEBUG | |
| 21 | |
| 17 //This value is the number of hardware threads in the shared memory | 22 //This value is the number of hardware threads in the shared memory |
| 18 // machine | 23 // machine |
| 19 #define NUM_CORES 4 | 24 #define NUM_CORES 4 |
| 20 | 25 |
| 21 // make double-num-cores scheduling slots, plus extra for master | 26 // make double-num-cores scheduling slots, plus extra for master |
| 22 //#define NUM_SCHED_SLOTS (2 * NUM_CORES + 1) | 27 //#define NUM_SCHED_SLOTS (2 * NUM_CORES + 1) |
| 23 #define NUM_SCHED_SLOTS 3 | 28 #define NUM_SCHED_SLOTS 3 |
| 24 | 29 |
| 25 // 8K stack | 30 #define READYTOANIMATE_RETRIES 10000 |
| 26 #define VIRT_PROCR_STACK_SIZE 0x20000 | 31 |
| 32 // stack | |
| 33 #define VIRT_PROCR_STACK_SIZE 0x10000 | |
| 27 | 34 |
| 28 //256M of total memory for VMS application to VMS__malloc | 35 //256M of total memory for VMS application to VMS__malloc |
| 29 #define MASSIVE_MALLOC_SIZE 0x10000000 | 36 #define MASSIVE_MALLOC_SIZE 0x10000000 |
| 30 | 37 |
| 31 #define NUM_PREPEND_BYTES sizeof(FreeListElem) + sizeof(ownerElem); | 38 #define NUM_PREPEND_BYTES sizeof(FreeListElem) + sizeof(ownerElem); |
| 41 | 48 |
| 42 typedef struct _SchedSlot SchedSlot; | 49 typedef struct _SchedSlot SchedSlot; |
| 43 typedef struct _VMSReqst VMSReqst; | 50 typedef struct _VMSReqst VMSReqst; |
| 44 typedef struct _VirtProcr VirtProcr; | 51 typedef struct _VirtProcr VirtProcr; |
| 45 | 52 |
| 46 typedef VirtProcr * (*SlaveScheduler) ( void * ); //semEnv | 53 typedef VirtProcr * (*SlaveScheduler) ( void *, int ); //semEnv, coreIdx |
| 47 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv | 54 typedef void (*RequestHandler) ( VirtProcr *, void * ); //prWReqst, semEnv |
| 48 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr | 55 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * ); //initData, animPr |
| 49 typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr | 56 typedef void VirtProcrFn ( void *, VirtProcr * ); //initData, animPr |
| 50 | 57 |
| 51 typedef struct | 58 typedef struct |
| 107 | 114 |
| 108 | 115 |
| 109 | 116 |
| 110 typedef struct | 117 typedef struct |
| 111 { | 118 { |
| 112 SlaveScheduler slaveScheduler; | 119 SlaveScheduler slaveScheduler; |
| 113 RequestHandler requestHandler; | 120 RequestHandler requestHandler; |
| 114 | 121 |
| 115 SchedSlot **schedSlots; | 122 SchedSlot ***allSchedSlots; |
| 116 SchedSlot **filledSlots; | 123 SRSWQueueStruc **readyToAnimateQs; |
| 117 int numToPrecede; | 124 VirtProcr **masterVPs; |
| 118 | 125 |
| 119 volatile int stillRunning; | 126 void *semanticEnv; |
| 120 | 127 void *OSEventStruc; //for future, when add I/O to BLIS |
| 121 VirtProcr *masterVirtPr; | 128 |
| 122 | 129 void *coreLoopStartPt;//addr to jump to to re-enter coreLoop |
| 123 void *semanticEnv; | 130 void *coreLoopEndPt; //addr to jump to to shut down a coreLoop |
| 124 void *OSEventStruc; //for future, when add I/O to BLIS | 131 |
| 125 | 132 int setupComplete; |
| 126 void *coreLoopEndPt; //addr to jump to to shut down a coreLoop | 133 int masterLock; |
| 127 | |
| 128 int setupComplete; | |
| 129 | |
| 130 void *mallocChunk; | |
| 131 } | 134 } |
| 132 MasterEnv; | 135 MasterEnv; |
| 133 | 136 |
| 134 | 137 |
| 135 //========================================================== | 138 //========================================================== |
| 147 pthread_mutex_t suspendLock; | 150 pthread_mutex_t suspendLock; |
| 148 pthread_cond_t suspend_cond; | 151 pthread_cond_t suspend_cond; |
| 149 | 152 |
| 150 volatile MasterEnv *_VMSMasterEnv; | 153 volatile MasterEnv *_VMSMasterEnv; |
| 151 | 154 |
| 152 //workQ is global, static, and volatile so that core loop has its location | |
| 153 // hard coded, and reloads every time through the loop -- that way don't | |
| 154 // need to save any regs used by core loop | |
| 155 volatile VMSQueueStruc *_VMSWorkQ; | |
| 156 | |
| 157 //========================== | 155 //========================== |
| 158 void | 156 void |
| 159 VMS__init(); | 157 VMS__init(); |
| 160 | 158 |
| 161 void | 159 void |
| 187 void | 185 void |
| 188 VMS__remove_and_free_top_request( VirtProcr *reqstingPr ); | 186 VMS__remove_and_free_top_request( VirtProcr *reqstingPr ); |
| 189 | 187 |
| 190 VMSReqst * | 188 VMSReqst * |
| 191 VMS__take_top_request_from( VirtProcr *reqstingPr ); | 189 VMS__take_top_request_from( VirtProcr *reqstingPr ); |
| 190 | |
| 191 VMSReqst * | |
| 192 VMS__free_top_and_give_next_request_from( VirtProcr *procrWithReq ); | |
| 192 | 193 |
| 193 inline void * | 194 inline void * |
| 194 VMS__take_sem_reqst_from( VMSReqst *req ); | 195 VMS__take_sem_reqst_from( VMSReqst *req ); |
| 195 | 196 |
| 196 inline int | 197 inline int |
