How a CPU works?
CPU is a central processing unit and it's an essential part of computer where is information is processed. Modern CPUs generally have multiple cores and each core has clock which ticking each time CPU's core does some operation. Frequency of clock is commonly referred as processing speed and measured in hertz. As nowadays we have fast computers we generally use Gigahertz (GHz).
Main part of processor is called "Control Unit" which talks to memory (RAM), ALU (Arithmetic Logic Unit), also outputs to devices through motherboard. Control Unit has bus that sends data to memory which gets instructions from memory, then saves them to registers to perform operations on ALU later. Also there are 2 wires from CPU to memory called "enable" and "set". Enable is used when we want retrieve information, set is used to update data in RAM.
Control Unit talks to ALU similar with "enable" and "set" wires also, 2 input and 1 output registers. If operation is comparing ALU saves result in flags for Control Unit to decide what to with it when next instruction comes from RAM. Also there is many other registers in Control Unit to save information temporarily when talking to ALU and RAM. More important ones are: Instructions register, memory adress register and program counter ( also called instuction address counter).
Each time program looks for program counter register for next instruction address, then it send address to memory address register - in case of instruction it send it to RAM after "enable" wire is on. it will get data to data bus and in turn it is saved in Instructions register which tells Control Unit what to do next.
Also there is many CPU architectures, as of today mainly used ones are 32bit and 64bit. More bits mean more can be sent and read from RAM in a single tick. 64bits CPU needs wider bus and registers, but they operate faster because can process more data at once.