특정 프로그램에 대한 RAM 메모리 캐싱 비활성화

특정 프로그램에 대한 RAM 메모리 캐싱 비활성화

저는 C로 만든 바이너리를 사용하여 몇 가지 벤치마크 테스트를 실행하고 있습니다. 어쨌든 커널에 이러한 바이너리 프로그램의 어떤 부분도 캐시하지 않도록 요청할 수 있습니까?

답변1

"drop_caches"에 대한 커널 문서를 살펴보십시오.

https://www.kernel.org/doc/Documentation/sysctl/vm.txt

다음은 작은 섹션입니다.

Writing to this will cause the kernel to drop clean caches, as well as
reclaimable slab objects like dentries and inodes.  Once dropped, their
memory becomes free.

To free pagecache:
    echo 1 > /proc/sys/vm/drop_caches
To free reclaimable slab objects (includes dentries and inodes):
    echo 2 > /proc/sys/vm/drop_caches
To free slab objects and pagecache:
    echo 3 > /proc/sys/vm/drop_caches

This is a non-destructive operation and will not free any dirty objects.
To increase the number of objects freed by this operation, the user may run
`sync' prior to writing to /proc/sys/vm/drop_caches.  This will minimize the
number of dirty objects on the system and create more candidates to be
dropped.

관련 정보