In the last post we talked about computer memory and there was that weird line in the free command results called swap. I also promised to talk about it this week.
So there you are in Math class one day and your teacher writes the most complex equation on the board you’ve ever seen and says ‘SOLVE IT!’. What do you do? Well, you pull out a piece of paper and get to work.
swap is kind of like that piece of paper. The computer wants to do all its thinking in the memory it has installed for that, but sometimes that doesn’t work. So instead of pulling out a piece of paper and doing work on that, it uses swap. It would be more fun if your computer could stop what its doing and pull out paper, but it wouldn’t work as well.
So what exactly is swap anyway? Well, when you set up your system, you designate a part of your hard drive to be the swap space. This means that the computer is using its remembering memory for thinking memory. Sounds weird, but it works. You remember when you think sometimes, right? You remember how to do the math problem while you’re thinking about the math problem. Or you’re thinking about how Iron Man would solve it rather than actually solving it, but hey, whatever keeps the math teacher happy!
So let’s look at the result of that free command again:
Alpha:~ computerlamp$ free -g total used free shared buffers cached Mem: 31 29 1 0 0 12 -/+ buffers/cache: 17 13 Swap: 2 2 0
According to this, I have 2 gigabytes of swap to use and I’ve used both of them. In other words, I’ve used up all the paper I had free to do my work on and there’s no more available. Not exactly the best spot to be in, but I’m sure I can borrow some from the guy next to me… except that doesn’t really work with computers. But your administrator can add swap if she decides she needs it.