Sunday, October 21, 2018

How cpu works | How To Work CPU | Classic Computer


How To Work CPU?


How To Work CPU? We were focused on classic computing based on the CPU. Classic computing is essentially the digital computer, almost every computing device on the market today is a classic computer. How To Work CPU? 



Classic computers operate in serial, in other words, as mentioned in the first article in the series, Computing Origins, executing various instructions extremely fast in 'order', but to the average user, it appears to be running them in parallel, meaning multiple instructions at a time. How To Work CPU?  This is due to many hardware and software optimizations to allow for asynchronous operation. 









How to work CPU

By the end of this article the distinction between parallel and asynchronous operation will become clear, but first, let's see how the classic computer works. As a disclaimer, the concepts we will be discussing are an over generalization of computing architecture, but for the sake of getting an abstracted understanding of classic computing, functionality will serve well.


RAM and CPU combination:-



Alright so first let's bring in the central processing unit, the CPU is the brains of the computer. Let's also bring in memory, the RAM, this is where the CPU accesses stored information it needs. How To Work CPU? Now the CPU also has built-in memory, this is called the cache. The cache is considerably smaller than the RAM, with sizes ranging in the order of 32 kilobytes to 8 megabytes. 

The purpose of the cache is to give the CPU the information it needs immediately. The CPU and RAM are separate objects, so when the CPU needs information, it takes time, albeit a very small amount of time to read the data from the memory. This time can add considerable delay to computer operation. With the cache being right on the CPU reduces this time to almost nothing.

The reason why you don't need much cache storage is that it just needs to store little bits of important information that the CPU will need to use soon or has been using a lot of recently. How To WorkCPU? There are various methods implemented to determine what goes on to the cache, what should be kept on the cache and when it should be written back on to the RAM. How To Work CPU? In a typical CPU, there are various levels of cache, each with different read and write times and sizes, for the sake of simplicity we'll assume a single cache for our CPU. 

So now with the basic components out of the way, let's get into how the computer operates. When a CPU executes an instruction there are five basic steps that need to be completed:

(A)- Fetch:-


Get the instruction from the memory and store in the cache in some cases.

(B) Decode:-


Get the appropriate variables needed for the execution of the instruction.

(C) Execute:-


Compute the result of the instruction.

(D) Memory:-


For instructions that require a memory read/ write operation to be done.

(E) Write Back:-


Write the results of the instruction back into memory.

Nearly every instruction goes through the first three and final step, only certain instructions go through the memory steps such as load and stores but for the sake of simplicity, we'll assume every instruction requires all five steps. Now each step takes one clock cycle, this translates to a CPI, clock cycles per instruction, of five. As a note, most modern processors can execute billions of clock cycles per second, for example, a 3.4 gigahertz processor can execute 3.4 billion clock cycles per second. How To Work CPU? Now a CPI of 5 is very inefficient, meaning the resources of the CPU are wasted.

This is why pipelining was introduced, bringing the asynchronous operation into computing. How To Work CPU? Pipelining essentially makes it so each step can be executed in a different clock cycle, translating to 5 instructions per 5 clock cycles, or in other words, one instruction per clock cycle, a CPI of 1. Essentially what pipelining does is take the segmented steps of an instruction and execute them in each clock cycle, since the segmented steps are smaller than the size and less complex than a normal instruction, you can do the steps of other instructions in the same clock cycle.

For example, if a step for one instruction is fetching the data, you could begin decoding another, executing another, etc - since the hardware involved for those steps isn't being blocked. How To Work CPU? Superscalar pipelines add to this performance further. Think of pipelines as a highway, now typical lane in the highway can execute one instruction per clock cycle. With superscalar processors, you add more lanes to the highway, for example, a 2 wide super

5 Comments:

  1. Remarkable issues here. I am very satisfied to peer your
    article. Thanks a lot and I am looking forward to
    touch you. Will you kindly drop me a mail?

    ReplyDelete
  2. I have been surfing on-line more than three hours these days, but I by
    no means found any interesting article like yours.
    It's beautiful value sufficient for me. In my opinion, if all site owners and bloggers made
    good content material as you probably did, the web shall
    be much more useful than ever before.

    ReplyDelete
  3. you are really a just right webmaster. The web site loading pace is
    amazing. It sort of feels that you are doing any unique trick.
    Furthermore, The contents are masterpiece. you've performed a fantastic task
    in this matter!

    ReplyDelete
  4. I am in fact pleased to glance at this webpage posts which
    carries lots of valuable facts, thanks for providing these kinds
    of information.

    ReplyDelete
  5. Hi! Would you mind if I share your blog with my
    facebook group? There's a lot of people that I think would really
    appreciate your content. Please let me know. Cheers

    ReplyDelete