When a program aggressively allocates memory, buffers must be flushed back to disk, stuff may need to get moved into swap, etc. I/O bound stuff gets higher priority because... I don't know why... probably the throughput is greater that way, or perhaps it's more urgent. Not sure if there's a solution other than having enough RAM that you are never I/O bound. Perhaps if Linux wasn't so aggressive about caching, it would happen less, but things would be slower overall.