rambrain
dummyManagedMemory.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 DUMMYMANAGEDMEMORY_H
21 #define DUMMYMANAGEDMEMORY_H
22 
23 #include "managedMemory.h"
24 #include "managedDummySwap.h"
25 #include "exceptions.h"
26 
27 namespace rambrain
28 {
31 {
32 protected:
34 public:
35  managedDummySwapContainer() : mswap ( 0 ) {}
37 };
38 
39 
40 
41 
46 {
47 public:
49  virtual ~dummyManagedMemory() {}
50 
51 protected:
52  inline virtual swapErrorCode swapOut ( global_bytesize ) {
53  rambrain_pthread_mutex_unlock ( &managedMemory::stateChangeMutex );
54  Throw ( memoryException ( "No memory manager in place." ) );
55  return ERR_SUCCESS;
56  }
57  inline virtual bool swapIn ( managedMemoryChunk & ) {
58  rambrain_pthread_mutex_unlock ( &managedMemory::stateChangeMutex );
59  Throw ( memoryException ( "No memory manager in place." ) );
60  return ERR_SUCCESS;
61  }
62  inline virtual bool touch ( managedMemoryChunk & ) {
63  rambrain_pthread_mutex_unlock ( &managedMemory::stateChangeMutex );
64  Throw ( memoryException ( "No memory manager in place." ) );
65  return ERR_SUCCESS;
66  }
67  inline virtual void untouch ( managedMemoryChunk & ) {
68  rambrain_pthread_mutex_unlock ( &managedMemory::stateChangeMutex );
69  Throw ( memoryException ( "No memory manager in place." ) );
70  return;
71  }
72  inline virtual void schedulerRegister ( managedMemoryChunk & ) {
73  rambrain_pthread_mutex_unlock ( &managedMemory::stateChangeMutex );
74  Throw ( memoryException ( "No memory manager in place." ) );
75  }
76  inline virtual void schedulerDelete ( managedMemoryChunk & ) {
77  rambrain_pthread_mutex_unlock ( &managedMemory::stateChangeMutex );
78  Throw ( memoryException ( "No memory manager in place." ) );
79  }
80 
81 };
82 
83 }
84 
85 #endif // DUMMYMANAGEDMEMORY_H
86 
87 
88 
89 
90 
91 
92 
Exception for errors with the memory.
Definition: exceptions.h:87
virtual bool touch(managedMemoryChunk &)
marks chunk as recently active as a hint for scheduling
Swapping action was successful.
static bool Throw(memoryException e)
Custom throw function, as we need to prevent throwing exceptions in construtors.
virtual void untouch(managedMemoryChunk &)
marks chunk as recently not needed any more
virtual void schedulerRegister(managedMemoryChunk &)
gives scheduler code the opportunity to register its own datastructures associated with a chunk ...
uint64_t global_bytesize
Definition: common.h:65
virtual void schedulerDelete(managedMemoryChunk &)
signals deletion of chunk to scheduler code
static pthread_mutex_t stateChangeMutex
A dummy class to get rid of initialization problems.
manages all managed Chunks of raw memory
a dummy managed Memory that basically does nothing and throws on everything.
virtual swapErrorCode swapOut(global_bytesize)
swaps out at least min_size bytes
swapErrorCode
Error codes for swapOut requests.
A dummy swap that just copies swapped out chunks to a different location in ram.
virtual bool swapIn(managedMemoryChunk &)
Tries to swap in chunk chunk.
Backend class to handle raw memory and interaction/storage with managedSwap.
Definition: managedMemory.h:68