با عرض سلام و ادب، پس از این برخی پستها رو به زبان انگلیسی در وبلاگ
قرار خواهم داد. دو دلیل برای این کار وجود دارد. اول اینکه خیلی وقتها مطالب
خوبی پیدا میکنم ولی به دلیل کمبود وقت نمیرسم ترجمه کنم و باعث میشه اون مطلب رو
در سایت قرار ندهم و دوم اینکه ترجمه فارسی خیلی از متون بخاطر تخصصی بودن اونها
باعث ایجاد مشکل در درک کردن مفهوم مطلب میگردد
What is
tmpfs?
Tmpfs also
mounted as shared memory /dev/shm. tmpfs is portion of a virtual memory mounted
as a file system which helps to speed up applications. It normally being used
to transfer data between programs. It appears as a file system but it does not
use persistent device such as hard disk. Instead it uses virtual memory
(portion of a RAM).
Thats why if
you create any file in tmpfs its not created on your system disks but in your
memory. Whenever you un-mount tmpfs, everything within is lost. Its volatile
storage. Even if you add entry of tmpfs to re-mount at boot, it will be mounted
blank. Data does not persist over reboots or shutdowns in tmpfs.
What is SWAP?
swap is
portion of your hard disks used to extend RAM. Its roughly extended RAM by use
of persistent storage device. swap only comes in action once your RAM (physical
memory) is full. Normal thumb rule is size of swap should be double of your
physical ram size. But this changes depends on conditions and system you have.
Read how to create extra swap here & check swap on server.
Even if uses
persistent devices, it still is a volatile memory. It does not hold data over
reboot or shutdowns. Since it plays role of RAM, its characteristics are still
of ram even if uses hard disks.
Difference between tmpfs and swap
·
tmpfs uses memory while as swap uses
persistent storage devices.
·
tmpfs can be viewed as file system in df
output whereas swap dont
·
swap has general size recommendations,
tmpsfs not. tmpfs size varies on system purpose.
·
tmpfs makes applications fasters on loaded
systems. swap helps system breath in memory full situations.
·
swap full indicates system heavily loaded,
degraded performance and may crash. tmpfs being full not necessarily means
heavy load or prone to crash.
·
tmpfs is enhancement where as swap is must
have feature!
Reference:
https://kerneltalks.com/linux/difference-between-tmpfs-and-swap/