I have a problem writing and saving files in ubuntu 20.04 LTS. I am making a program in C++ where data is saved in int16 at a rate of 200MS/s. The intention is to have 8 threads that create a file where to save this data, having at the end a total of 8 files with their corresponding data at 200MS/s.
The program works correctly but there comes a point where the system starts to lose data. When monitoring what was happening, I observed that the problem came when the RAM cache was filling up. After releasing the cache the program would start working again until it was full again. This process took about 1 minute to occur.
I need my program to be saving data continuously without losing data in between. How can I solve this?
I have tried to free the cache memory in the middle of the program, but this resulted in crashing the system. I guess because I kept writing data to the other threads.