computer architecture_week1_lecture note

노승광
Research Team — DAWN
4 min readAug 31, 2021

--

What you will learn : “How does a computer work?”

- How programs are translated into the machine language

- The hardware, software interface(boundary btw hw & sw)

- What determines program performance? How it can be improved?

- How hardware designers improve performance

- What’s pipelining and parallel processing

- How does memory work?

What we ‘write’ with high-level language(C,C++,Java, Python etc…what humans can read and write) à application software

Low level language is what machine understands.

System Software — compiler & O/S

Compiler : translate HLL code à machine code(low level language)

Operating System(Windows, Mac OS, Linux, Android, iOS … etc), Handling IO, managing memory and storage, scheduling tasks, sharing resources (learn this in OS class)

High level language

-level of abstraction closer to problem domain

-provides for productivity(think & write in more natural-human readable- language) and portability(can run @ different CPUs, independent of the computer)

HLL à compile : Assembly language(designed to ‘read’ machine language. 1 line assembly code == 1 line machine code), hardware specific(assembly language depends on what CPU you are using…AMD? INTEL?… @this course we are using MIPS CPUàassembly language is hardware specific)

Textual representation of instruction

Assembly code à assemble : Machine code (written in machine language: 00100111100001011)

Matche to assembly language 1 to 1.

This encodes instructions & data,

This binary codes run on hardware. (Textual representation is the assembly language)

C vs JAVA

Your C code à compile à assembly code à assemble à machine code

You have intel cpu … you need intel machine code… you need intel assembly code, you need intel compiler

If you have AMD cpu … you need AMC machine code… you need AMD assembly code, you need AMD compiler

The machine code/assembly code depends on the ‘ISA’ (talk about it later)

Manufacturers need to make and provide compilers for their own Hardware.

However, HLL can be compatible. No need to write twice! J à portability

Your JAVA code à compile à JAVA .class file (this runs on something called ‘JAVA virtual machine’, JVM)(Even though there are JVM for intel, JVM for AMD etc… from software’s perspective, they looks the same) à

This is because there is JVM for Intel, JVM for AMD, under the JVM it is already compiled,

The ‘Bottom part” of JVM is different, someone compiled this JVM for you! This JVM was compiled for your computer, for your INTEL cpu.

Components of a compuer

Datapath & control è CPU

Memory

Input / Output, keyboard mouse

Inputs are comping into the memory

Goes through the datapath and gets processed(“Control” part controls the datapath to get data to processor, to memory again)

Output: to memory

Therefore, I/O are always through the memory(not keyboard, network whatever…)

Datapath: performs operations on data

Control: controls and sequences datapath, memory

Cache memory: inside the CPU, small fast SRAM memory for immediate access to data.

Abstraction and ISA

Abstraction helps us deal with complexityàhide lower level detail

Do not care about inner implementation,

Ex) SW: API, api is an anstraction, networkL layering, Computer architecture: ISA(Instruction set architecture)

ISA : Interface btw hardware and low level software.

Anything programmers need to know to make a binary machine language program work correctly on HW.

What the HW supports? What instruction that the HW supports?

Different implementations of the same architecture possible à as far as the HW maintains the same ISA(same architecture), the implantation of the architecture may differ.(HW version1 , HW version2)

è As long as using same ISA, no need to change machine code or compiler.

Sometimes prevents using new innovations. (When we need to change some of ISA, this might discourage new innovation that cannot be done w/o change in ISA…”WE DON’T WANT TO RECOMPILE~L)

Implementation: the details underlying and interface.

Performance

Your C code à compile à assembly code à assemble à machine code(instructions) àexecute

Assembly lang : machine lang = 1 : 1

What affects the performance?

- Algorithm + Data structure + programming skills à determines # of operations executed

- Programming language, compiler, architecture(ISA) à determine # of machine instructions executed per operation

- Processor and memory system à how fast instructions are executed.

- i/o and OS à how fast io operations are executed

Moore’s Law

IC capacity doubles every 18~24 months.(more transistors in SSD, GPU etc…)

Cost reduced

He did not say anything about the performance. (although it increased)

Latency(response time) & throughput(how many jobs / unit time)

For CPU à 1 job(1 millions of instructions): throughput might be important

Response time: How long does it take to do a(=one) task?

Throughput: how many jobs can the machine run at once? Total work done per unit time

Q: How are respone time and throughput affected by

àreplacing the processor with a faster version? Both will be improved

àAdding more processors? Resoponse time: no, just ‘one’ job, it will run @ just one processor, no change in latency, but if you can split the job to several smaller jobs, both can be improved(faster response time and more throughput)

Dual-core Octa-core….Are you using all these cores? Otherwise, you are wasting the cores.

--

--