Computer Structure - UC3Mocw.uc3m.es/ingenieria-informatica/computer-structure/objetives.pdf ·...
Transcript of Computer Structure - UC3Mocw.uc3m.es/ingenieria-informatica/computer-structure/objetives.pdf ·...
Computer Structure
Course Objectives
Grupo de Arquitectura de Computadores, Comunicaciones y SistemasDepartamento de Informática
UNIVERSIDAD CARLOS III DE MADRID
Course Objectives
Course objectives
� The main goal of the course is to describe the main components of a computer, and the basic behavior of computers
¿ ?
2Computer StructureARCOS
Understanding how a program is executed
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
High Level Language (C)
3Computer StructureARCOS
Understanding how a program is executed
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
High Level Language(C)
0000 1001 1100 0110 1010 1111 0101 10001010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111
Machine instructions
4Computer StructureARCOS
Understanding how a program is executed
lw $t0, 0($2)
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp;
High Level Language(C)
lw $t0, 0($2)lw $t1, 4($2)sw $t1, 0($2)sw $t0, 4($2)
0000 1001 1100 0110 1010 1111 0101 10001010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111
Assembly language
Machine instructions
5Computer StructureARCOS
Understanding how a program is executed
lw $t0, 0($2)
temp = v[k];
v[k] = v[k+1];
v[k+1] = temp; Compiler
lw $t0, 0($2)lw $t1, 4($2)sw $t1, 0($2)sw $t0, 4($2)
0000 1001 1100 0110 1010 1111 0101 10001010 1111 0101 1000 0000 1001 1100 0110 1100 0110 1010 1111 0101 1000 0000 1001 0101 1000 0000 1001 1100 0110 1010 1111
Assembler
6Computer StructureARCOS
Example 1
int n;n = 40000;printf("%d \n", n *n );
n = 50000;n = 50000;printf("%d \n", n *n );
� Is this output correct?1600000000 -1794967296
7Computer StructureARCOS
Example 2
float x, y , z;
x = 1.0e20;y = -1.0e20;z = 3.14;
printf("%f\n", (x + y) + z);printf("%f\n", x + (y + z));
� ¿Is (x+y) + z == x + (y+z)?
8Computer StructureARCOS
Example 3
� Code 1int a[N][N]for (i=0; i < N; i++)
for (j=0; j < N; j++)sum = sum + a[i][j];
� Code 2int a[N][N]for (j=0; j < N; j++)
for (i=0; i < N; i++)sum = sum + a[i][j];
� Are similar these codes?� Are equal the execution times?
9Computer StructureARCOS
Example 4
#include <stdio.h>
#define BLOCK_SIZE 512
void main(int argc, char **argv){
int fde, fds;char buffer[BLOCK_SIZE];int n;
fde = open(argv[1], 0);fde = open(argv[1], 0);fds = creat(argv[2], 0666);
while((n = read(fde, buffer, BLOCK_SIZE))> 0)write(fds, buffer, n);
close(fde);close(fds);
return;}
� What happens ifBLOCK_SIZE = 8192?
10Computer StructureARCOS
Example 5
� Multicore processors
� Who is faster, a dual core or a processor with 4 cores?
11Computer StructureARCOS
Content
Unit 1. Introduction to computersUnit 2. Data representationUnit 3. Assembly programmingUnit 4. ProcessorUnit 5. Memory systemsUnit 5. Memory systemsUnit 6. Input/Output systems
12Computer StructureARCOS
Bibliography
� Problemas resueltos de Estructurade ComputadoresF. García, J. Carretero, J. D. GarcíaD. ExpósitoParaninfo, 2009
� Computer Organización and Design.The Hardware/Software InterfaceDavid. A. Patterson, John L. HennessyMorgan Kaufmann, 2009
13Computer StructureARCOS
Bibliography
� Computer Organization and designW. Stallings, 8th edition 2010Prentice-Hall
ARCOS Computer Structure 14