swap partition?

What does a swap partition do exactly? I was messing arround with a linux machine at my school and i deleted the swap partition using fdisk and then rebooted the machine and it worked fine and wrote a swap partition back in...lol. Is it a nessary part of the OS to use that partition?

I believe linux will use some space in / for swap if you delete the swap partition but I haven't tried it. Basically swap can be thought of as extra RAM, but on disk. Lets say you have 1 GB of RAM but you are running a database that needs 2 GB of RAM. You can use 1 GB of actual RAM and 1 GB of SWAP. Without going into to much of a discussion on swap space, typically you want to avoid using your swap space because it is a huge performance degradation to your system. Think of how fast RAM is compared to disk. If you are basically using a disk in place of RAM your system is going to run much slower.

When you use swap, the memory chunks (called pages) that are not in use are written to disk. When the application needs them again they are read from disk back to RAM and other pages are written to the disk if more RAM space is needed.

I hope that makes sense.

so basicly swap is like virtual memory? I gotcha, when i installed Linux on my system i screwed everything up with my partition so i'm trying to fix everything up now and understand it all haha.

You will also experience performances issues without swap partition or whit an unappropriate size.
Normally twice or 2 1/2 times the size of physical memory is a good formula for any use.

Depends on your hardware and what kind of job you are going to apply on it. For home user, P4, 1024MB Ram, you don't have to have a swap partition. That's what I do on my P3 933Mhz and 1024MB Ram; however, I do have a swap partition for the system on my notebook ( 700Mhz, 512 MB).

ok, haha i've got a celeron 400 with 256 pc 100 ram so i'll let your minds run wild with the possibilities i can use it for...lol some of my favs are paperweight and heater.

swap is for multi-user environment, when there's context switch, data are swap out

I think of Swap with some questions:
a)Will you run a lot of apps?
b)Will you run some apps for a BIG time?(server like time)
c)Will you run a lot of apps for a BIG time?

If any of this questions have a yes for answer, then you do need swap. But watchout, while it goes something like "virtual memory", having a lot of swap will only slow your system, and eat your space. The formula of swap needing space(swap=2*ram), works fine, but there's a limit, there is no point in having more then 1GB of swap space, since it will take forever to find the needed information in 1GB space. If you have an old system(like one with an HD of 5200 RPM), I would sugest not going past the 512MB os swap, and if you have an even older system(let's say a P133), I would sugest not using swap at all, or if you are gona use it, do not pass the mark of 128MB for swap.

And just to getting thigs right(correct me if I'm wrong):
The diference of Virtual memory, and swap partition, is that a swap partition is a predetermined space on the hd formated to do ONLY swap, while a Virtual memory will pick a part of the HD that you can use, formated with for exemple FAT32, FAT16, NTFS or whatever, and thus running much much more slower.