Me@0: /* Me@0: * Copyright 2009 OpenSourceStewardshipFoundation.org Me@0: * Licensed under GNU General Public License version 2 Me@0: * Me@0: * Author: seanhalle@yahoo.com Me@0: * Me@0: */ Me@0: Me@0: #ifndef _VMS_H Me@0: #define _VMS_H Me@0: Me@0: Me@0: #include "VMS_primitive_data_types.h" Me@0: #include "Queue_impl/BlockingQueue.h" Me@0: Me@0: //This value is the number of hardware threads in the shared memory Me@0: // machine Me@0: #define NUM_WORKERS 4 Me@0: #define NUM_SLAVES 8 Me@0: Me@0: #define SUCCESS 0 Me@0: Me@0: #define thdAttrs NULL Me@0: Me@0: typedef struct WorkUnit WorkUnit; Me@0: typedef struct VMSProcr VMSProcr; Me@0: typedef struct SlaveReqst SlaveReqst; Me@0: Me@0: typedef bool8 (*SlaveScheduler) ( void * ); Me@0: typedef void (*RequestHandler) ( SlaveReqst * ); Me@0: Me@0: typedef struct Me@0: { Me@0: QueueStruc *workQ; Me@0: unsigned int id; Me@0: } Me@0: ThdParams; Me@0: Me@0: //This is application-level data of the scheduler that runs in the master Me@0: // virtual processor. This data is at a higher level than the slave data- Me@0: // struc, which is part of the virtualization infrastructure.. this Me@0: // MasterEnv sits on top of that level Me@0: typedef struct Me@0: { Me@0: VMSProcr virtSlaves[ NUM_SLAVES ]; Me@0: VMSProcr virtMaster; Me@0: Me@0: SlaveScheduler slaveScheduler; Me@0: RequestHandler requestHandler; Me@0: Me@0: int stillRunning; Me@0: WorkUnit *masterWorkUnit; Me@0: Me@0: VMSProcr **scheduledSlaves; Me@0: int numScheduled; Me@0: Me@0: void *OSEventStruc; Me@0: void *semanticEnv; Me@0: } Me@0: MasterEnv; Me@0: Me@0: Me@0: struct WorkUnit Me@0: { Me@0: VMSProcr *slaveAssignedTo; Me@0: void *addrToJumpTo; Me@0: void *workData; Me@0: Me@0: void *pluginSpecific; Me@0: }; Me@0: Me@0: Me@0: struct VMSProcr Me@0: { Me@0: WorkUnit *workUnitToDo; Me@0: SlaveReqst *requestsToMaster; Me@0: int workIsDone; Me@0: int needsWorkAssigned; Me@0: }; Me@0: Me@0: struct SlaveReqst Me@0: { Me@0: VMSProcr *slaveFrom; Me@0: int reqType; Me@0: void *reqData; Me@0: Me@0: SlaveReqst *nextRequest; Me@0: }; Me@0: Me@0: Me@0: Me@0: void * coreLoop( void *paramsIn ); //standard PThreads fn prototype Me@0: Me@0: Me@0: //===================== Global Vars =================== Me@0: Me@0: pthread_t coreLoopThds[ NUM_WORKERS ]; // std struc, holds thread info Me@0: QueueStruc *workQ; Me@0: ThdParams thdParams[ NUM_WORKERS ]; Me@0: Me@0: MasterEnv *masterEnv; Me@0: Me@0: Me@0: #endif /* _VMS_H */ Me@0: