annotate VMS.h @ 0:a5fe730dfc2e

Initial add -- for sourceforge repositories
author Me
date Sat, 22 May 2010 19:37:58 -0700
parents
children 6c518bda83fe
rev   line source
Me@0 1 /*
Me@0 2 * Copyright 2009 OpenSourceStewardshipFoundation.org
Me@0 3 * Licensed under GNU General Public License version 2
Me@0 4 *
Me@0 5 * Author: seanhalle@yahoo.com
Me@0 6 *
Me@0 7 */
Me@0 8
Me@0 9 #ifndef _VMS_H
Me@0 10 #define _VMS_H
Me@0 11
Me@0 12
Me@0 13 #include "VMS_primitive_data_types.h"
Me@0 14 #include "Queue_impl/BlockingQueue.h"
Me@0 15
Me@0 16 //This value is the number of hardware threads in the shared memory
Me@0 17 // machine
Me@0 18 #define NUM_WORKERS 4
Me@0 19 #define NUM_SLAVES 8
Me@0 20
Me@0 21 #define SUCCESS 0
Me@0 22
Me@0 23 #define thdAttrs NULL
Me@0 24
Me@0 25 typedef struct WorkUnit WorkUnit;
Me@0 26 typedef struct VMSProcr VMSProcr;
Me@0 27 typedef struct SlaveReqst SlaveReqst;
Me@0 28
Me@0 29 typedef bool8 (*SlaveScheduler) ( void * );
Me@0 30 typedef void (*RequestHandler) ( SlaveReqst * );
Me@0 31
Me@0 32 typedef struct
Me@0 33 {
Me@0 34 QueueStruc *workQ;
Me@0 35 unsigned int id;
Me@0 36 }
Me@0 37 ThdParams;
Me@0 38
Me@0 39 //This is application-level data of the scheduler that runs in the master
Me@0 40 // virtual processor. This data is at a higher level than the slave data-
Me@0 41 // struc, which is part of the virtualization infrastructure.. this
Me@0 42 // MasterEnv sits on top of that level
Me@0 43 typedef struct
Me@0 44 {
Me@0 45 VMSProcr virtSlaves[ NUM_SLAVES ];
Me@0 46 VMSProcr virtMaster;
Me@0 47
Me@0 48 SlaveScheduler slaveScheduler;
Me@0 49 RequestHandler requestHandler;
Me@0 50
Me@0 51 int stillRunning;
Me@0 52 WorkUnit *masterWorkUnit;
Me@0 53
Me@0 54 VMSProcr **scheduledSlaves;
Me@0 55 int numScheduled;
Me@0 56
Me@0 57 void *OSEventStruc;
Me@0 58 void *semanticEnv;
Me@0 59 }
Me@0 60 MasterEnv;
Me@0 61
Me@0 62
Me@0 63 struct WorkUnit
Me@0 64 {
Me@0 65 VMSProcr *slaveAssignedTo;
Me@0 66 void *addrToJumpTo;
Me@0 67 void *workData;
Me@0 68
Me@0 69 void *pluginSpecific;
Me@0 70 };
Me@0 71
Me@0 72
Me@0 73 struct VMSProcr
Me@0 74 {
Me@0 75 WorkUnit *workUnitToDo;
Me@0 76 SlaveReqst *requestsToMaster;
Me@0 77 int workIsDone;
Me@0 78 int needsWorkAssigned;
Me@0 79 };
Me@0 80
Me@0 81 struct SlaveReqst
Me@0 82 {
Me@0 83 VMSProcr *slaveFrom;
Me@0 84 int reqType;
Me@0 85 void *reqData;
Me@0 86
Me@0 87 SlaveReqst *nextRequest;
Me@0 88 };
Me@0 89
Me@0 90
Me@0 91
Me@0 92 void * coreLoop( void *paramsIn ); //standard PThreads fn prototype
Me@0 93
Me@0 94
Me@0 95 //===================== Global Vars ===================
Me@0 96
Me@0 97 pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info
Me@0 98 QueueStruc *workQ;
Me@0 99 ThdParams thdParams[ NUM_WORKERS ];
Me@0 100
Me@0 101 MasterEnv *masterEnv;
Me@0 102
Me@0 103
Me@0 104 #endif /* _VMS_H */
Me@0 105