The reason behind it is that if you club all the above memory locations, the total size will be between 1.5 times to 2 times the RAM. This is the reason behind the thumb rule to create swap size 2 times the RAM
It has a meaning and for that we should know memory hierarchy. We have different levels of memory which is useful for processing your data. They are as follows.
Processor/CPU registers(Bits in size)
L1 Cache(kbs in size)
L2 Cache(MBs in size)
L3 cache(100s of MBs in size)
RAM(GB’s in size)
suppose take one application which is in running state. The application data is moved to RAM for faster accessing and some of its data is moved to L3 cache for processing frequently used data and we move more frequently used app data to L2 and then L1. And we move data which is right now processed by your processor/CPU to registers which is present in processor. If you observe the memory size will gradually decrease when you go up in the ladder more frequently used data is kept at higher levels and made it self available for processing. So if suppose you want to load a bigger program which can consume all the ram/L3/L2/L1 cache its better to move already running process to some location which we can access later to process it once again. But moving this data to HDD is not preferred as it is bit slow and other solution is to increase the RAM size which bit cost. So people came with a solution called SWAP partition which can solve both these limitations.
We create swap partition to cache all the data in registers, L1, L2, L3 caches and RAM.