Frage

How do I create a queue in c++ that will be allocated on a specific path?

I mounted ramfs on /mnt/ram/ which is a RAM folder rather than a disk , and would like the queue to be there, so the performance would be better than if the queue were allocated on the disk.

The queue is of the queue library of c++,that is:

#include <queue>
queue<string> requestsqueue;

Thanks

War es hilfreich?

Lösung

How do I create a queue in c++ that will be allocated on a specific path?

You can't.

The queue is of the queue library of c++,that is:

#include <queue>
queue<string> requestsqueue;

The standard queue datastructure, std::queue, exists only in memory. It has no particular relationship to any disk file, nor to any path in the file system.

Andere Tipps

You can create your file in /mnt/ram just like you would create your file anywhere else. The difference being the contents of ramfs are deleted when the system reboots.

You may also want to look into using tmpfs as its size can be limited so you don't use up all your memory and is backed by swap space so it can be paged out if it's not used for a while.

Here's a bit more info.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top