20 #ifndef CYCLICMANAGEDMEMORY_H
21 #define CYCLICMANAGEDMEMORY_H
136 #define MUTUAL_CONNECT(A,B) A->next = B; B->prev = A;
138 #define BACKLOG_ADD_SIZE(maction,mvalue) {backlog[backlog_pos].action = maction;backlog[backlog_pos].value.size= mvalue;backlog_pos=(backlog_pos+1)%backlog_size;};
139 #define BACKLOG_ADD_ID(maction,mvalue) {backlog[backlog_pos].action = maction;backlog[backlog_pos].value.id= mvalue ;backlog_pos=(backlog_pos+1)%backlog_size;};
global_bytesize preemptiveBytes
structure created by scheduler to track access times of memoryChunks
cyclicAtime * next
The chunk.
static void printChain(const char *name, const chain mchain)
virtual void schedulerRegister(managedMemoryChunk &chunk)
gives scheduler code the opportunity to register its own datastructures associated with a chunk ...
static void insertBefore(cyclicAtime *pos, chain separated)
virtual ~cyclicManagedMemory()
void printMemUsage() const
prints out current memory usage
Class that serves as a backend to managedMemory to actual write/read managedMemoryChunks to/from hard...
bool setPreemptiveLoading(bool preemptive)
sets whether scheduler should guess next needed items
virtual bool swapIn(managedMemoryChunk &chunk)
cyclic implementation of swapIn, see paper
virtual void untouch(managedMemoryChunk &chunk)
tries to regulate immediately usable free memory in ram to a level optimal for preemptive loading ...
bool checkCycle()
checks whether the scheduler believes to be sane and prints an error message if not ...
struct cyclicManagedMemory::chain filterChain(chain &toFilter, const memoryStatus *separateStatus, bool *preemptiveLoaded=NULL)
: separates all chunks matching state in list separateStatus or preeemptiveLoaded from the ring ...
static pthread_mutex_t cyclicTopoLock
virtual swapErrorCode swapOut(global_bytesize min_size)
cyclic implementation of swapOut, see paper
void printBacklog() const
unsigned int consecutivePreemptiveTransactions
void decay(global_bytesize bytes)
: Tries to unload around bytes bytes of preemptive elements
unsigned int preemptiveSinceLast
cyclicAtime * prev
Next chunk in cycle.
virtual void schedulerDelete(managedMemoryChunk &chunk)
signals deletion of chunk to scheduler code
manages all managed Chunks of raw memory
cyclicAtime * preemptiveStart
double preemptiveTurnoffFraction
bool setPreemptiveUnloading(bool preemptive)
sets whether scheduler should swap out elements without strict need
scheduler working with a double linked cycle. Details see paper.
void printCycle() const
prints out all elements known to the scheduler with their respective status
static const unsigned int backlog_size
virtual bool touch(managedMemoryChunk &chunk)
marks chunk as recently active as a hint for scheduling
swapErrorCode
Error codes for swapOut requests.
managedMemoryChunk * chunk
backlog_entry backlog[backlog_size]
cyclicAtime * counterActive
Backend class to handle raw memory and interaction/storage with managedSwap.
cyclicManagedMemory(rambrain::managedSwap *swap, rambrain::global_bytesize size)