Computer Structure Flashcards
(36 cards)
Explain what a translator does.
A translator converts the high level program (source code) e.g python into binary (machine code).
Name the 2 diffrent types of translators
Interpreters and Compilers
Describe how an interpreter works
Interpreters translate the code line by line, if it find a error in the program it will stop running
Describe how a complier works
A compiler translates all of your high level code (source code) into machine code all at once
What is the advantage of using an interpreter
Errors are flagged after each line has been interpreted making debugging easier
What are the disadvantages of using an interpreter
Can be slow to run code as the processor needs to run the translator software and the interpreted code
You will always need the interpreter to run the code, which may not be good for software you wish to distribute.
Anyone can see (and copy!) your source code.
What are the advantages of using a complier
A program will run without needing translated any more which is good for distributing software.
A program will run much more quickly as the processor is not needing to translate the code any more.
Compiled code is difficult to reverse-engineer, so your competitors cannot just copy your source code!
What are the disadvantages of using a compiler
Debugging can be complex as errors are not reported immediately.
You will need to re-compile your code every time an error is found and corrected. This may take time with a long program.
Which type of translator is better for debugging/troubleshooting code
Interpreter
Which type of translator should be used prior to the release a program for sale
Complier
Give 2 reasons why it is benifical to compile program before release
Translator does not need to be
present to run the code
The program runs/executes faster as
it does not require further
translation
The compiled version of the program
requires less memory (RAM) to run.
It is difficult to reverse engineer the program
Name the 3 areas of the processor:
Arithmetic and Logic Unit;
Control unit;
Registers.
Describe the role of the Arithmetic and Logic Unit (ALU)
All calculations and logical decisions are handled by the ALU.
It performs all calculations
It performs comparisons on numeric values
It makes decisions based on logic (AND, OR, NOT)
Describe the role of the Control Unit (CU)
The control unit is responsible for coordinating all the activities happening in the computer that require some of the processors time. This includes:
- fetching instructions and data from the main memory;
- decoding instructions (sending them to the correct part of the processor);
- executing instructions;
- the clock signal to keep actions in time with each other;
- responding to peripherals sending/receiving data.
Which part of the processor performs all calculations
It performs comparisons on numeric values
It makes decisions based on logic (AND, OR, NOT)
Arithmetic and Logic Unit (ALU)
Which part of the processor performs comparisons on numeric values
Arithmetic and Logic Unit (ALU)
Which part of the processor makes decisions based on logic (AND, OR, NOT)
Arithmetic and Logic Unit (ALU)
Which part of the processor is responsible for fetching instructions and data from the main memory;
Control Unit (CU)
Which part of the processor is responsible for decoding instructions (sending them to the correct part of the processor);
Control Unit (CU)
Which part of the processor is responsible for executing instructions
Control Unit (CU)
Which part of the processor is responsible for f the clock signal to keep actions in time with each other
Control Unit (CU)
Which part of the processor is responsible for responding to peripherals sending/receiving data.
Control Unit (CU)
Describe the registers
Registers are fast temporary storage locations on the processor, they store data, intructions or addresses being used by the CPU