The FIFO queue (or stack) is implemented on disk, not ram (preferably in C ++)

Basically, what I need is equivalent to the queue of the standard template library, implemented in such a way as to use the disk for storage. The amount of data that must be in the queue is much larger than can be stored in RAM on most computers today.

Ideally, I use a library. However, any recommendation on how to implement this queue will be helpful.

+6
c ++ c queue disk
source share
5 answers

You can watch STXXL :

"The STXXL core is an implementation of the standard C ++ STL template library for external computing (non-corporate), that is, STXXL implements containers and algorithms that can handle huge amounts of data that are only suitable for disks."

+9
source share

You might want to check out the STLXX library. It contains a priority queue on disk using the Sequence Heap model described by Peter Sanders.

+2
source share

Wild idea: Deploy a dispenser class that reads / writes to and from a file on disk and passes it to STL deque or queue or whatever suits you.

+1
source share

Tell us about the data. Is each element large or small? Is it fixed or variable? The problem with disk storage is that as the elements become more diverse in size, the more the problem begins to resemble a database problem. In this case, you should probably look at something like a sqllite database as a backup storage in your queue. Then you can simply use SQL to pull the first record.

If the data is really big, you can simply save each object in the file system using file name increment. Then you do not even need to store the queue in memory. The file date will become your FIFO order. Just grab the oldest file in the directory to pull the first item from the stack.

Finally, if the data is small and plentiful, you can consider overriding Allocator for std :: list or std :: deque. Perhaps you can hide the IO file in the Allocator class. I do not have a simple solution for a small and numerous instance of data.

0
source share

this is how the creator of the queue handler will, of course, have constructors for the code

 if(p[i].printerq.size()>0) { temp_int=p[i].printerq.back().getPid(); counter=0; cout<<"Ready to continue?"<<endl; system("pause"); system("cls"); cout<<"Printer "<<i+1<<endl<<endl; do { if(counter==3) { cout<<"Ready to continue?"<<endl; system("pause"); system("cls"); counter=0; } cout<<p[i].printerq.front(); p[i].printerq.push(p[i].printerq.front()); p[i].printerq.pop(); ++counter; }while(temp_int!=p[i].printerq.front().getPid()); if(p[i].printerq.size()>1) { cout<<p[i].printerq.front(); p[i].printerq.push(p[i].printerq.front()); p[i].printerq.pop(); } } else { cout<<"Printer "<<i+1<<" is empty."<<endl; } 
0
source share

All Articles