What is SWAP partition and why it is there?

Swap is what I like to think as a “separate Ram memory”, located on disk instead. If the Ram runs out of memory, then SWAP space is used. Linux separates physical RAM into chunks called pages. It is there to support the main memory when one runs out of it.