Very general question.
Mining Bitcoin isn’t done on either CPU or GPU’s. It’s done on ASIC (Application-specific integrated circuit) which as it sounds are designed to do one thing and one thing only. ASIC chips used in mining are designed to has SHA-256 which is Bitcoins proof of work algorithm. They can also be used for other coins that use SHA-256 as their proof of work. But that’s all they can do.
There are actual uses for ASIC chips in the world other than mining. DES, a fundamentally flawed encryption method though still used today is often used as triple DES on ASIC compute units in companies that encrypt and decrypt terabytes of data. There are also such compute units for AES-128 and AES-256. There are valid uses for the technology which is a hidden benefit of bitcoin mining and the ever need to get faster ASIC units.
Why people mine alts on GPU’s rather than CPU’s though?
CPU’s or Central Processing Units are designed for general processing. Whether it’s X86, X86-64, ARM or whatever, they are designed to be able to do a lot. They are like a Swiss army knife. They can play games, they and communicate with lots of different devices and they can do an ok job of it. Increase the cores, they can do more stuff at the same time. The great thing about CPU’s is they can process complex algorithm’s. But SHA-256 isn’t complex. It’s just a series of basic operations.
Here is someone doing it by hand
But for the most part, Alt’s there isn’t enough ASIC chips hashing away to make mining impossible. But CPU’s are really slow at hashing compared to ASIC’s. GPU’s however are like programmable ASIC’s. They can complete simple tasks. But they can complete thousands of the same simple task at the same time. Modern GPU’s have thousands of cores. compared to CPU’s that on average have between 2 and 8 cores, there is no competition. To add to this, GPU’s are great at simple calculations compared to a CPU. It’s what GPU rendering is. Simple calculations. They can complete thousands of hashes a second because they have been 1. designed to complete basic algorithm’s as quickly as possible. 2. Have lots of cores to complete tasks at the same time.
But let’s compare.
Antminer S9 hash rate 14 TH/s (14,000,000,000,000 SHA-256 hashes a second)
GTX 1080 hash rate 2,865.2 MH/s (2,865,200,000 SHA-256 hashes a second)
Intel 3930K Hash rate 66.6 MH/s (66,600,000 SHA-256 hashes a second)
Now this is assuming Bitcoin. There are many more hashing algorithm’s used. Some designed to make ASIC chips hard or impossible to use and in that case, a GPU being programmable highly multi threaded computational unit, it makes the best choice.
This is all without touching on the computational limits of CPU’s and their limited cache along with their limited bandwidth to memory. Somewhere GPU’s shine with their high memory bandwidth.