Академический Документы
Профессиональный Документы
Культура Документы
Performance / Machine
Basics
CS270 Unit 1
Max Luttrell, Spring 2017
"Welcome to the machine"
- Pink Floyd, 1975
levels of
computer usage
example user typical task
"use a smartphone to
dad
check traffic"
"write a smartphone app in
application programmer java which provides traffic
predictions"
"write MIPS assembly
lower level cs270 student language code to sort an
array of integers"
levels of
program code
• Application software
• written in a high level language (e.g.
C/C++, java, swift, etc.)
• Systems software
• compiler - translate C++ code into
target processor's machine code
• operating system
• handle input/output (I/O)
• manage memory and storage
• schedule tasks
• share resources
• Hardware
• processor, memory, I/O controllers
compiler: translates high-level
language into assembly language
• platform independent
BAC/Sud BAC/Sud
Concorde Concorde
Douglas Douglas DC-
DC-8-50 8-50
0 100 200 300 400 500 0 2000 4000 6000 8000 10000
BAC/Sud BAC/Sud
Concorde Concorde
Douglas Douglas DC-
DC-8-50 8-50
performancex / performancey =
A. e.g. 0.1 s
-12
B. e.g. 250ps = 0.25ns = 250*10 s
A. e.g. 10 Hz
9
B. e.g. 4.0GHz = 4000MHz = 4.0*10 Hz
CPU time
• CPU Time = CPU Clock Cycles * Clock Cycle Period =
• Designing computer B
class A B C
CPI for class 1 2 3
class A B C
IC in code sequence 1 2 1 2
IC in code sequence 2 4 1 1
Sequence 1: IC = 5 Sequence 2: IC = 6
Clock Cycles
Clock Cycles
= 2×1 + 1×2 + 2×3
= 4×1 + 1×2 + 1×3
= 10 =9
Avg. CPI = 10/5 = 2.0 Avg. CPI = 9/6 = 1.5
performance optimization
• common case
base 16: hexadecimal (aka hex) uses digits 0-9, then A-F
base conversion
• e.g. convert octal 437 to hexadecimal
octal 4 3 7
binary 1 0 0 0 1 1 1 1 1
hex 1 1 F
binary 1 0 0 0 1 1 1 1 1
signed integers
• signed integer can be negative
• idea:
• 1001001010011111111111101001
value two's complement decimal total
1001 n/a 8+1 9
00101001 n/a 32+8+1 41
1111111111101001 0000000000010111 16+4+2+1 -23
sign extension
• converting shorter ints to longer ints
• 0001001010011111
• could be anything!
• float
Instruction Register
holds current instruction
(IR)
• operations
• operands
• http://ccsf.instructure.com
• Make sure you can connect between our hills linux server and the Batmale
413 linux workstations, using the syllabus as a guide and for password /
login information.
• If you're on a linux workstation, demonstrate an ssh connection to hills.
Replace “uname” with your username.
ssh uname@hills.ccsf.edu
• If you're on your own laptop, demonstrate a terminal window logged into
hills, and from that terminal window, ssh to a linux workstation. The IP
range you can use is anything between 147.144.23.31-147.144.23.58.
ssh uname@147.144.23.37
• For Mac laptops, ssh is builtin to the terminal window. For Windows
laptops, you will need to download a terminal client like Putty or
SSHSecureShellClient.exe. See the computer systems guide on my web
page, http://fog.ccsf.edu/~mluttrel
Exercise 1B
http://fog.ccsf.edu/~mluttrel/cs270/exercises/ex1b.html