Mercurial > cgi-bin > hgwebdir.cgi > VMS > VMS_Implementations > VMS_impls > VMS__MC_shared_impl
view 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 source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
9 #ifndef _VMS_H
10 #define _VMS_H
12 #include "VMS_primitive_data_types.h"
13 #include "Queue_impl/BlockingQueue.h"
15 //This value is the number of hardware threads in the shared memory
16 // machine -- make double that number scheduling slots, plus extra for master
17 #define NUM_WORKERS 4
18 #define NUM_SCHED_SLOTS 9
20 #define SUCCESS 0
22 #define thdAttrs NULL
24 typedef struct _WorkUnit WorkUnit;
25 typedef struct _VirtProcr VirtProcr;
26 typedef struct _SlaveReqst SlaveReqst;
27 typedef struct _SchedSlot SchedSlot;
29 typedef bool8 (*SlaveScheduler) ( SchedSlot *, void * );
30 typedef void (*RequestHandler) ( SlaveReqst * );
31 typedef void (*VirtProcrFnPtr) ( void *, VirtProcr * );
32 typedef void VirtProcrFn( void *, VirtProcr * );
34 typedef struct
35 {
36 QueueStruc *workQ;
37 unsigned int id;
38 }
39 ThdParams;
41 struct _SchedSlot
42 {
43 int workIsDone;
44 int needsProcrAssigned;
45 VirtProcr *procrAssignedToSlot;
46 };
49 struct _VirtProcr
50 {
51 void *stackPtr;
52 void *framePtr;
53 void *nextInstrPt;
54 void *coreLoopStartPt; //allows proto-runtime to be linked later
56 void *initialData;
58 SchedSlot *schedSlot;
59 SlaveReqst *requests;
61 void *semanticData;
62 };
65 //When optimize make a separate flat array in here for each flag in SchedSlot
66 //So that polling done flags is fast.. not sure even worth it, though..
67 typedef struct
68 {
69 SlaveScheduler slaveScheduler;
70 RequestHandler requestHandler;
72 SchedSlot **schedSlots;
73 SchedSlot **filledSlots;
74 int numFilled;
76 int stillRunning;
78 VirtProcr *masterVirtPr;
79 void *semanticEnv;
80 void *OSEventStruc; //for future, when add I/O to BLIS
81 }
82 MasterEnv;
86 struct _SlaveReqst
87 {
88 VirtProcr *slaveFrom;
89 int reqType; //for future when have I/O and OS services
90 void *semReqData;
92 SlaveReqst *nextRequest;
93 };
97 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype
100 //===================== Global Vars ===================
103 pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info
104 ThdParams thdParams[ NUM_WORKERS ];
106 volatile MasterEnv *_VMSMasterEnv;
108 //workQ is global, static, and volatile so that core loop has its location
109 // hard coded, and reloads every time through the loop -- that way don't
110 // need to save any regs used by core loop (will see if this really works)
111 volatile QueueStruc *_VMSWorkQ;
114 #endif /* _VMS_H */
