diff VMS.h @ 134:a9b72021f053

Distributed memory management w/o free requests working
author Merten Sach <msach@mailbox.tu-berlin.de>
date Fri, 16 Sep 2011 16:19:24 +0200
parents dbfc8382d546
children 0b49fd35afc1
line diff
     1.1 --- a/VMS.h	Fri Sep 16 14:26:18 2011 +0200
     1.2 +++ b/VMS.h	Fri Sep 16 16:19:24 2011 +0200
     1.3 @@ -9,16 +9,16 @@
     1.4  #define	_VMS_H
     1.5  #define _GNU_SOURCE
     1.6  
     1.7 +#include <pthread.h>
     1.8 +#include <sys/time.h>
     1.9 +
    1.10  #include "VMS_primitive_data_types.h"
    1.11  #include "Queue_impl/PrivateQueue.h"
    1.12  #include "Histogram/Histogram.h"
    1.13  #include "DynArray/DynArray.h"
    1.14  #include "Hash_impl/PrivateHash.h"
    1.15  #include "vmalloc.h"
    1.16 -
    1.17 -#include <pthread.h>
    1.18 -#include <sys/time.h>
    1.19 -
    1.20 +#include "requests.h"
    1.21  
    1.22  //===============================  Debug  ===================================
    1.23  //
    1.24 @@ -89,7 +89,7 @@
    1.25  #define VIRT_PROCR_STACK_SIZE 0x8000 /* 32K */
    1.26  
    1.27     // memory for VMS__malloc
    1.28 -#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x10000000 /* 256M */
    1.29 +#define MALLOC_ADDITIONAL_MEM_FROM_OS_SIZE 0x4000000 /* 64M */
    1.30  
    1.31  #define CACHE_LINE 64
    1.32  #define PAGE_SIZE 4096
    1.33 @@ -110,106 +110,15 @@
    1.34  //===========================================================================
    1.35  typedef unsigned long long TSCount;
    1.36  
    1.37 -typedef struct _VMSReqst      VMSReqst;
    1.38 -typedef struct _InterMasterReqst InterMasterReqst;
    1.39  typedef struct _IntervalProbe IntervalProbe;
    1.40  typedef struct _GateStruc     GateStruc;
    1.41  
    1.42  
    1.43  typedef VirtProcr * (*SlaveScheduler)  ( void *, int );   //semEnv, coreIdx
    1.44  typedef void  (*RequestHandler)  ( VirtProcr *, void * ); //prWReqst, semEnv
    1.45 -typedef void  (*VirtProcrFnPtr)  ( void *, VirtProcr * ); //initData, animPr
    1.46 -typedef void    VirtProcrFn      ( void *, VirtProcr * ); //initData, animPr
    1.47  typedef void  (*ResumePrFnPtr)   ( VirtProcr *, void * );
    1.48  
    1.49  
    1.50 -//============= Requests ===========
    1.51 -//
    1.52 -
    1.53 -//VMS Request is the carrier for Slave to Master requests
    1.54 -// it has an embedded sub-type request that is pulled out
    1.55 -// inside the plugin's request handler
    1.56 -enum VMSReqstType   //For Slave->Master requests
    1.57 - { 
    1.58 -   semantic = 1,    //avoid starting enums at 0, for debug reasons
    1.59 -   createReq,
    1.60 -   dissipate,
    1.61 -   VMSSemantic      //goes with VMSSemReqst below
    1.62 - };
    1.63 -
    1.64 -struct _VMSReqst
    1.65 - {
    1.66 -   enum VMSReqstType  reqType;//used for dissipate and in future for IO requests
    1.67 -   void              *semReqData;
    1.68 -
    1.69 -   VMSReqst *nextReqst;
    1.70 - };
    1.71 -//VMSReqst
    1.72 -
    1.73 -//This is a sub-type of Slave->Master requests.
    1.74 -// It's for Slaves to invoke built-in VMS-core functions that have language-like
    1.75 -// behavior.
    1.76 -enum VMSSemReqstType   //These are equivalent to semantic requests, but for
    1.77 - {                     // VMS's services available directly to app, like OS
    1.78 -   createProbe = 1,    // and probe services -- like a VMS-wide built-in lang
    1.79 -   openFile,
    1.80 -   otherIO
    1.81 - };
    1.82 -
    1.83 -typedef struct
    1.84 - { enum VMSSemReqstType reqType;
    1.85 -   VirtProcr           *requestingPr;
    1.86 -   char                *nameStr;  //for create probe
    1.87 - }
    1.88 -VMSSemReq;
    1.89 -
    1.90 -//These are for Master to Master requests
    1.91 -// They get re-cast to the appropriate sub-type of request
    1.92 -enum InterMasterReqstType    //For Master->Master
    1.93 - {
    1.94 -   destVMSCore = 1,          //avoid starting enums at 0, for debug reasons
    1.95 -   destPlugin
    1.96 - };
    1.97 -
    1.98 -struct _InterMasterReqst //Doing a trick to save space & time -- allocate
    1.99 - {  // space for a sub-type then cast first as InterMaster then as sub-type
   1.100 -   enum InterMasterReqstType  reqType;
   1.101 -   InterMasterReqst *nextReqst;
   1.102 - };
   1.103 -//InterMasterReqst  (defined above in typedef block)
   1.104 -
   1.105 -
   1.106 -//These are a sub-type of InterMaster requests.  The inter-master req gets
   1.107 -// re-cast to be of this type, after checking
   1.108 -//This ones for requests between internals of VMS-core.. such as malloc
   1.109 -enum InterVMSCoreReqType   
   1.110 - {
   1.111 -   transfer_free_ptr = 1     //avoid starting enums at 0, for debug reasons
   1.112 - };
   1.113 -
   1.114 -//Doing a trick to save space & time -- allocate space
   1.115 -// for this, cast first as InterMaster then as this
   1.116 -typedef struct  
   1.117 - {
   1.118 -   enum InterMasterReqstType  reqType;  //duplicate InterMasterReqst at top
   1.119 -   InterMasterReqst *nextReqst;
   1.120 -   
   1.121 -   enum InterVMSCoreReqType  secondReqType;
   1.122 -   void                     *freePtr;  //pile up fields, add as needed
   1.123 - } InterVMSCoreReqst;
   1.124 -
   1.125 -//This is for requests between plugins on different cores
   1.126 -// Here, after casting, the pluginReq is extracted and handed to plugin
   1.127 -//Doing a trick to save space & time -- allocate space
   1.128 -// for this, cast first as InterMaster then as this
   1.129 -typedef struct  
   1.130 - {
   1.131 -   enum InterMasterReqstType  reqType;  //copy InterMasterReqst at top
   1.132 -   InterMasterReqst          *nextReqst;
   1.133 -   
   1.134 -   void                      *pluginReq; //plugin will cast to approp type
   1.135 - } InterPluginReqst;
   1.136 -
   1.137  //====================  Core data structures  ===================
   1.138  
   1.139  /*Master Env is the only global variable -- has entry points for any other
   1.140 @@ -311,8 +220,6 @@
   1.141  volatile MasterEnv      *_VMSMasterEnv;
   1.142  
   1.143  
   1.144 -
   1.145 -
   1.146  //===========================  Function Prototypes  =========================
   1.147  
   1.148  
   1.149 @@ -587,7 +494,6 @@
   1.150  
   1.151  //=====
   1.152  
   1.153 -#include "ProcrContext.h"
   1.154  #include "probes.h"
   1.155  #include "vutilities.h"
   1.156