ROM stores permanent instructions for starting up a computer system, while RAM is used as temporary memory for active programs and data. RAM is volatile and loses data when powered off, while ROM is non-volatile. Virtual memory allows a computer to temporarily store data from RAM onto disk storage when physical memory is low, making more memory available to programs than is physically installed. Cache memory holds recently used data from RAM and main memory to improve CPU performance. Flash memory is non-volatile like ROM but can be rewritten electrically like RAM.