memory-managementcpu-registersinstruction-setprocessing-instruction

What does RAM actually stores,adress of the instructions or instruction itself in the form of 0s and 1s?


How does actually the instruction is executed,does the instructions is stored in the ram or only the adress of that instruction is stored in the ram And then using that instruction CPU gets the full instruction data to be executed


Solution

  • The 1's and 0's of the instruction are stored in RAM. It's possible the address is also ram somewhere, but I don't know of a CPU that takes care of the indirection in hardware. Instead, you'll see a load or a jump using the address to guide execution.

    It's very common to see an address used as the target of a jump. In older OSes, special registers called segment registers were used to reference different blocks of memory. One of those registers was the Code Segment register which essentially held an address to instruction code.

    This is pretty heavy reading, but it explains how an instruction is executed: https://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Overall/steps.html

    This can help if you like diagrams: https://www.youtube.com/watch?v=42KTvGYQYnA