A CPU (Central Processing Unit) and a GPU work together to perform the various tasks required by a computer. The CPU handles most of the general-purpose computing and system tasks, while the GPU takes care of graphics-related tasks and other computations that can be performed in parallel.