Program execution in a computer

Tags:
CPU
RAM
I just want to ask that when a program becomes process in RAM, then how does the CPU address the process? As the CPU scheduler brings the process to CPU, how does the CPU come to know which process to execute? And where is the waiting queue made and who loads the program from hard disk to memory?

Answer Wiki

Thanks. We'll let you know when a new response is added.

An instruction cycle (sometimes called fetch-decode-execute cycle) is the basic operation cycle of a computer. It is the process by which a computer retrieves a program instruction from its memory, determines what actions the instruction requires, and carries out those actions. This cycle is repeated continuously by the central processing unit.

Each computer’s CPU can have different cycles based on different instruction sets, but will be similar to the following cycle:

  1. Fetching the instruction: The next instruction is fetched from the memory address that is currently stored in the program counter (PC), and stored in the instruction register (IR). At the end of the fetch operation, the PC points to the next instruction that will be read at the next cycle.
  2. Decode the instruction: During this cycle the encoded instruction present in the IR is interpreted by the decoder.
  3. Read the effective address: In case of a memory instruction (direct or indirect) the execution phase will be in the next clock pulse. If the instruction has an indirect address, the effective address is read from main memory, and any required data is fetched from main memory to be processed and then placed into data registers (Clock Pulse: T3). If the instruction is direct, nothing is done at this clock pulse. If this is an I/O instruction or a Register instruction, the operation is performed (executed) at clock Pulse.
  4. Execute the instruction: The control unit of the CPU passes the decoded information as a sequence of control signals to the relevant function units of the CPU to perform the actions required by the instruction such as reading values from registers, passing them to the ALU to perform mathematical or logic functions on them, and writing the result back to a register. If the ALU is involved, it sends a condition signal back to the CU. The result generated by the operation is stored in the main memory, or sent to an output device. Based on the condition of any feedback from the ALU, Program Counter may be updated to a different address from which the next instruction will be fetched.

The cycle is then repeated.

Discuss This Question: 4  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • Subhendu Sen
    Assuming this is a home work based query, you can link here for more info: http://homepage.cs.uri.edu/book/cpu_memory/cpu_memory.htm
    49,420 pointsBadges:
    report
  • Harisheldon

    If you read the section on RAM memory, it should give you the basic scenario of how data travels from point A to point B.

    Now, if you would have given us an attempt of an answer, then we could have told you if you were going in the right direction or not.

    11,745 pointsBadges:
    report
  • ToddN2000
    This sounds like a technical homework questions on the physical function of a computer. Is there a business need for such knowledge?
    45,660 pointsBadges:
    report
  • Harisheldon
    If you read the section on the topic in which you sent the question for, you would have been able to come up with the answer yourself. The Internet was not always here, students read the textbooks to learn the process of things.
    11,745 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: