rambrain
managedMemoryChunk.h
Go to the documentation of this file.
1 /* rambrain - a dynamical physical memory extender
2  * Copyright (C) 2015 M. Imgrund, A. Arth
3  * mimgrund (at) mpifr-bonn.mpg.de
4  * arth (at) usm.uni-muenchen.de
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see <http://www.gnu.org/licenses/>.
18  */
19 
20 #ifndef MANAGEDMEMORYCHUNK_H
21 #define MANAGEDMEMORYCHUNK_H
22 
23 #include "common.h"
24 
25 namespace rambrain
26 {
27 
31  MEM_ALLOCATED_INUSE = 1, //flaggy
32  MEM_ALLOCATED = 4, //flaggy
33  MEM_SWAPPED = 8, //flaggy
34  MEM_SWAPIN = 16,
36  };
37 
38 typedef uint64_t memoryID;
39 typedef uint64_t memoryAtime;
40 
55 {
56 public:
57 #ifdef PARENTAL_CONTROL
58  managedMemoryChunk ( const memoryID &parent, const memoryID &me );
59 #else
60  managedMemoryChunk ( const memoryID &me );
61 #endif
62 
63  //Local management
65  unsigned short useCnt ;
66  void *locPtr ;
68 
69  //Organization
70  memoryID id ;
71 #ifdef PARENTAL_CONTROL
72  memoryID parent ;
73  memoryID next;
74  memoryID child ;
75 #endif
76  bool preemptiveLoaded = false;
77 
78  //Swap scheduling:
79  void *schedBuf ;
80 
81  //Swap raw management:
82  void *swapBuf;
83 };
84 
85 }
86 
87 #endif
88 
void * locPtr
pointer to the actual data in RAM
uint64_t memoryID
void * swapBuf
a place to store additional swapping information
void * schedBuf
a place to store additional scheduling information
memoryID child
first child element if creating a class hierarchy
uint64_t global_bytesize
Definition: common.h:65
memoryID next
next element
manages all managed Chunks of raw memory
uint64_t memoryAtime
memoryID parent
parent element if created in class hierarchy
managedMemoryChunk(const memoryID &parent, const memoryID &me)
global_bytesize size
Size of actual object in bytes.
unsigned short useCnt
Number of using adhereTos or a possible location for locking the object to changes.