A computer system consists of a central processing unit (CPU) that controls input and output devices and performs arithmetic and logical operations. The CPU contains a control unit that directs the flow of data and an arithmetic logical unit that performs calculations. Memory in a computer system includes both primary memory like ROM and RAM that is directly accessible by the CPU, as well as secondary memory like hard disks, pen drives, CDs, and DVDs for long-term storage.