view VMS.h @ 2:02d5a446d506

Compiles with assembly -- warning about jmp w/o '*'?
author Me
date Mon, 31 May 2010 14:23:38 -0700
parents
children 6c518bda83fe
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
13 #include "VMS_primitive_data_types.h"
14 #include "Queue_impl/BlockingQueue.h"
16 //This value is the number of hardware threads in the shared memory
17 // machine
18 #define NUM_WORKERS 4
19 #define NUM_SLAVES 8
21 #define SUCCESS 0
23 #define thdAttrs NULL
25 typedef struct WorkUnit WorkUnit;
26 typedef struct VMSProcr VMSProcr;
27 typedef struct SlaveReqst SlaveReqst;
29 typedef bool8 (*SlaveScheduler) ( void * );
30 typedef void (*RequestHandler) ( SlaveReqst * );
32 typedef struct
33 {
34 QueueStruc *workQ;
35 unsigned int id;
36 }
37 ThdParams;
39 //This is application-level data of the scheduler that runs in the master
40 // virtual processor. This data is at a higher level than the slave data-
41 // struc, which is part of the virtualization infrastructure.. this
42 // MasterEnv sits on top of that level
43 typedef struct
44 {
45 VMSProcr virtSlaves[ NUM_SLAVES ];
46 VMSProcr virtMaster;
48 SlaveScheduler slaveScheduler;
49 RequestHandler requestHandler;
51 int stillRunning;
52 WorkUnit *masterWorkUnit;
54 VMSProcr **scheduledSlaves;
55 int numScheduled;
57 void *OSEventStruc;
58 void *semanticEnv;
59 }
60 MasterEnv;
63 struct WorkUnit
64 {
65 VMSProcr *slaveAssignedTo;
66 void *addrToJumpTo;
67 void *workData;
69 void *pluginSpecific;
70 };
73 struct VMSProcr
74 {
75 WorkUnit *workUnitToDo;
76 SlaveReqst *requestsToMaster;
77 int workIsDone;
78 int needsWorkAssigned;
79 };
81 struct SlaveReqst
82 {
83 VMSProcr *slaveFrom;
84 int reqType;
85 void *reqData;
87 SlaveReqst *nextRequest;
88 };
92 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype
95 //===================== Global Vars ===================
97 pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info
98 QueueStruc *workQ;
99 ThdParams thdParams[ NUM_WORKERS ];
101 MasterEnv *masterEnv;
104 #endif /* _VMS_H */