Does sync command remove the dirty cache in the memory?
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I am aware that sync command flushes the dirty cache into disk. I have run free
command first, then sync
, and then free
again. The result of latter free
command shows more free memory available than the former one.
Does this mean that the dirty caches are removed from memory when performing sync
? Can anybody give me a more solid proof?
linux memory synchronization
add a comment |Â
up vote
2
down vote
favorite
I am aware that sync command flushes the dirty cache into disk. I have run free
command first, then sync
, and then free
again. The result of latter free
command shows more free memory available than the former one.
Does this mean that the dirty caches are removed from memory when performing sync
? Can anybody give me a more solid proof?
linux memory synchronization
Related: How do you empty the buffers and cache on a Linux system?
â slmâ¦
Aug 27 '13 at 6:54
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am aware that sync command flushes the dirty cache into disk. I have run free
command first, then sync
, and then free
again. The result of latter free
command shows more free memory available than the former one.
Does this mean that the dirty caches are removed from memory when performing sync
? Can anybody give me a more solid proof?
linux memory synchronization
I am aware that sync command flushes the dirty cache into disk. I have run free
command first, then sync
, and then free
again. The result of latter free
command shows more free memory available than the former one.
Does this mean that the dirty caches are removed from memory when performing sync
? Can anybody give me a more solid proof?
linux memory synchronization
linux memory synchronization
edited Aug 27 '13 at 4:24
Anthon
59.5k17100162
59.5k17100162
asked Aug 27 '13 at 3:51
Shasha.Zhu
112
112
Related: How do you empty the buffers and cache on a Linux system?
â slmâ¦
Aug 27 '13 at 6:54
add a comment |Â
Related: How do you empty the buffers and cache on a Linux system?
â slmâ¦
Aug 27 '13 at 6:54
Related: How do you empty the buffers and cache on a Linux system?
â slmâ¦
Aug 27 '13 at 6:54
Related: How do you empty the buffers and cache on a Linux system?
â slmâ¦
Aug 27 '13 at 6:54
add a comment |Â
3 Answers
3
active
oldest
votes
up vote
1
down vote
No, It don't. I checked it myself many times, but don't worry, Linux kernel takes care of your precious memory very smartly.
read Content cached in RAM while writing to disk - Linux
and http://linuxatemyram.com
add a comment |Â
up vote
0
down vote
This will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
Source: kernel.org/doc/Documentation/sysctl/vm.txt
â Smith John
Aug 27 '13 at 5:59
add a comment |Â
up vote
0
down vote
They are not :-). Here is solid proof:
$ dd if=/dev/zero of=test bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.409106 s, 256 MB/s
$ sync
$ time cat test > /dev/null
real 0m0.027s
user 0m0.000s
sys 0m0.026s
The data was still cached after sync
. You can tell it was cached by looking at the time to read the file. (I have a spinning hard drive, max read speed is around 100MB/s). Compare this to the combination of sync
and drop_caches
:
$ sync
$ echo 1 | sudo tee /proc/sys/vm/drop_caches
1
$ time cat test > /dev/null
real 0m1.030s
user 0m0.001s
sys 0m0.073s
add a comment |Â
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
No, It don't. I checked it myself many times, but don't worry, Linux kernel takes care of your precious memory very smartly.
read Content cached in RAM while writing to disk - Linux
and http://linuxatemyram.com
add a comment |Â
up vote
1
down vote
No, It don't. I checked it myself many times, but don't worry, Linux kernel takes care of your precious memory very smartly.
read Content cached in RAM while writing to disk - Linux
and http://linuxatemyram.com
add a comment |Â
up vote
1
down vote
up vote
1
down vote
No, It don't. I checked it myself many times, but don't worry, Linux kernel takes care of your precious memory very smartly.
read Content cached in RAM while writing to disk - Linux
and http://linuxatemyram.com
No, It don't. I checked it myself many times, but don't worry, Linux kernel takes care of your precious memory very smartly.
read Content cached in RAM while writing to disk - Linux
and http://linuxatemyram.com
edited Apr 13 '17 at 12:36
Communityâ¦
1
1
answered Jun 22 '15 at 6:06
Arnab
743619
743619
add a comment |Â
add a comment |Â
up vote
0
down vote
This will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
Source: kernel.org/doc/Documentation/sysctl/vm.txt
â Smith John
Aug 27 '13 at 5:59
add a comment |Â
up vote
0
down vote
This will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
Source: kernel.org/doc/Documentation/sysctl/vm.txt
â Smith John
Aug 27 '13 at 5:59
add a comment |Â
up vote
0
down vote
up vote
0
down vote
This will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
This will cause the kernel to drop clean caches, dentries and inodes from memory, causing that memory to become free.
To free pagecache:
echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes:
echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
echo 3 > /proc/sys/vm/drop_caches
As this is a non-destructive operation, and dirty objects are not freeable, the user should run "sync" first in order to make sure all cached objects are freed.
answered Aug 27 '13 at 5:50
Gopal Singh Dagur
1
1
Source: kernel.org/doc/Documentation/sysctl/vm.txt
â Smith John
Aug 27 '13 at 5:59
add a comment |Â
Source: kernel.org/doc/Documentation/sysctl/vm.txt
â Smith John
Aug 27 '13 at 5:59
Source: kernel.org/doc/Documentation/sysctl/vm.txt
â Smith John
Aug 27 '13 at 5:59
Source: kernel.org/doc/Documentation/sysctl/vm.txt
â Smith John
Aug 27 '13 at 5:59
add a comment |Â
up vote
0
down vote
They are not :-). Here is solid proof:
$ dd if=/dev/zero of=test bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.409106 s, 256 MB/s
$ sync
$ time cat test > /dev/null
real 0m0.027s
user 0m0.000s
sys 0m0.026s
The data was still cached after sync
. You can tell it was cached by looking at the time to read the file. (I have a spinning hard drive, max read speed is around 100MB/s). Compare this to the combination of sync
and drop_caches
:
$ sync
$ echo 1 | sudo tee /proc/sys/vm/drop_caches
1
$ time cat test > /dev/null
real 0m1.030s
user 0m0.001s
sys 0m0.073s
add a comment |Â
up vote
0
down vote
They are not :-). Here is solid proof:
$ dd if=/dev/zero of=test bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.409106 s, 256 MB/s
$ sync
$ time cat test > /dev/null
real 0m0.027s
user 0m0.000s
sys 0m0.026s
The data was still cached after sync
. You can tell it was cached by looking at the time to read the file. (I have a spinning hard drive, max read speed is around 100MB/s). Compare this to the combination of sync
and drop_caches
:
$ sync
$ echo 1 | sudo tee /proc/sys/vm/drop_caches
1
$ time cat test > /dev/null
real 0m1.030s
user 0m0.001s
sys 0m0.073s
add a comment |Â
up vote
0
down vote
up vote
0
down vote
They are not :-). Here is solid proof:
$ dd if=/dev/zero of=test bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.409106 s, 256 MB/s
$ sync
$ time cat test > /dev/null
real 0m0.027s
user 0m0.000s
sys 0m0.026s
The data was still cached after sync
. You can tell it was cached by looking at the time to read the file. (I have a spinning hard drive, max read speed is around 100MB/s). Compare this to the combination of sync
and drop_caches
:
$ sync
$ echo 1 | sudo tee /proc/sys/vm/drop_caches
1
$ time cat test > /dev/null
real 0m1.030s
user 0m0.001s
sys 0m0.073s
They are not :-). Here is solid proof:
$ dd if=/dev/zero of=test bs=1M count=100
100+0 records in
100+0 records out
104857600 bytes (105 MB, 100 MiB) copied, 0.409106 s, 256 MB/s
$ sync
$ time cat test > /dev/null
real 0m0.027s
user 0m0.000s
sys 0m0.026s
The data was still cached after sync
. You can tell it was cached by looking at the time to read the file. (I have a spinning hard drive, max read speed is around 100MB/s). Compare this to the combination of sync
and drop_caches
:
$ sync
$ echo 1 | sudo tee /proc/sys/vm/drop_caches
1
$ time cat test > /dev/null
real 0m1.030s
user 0m0.001s
sys 0m0.073s
answered 6 mins ago
sourcejedi
21.4k43395
21.4k43395
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f88314%2fdoes-sync-command-remove-the-dirty-cache-in-the-memory%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Related: How do you empty the buffers and cache on a Linux system?
â slmâ¦
Aug 27 '13 at 6:54