문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top