Presentation is loading. Please wait.

Presentation is loading. Please wait.

Survey of Program Compilation and Execution Bangor High School Ali Shareef 2/28/06.

Similar presentations


Presentation on theme: "Survey of Program Compilation and Execution Bangor High School Ali Shareef 2/28/06."— Presentation transcript:

1 Survey of Program Compilation and Execution Bangor High School Ali Shareef 2/28/06

2 Main Components of a Computer External Devices Processor Memory

3 Memory  Temporary holding area where instructions are stored while they are waiting to be executed.  Data and intermediate values are also stored in memory.  Memory is Volatile  When the power is shut off, everything in memory is lost

4 Processor Executes Instruction Pentium 4 is a 32 bit processor Processors can process a 32 digit “bit” number at a time. Processor executes instructions one at a time, (technically). Instructions are represented as binary numbers.

5 Processor Registers Fast memory within the processor where data is stored while an instruction is being executed.

6 Processor Pentium 4 processor uses a 2.3 MHz clock. Clock oscillates at 2,300,000 cycles/sec Most instructions take about 5 cycles 2,300,000/5 ~ 460,000 instructions are executed per second Even though a processor is executing one instruction at a time, user interaction is very smooth.

7 Execution Process 1) Program is loaded into memory from external storage (hard drive, floppy disk.) 2) Processor executes instructions from memory

8 Execution Can the processor understand C code? Can it execute C code?

9 Compilation The processor cannot understand most high level languages such as C. Need to translate C code to assembly code. Assembly code corresponds to actual numeric values for the instructions that the processor can understand. A compiler is used to translate code written in C to assembly code, so that the processor can understand it.

10 Demo Compile program in Visual Studio and see the assembly code.

11 Comparison  Is it better to program in a high level language like C?  Or assembly code?

12 Comparison Pros : High Level language Easy to use, Easy to debug, Quickly develop programs Cons : Depend on compiler to produce code May not be efficient

13 Comparison Pros : Assembly Code Can write very efficient, optimal code Can utilize the full functionalities of the processor Cons : Hard to write code, hard to debug Requires knowledge of the architecture of the processor that you are using

14 Conclusion Main Components of a Computer Processor, Memory, External devices Memory Temporary holding area for instructions Processor Executes instructions

15 Conclusion Program Execution Load instructions to memory Processor executes instructions Compilation Compiler translates high level language to assembly

16 Conclusion High level language or Assembly use depends upon application


Download ppt "Survey of Program Compilation and Execution Bangor High School Ali Shareef 2/28/06."

Similar presentations


Ads by Google