A brief analysis into the CPU bus
Take a look inside a computer and you will see these electrical wires connecting various components in the computer. These things are what we call buses (singular: bus). The basic job of a computer bus is to carry data between the various components/chips of the computer (e.g. from the CPU to memory). Buses can be categorized into three groups: address buses, data buses, and control buses. The bus that connects directly to the CPU is called the system bus (otherwise known as the processor or CPU bus).
I/O and memory access
Let's analyse this scenario: the CPU wants to send some data to an output device, like a printer. In this case, the CPU will put the address of the printer on address bus, and put the data to send on the data bus. The same way, if the CPU wants to write some data into memory, it will put the address of the memory location onto the address bus, and the data to write onto the data bus. But how do the chips know if the current operation is an I/O-port operation or memory access? That's when the control bus steps in.
The control bus carries control signals to and from the CPU. Some of these control signals are INTA (Interrupt Acknowledge), IOR* (I/O Read), IOW* (I/O Write), MEMR* (Memory Read), MEMW* (Memory Write), and ALE (Address Latch Enable). The "*" appended to some of the control signals indicate that they are "low active" (whatever that means is demonstrated in action in the following paragraph). By the way, the ALE control signal is used to let the system know that the address bus contains a valid memory address.
Let's consider a case where the CPU would like to read some data from memory. The CPU would have to put the memory address to read from onto the address bus and then pulse a MEMR* low signal (which tells the memory chips that, they are supposed to send the contents of the memory address on the address bus to the CPU). The memory chips respond by putting the required data on the data bus and then flips the MEMR* low signal to MEMR* high. (Suppose the control signal was MEMW* low, the memory would rather read from the data bus rather than writing onto it.) The operation is completed by the CPU reading whatever is on the data bus. This whole process describes what is called a machine cycle (otherwise known as a CPU cycle).
Now, how would the CPU accomplish a process of writing to a printer? It's simple. It just have to put the appropriate address of the printer onto the address bus, put the data to write onto the data bus, and pulse the IOW* low signal (note the difference; since we want to write to a peripheral, the control signal should be IOW* low instead of MEMW* low, which is for memory write operations only). Note that, the above operation is typical of an Intel x86 processor, since some CPUs (e.g. the 6800 family) do not distinguish between memory and I/O operations.
OK, that will be all for today about the CPU bus and PC hardware in general.