INFLUENCES ON LANGUAGE DESIGN-COMPUTER ARCHITECTURE

Computer Architecture:

  • The basic architecture of computers has had a profound effect on language design.
  • Most of the popular languages of the past 50 years have been designed around the prevalent computer architecture, called the von Neumann architecture, after one of its originators, John von Neumann.
  • These languages are called imperative languages.
  • In a von Neumann computer, both data and programs are stored in the same memory.
  • The central processing unit (CPU), which executes instructions, is separate from the memory.
  • Instructions and data must be transmitted, or piped, from memory to the CPU.
  • Results of operations in the CPU must be moved back to memory.
  • Nearly all digital computers built since the 1940s have been based on the von Neumann architecture.
  • The overall structure of a von Neumann computer is shown in Figure.
  • Because of the von Neumann architecture, the central features of imperative languages are variables, which model the memory cells; assignment statements, which are based on the piping operation; and the iterative form of repetition, which is the most efficient way to implement repetition on this architecture.
  • Operands in expressions are piped from memory to the CPU, and the result of evaluating the expression is piped back to the memory cell represented by the left side of the assignment.
  • Iteration is fast on von Neumann computers because instructions are stored in adjacent cells of memory and repeating the execution of a section of code requires only a branch instruction.
  • The execution of a machine code program on a von Neumann architecture computer occurs in a process called the fetch-execute cycle.
  • Each instruction to be executed must be moved from memory to the processor.
  • The address of the next instruction to be executed is maintained in a register called the program counter.
  • The fetch-execute cycle can be simply described by the following algorithm: 
                initialize the program counter
                repeat forever
                    fetch the instruction pointed to by the program counter
                    increment the program counter to point at the next instruction
                    decode the instruction
                    execute the instruction
                end repeat
  • The “decode the instruction” step in the algorithm means the instruction is examined to determine what action it specifies.
  • Program execution terminates when a stop instruction is encountered, although on an actual computer a stop instruction is rarely executed.
  • Control transfers from the operating system to a user program for its execution and then back to the operating system when the user program execution is complete.
  • Programming can be done in a functional language without the kind of variables that are used in imperative languages, without assignment statements, and without iteration.

Comments