I am writing a C program in which I need to flush my memory. I would like know if there is any UNIX system command to flush the CPU cache.
This is a requirement for my project which involves calculating the time taken for my logic.
I have read about the cacheflush(char *s, int a, int b)
function but I am not sure as to whether it will be suitable and what to pass in the parameters.
I take it you mean "CPU cache", not memory cache
The link above is good: the suggestion "write a lot of data via CPU" is not Windows specific
Here's another variation on the same theme:
Here's an article about Linux and CPU cache:
NOTE:
At this (very, very low) level, "Linux" != "Unix"