5

I'm currently reading about how the computer works, specifically how the CPU, RAM, hard disk drive work together simultaneously.

According to what I have read, the CPU uses what is called a control unit to get the data from RAM. And then processes the data.

But before the CPU can get data from RAM, the data must be loaded from the Hard Drive to RAM since access to RAM is faster than access to the Hard Drive.

My question is: Can the CPU get data directly from the Hard drive?

How does the Hard disk drive transfer data or load the data to RAM? Just as the CPU to RAM using control unit?

I have read a little about I/O disk. Has I/O disk something to do with this?

7

Can the CPU get data directly from the Hard drive?

No. The CPU (or more correctly, the software running on the CPU) initiates a transfer from the hard disk (by issuing for example a SATA READ DMA command) to a specified location in RAM, and is (asynchronously) later signalled when the transfer is complete.

As Wikipedia explains DMA, direct memory access (DMA) is a feature of computerized systems that allows certain hardware subsystems to access main system memory independently of the central processing unit (CPU).

For the purposes of storing significant amounts of data, the CPU works with its caches and system RAM. It does not access peripherals like a hard disk directly.

How does the Hard disk drive transfer data or load the data to RAM?

As said above, by issuing a request to the hard disk to transfer a specific sector, or range of sectors, from the hard disk into RAM, virtually always these days using DMA. Modern storage devices use LBA addressing, but that is primarily an implementation detail.

By using DMA, the CPU is free to take care of other tasks while the transfer is running, dramatically increasing overall system performance and responsiveness.

In all of this, the CPU is only running whatever code is fed to it from RAM.

Not the answer you're looking for? Browse other questions tagged or ask your own question.