Top Banner
2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices
19

2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

Jan 02, 2016

Download

Documents

Lora Farmer
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-1

Hardware

• CPU

• Memory - 2 kinds

• Network

• Graphics

• Input and Output Devices

Page 2: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

Everything is BinaryEniac 1950Eniac contained 17,468 vacuum tubes, 7,200 crystal diodes, 1,500 relays, 70,000 resistors, 10,000 capacitors and around 5 million hand-soldered joints. It weighed more than 30 short tons (27 t), was roughly 8 by 3 by 100 feet (2.4 m × 0.9 m × 30 m), took up 1800 square feet (167 m2), and consumed 150 kW of power

2-2

Page 3: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

Bits and Bytes

• KB

• MB

• GB

• TB

• PB

• HB?

1-3

Page 4: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

Numbers and Letters

Numbers are represented in base 2

• 0000 0001

• 0000 0010

• 0000 0011

• 0000 0100

• 0000 0101

Keystrokes are represented with ASCII

• ‘A’ = 65 = 0100 0001

• ‘B’ = 66

• ‘C’ = 67

• ‘a’ = 97

• ‘b’ = 98

1-4

Page 5: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

1-5

A

B A AND B A OR B

A

B A NOT A

A B A AND B

T T T T F F F T F F F F

A B A OR B

T T T T F T F T T F F F

A NOT A

T F F T

Gates

AND gate OR gate NOT gate

Page 6: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

1-6

Example: XOR Circuit

A

B

A XOR B

A B A XOR B

T T F T F T F T T F F F

A AND (NOT B)

OR

(NOT A) AND B

Page 7: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-7

Software

• Instructions to CPU / Hardware

• Binary

• Assembly Language

• High Level Languages

Page 8: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-8

Page 9: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-9

Programming Languages

1940 1950 1960 1970 1980 1990 2000

Machinecode

Assembly languages

FortranBasic

Pascal

Scheme

C C++

JavaLISP

Smalltalk Smalltalk-80

C#

Logo

Python

Page 10: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-10

Software Development

• Emphasis on efficiency fast algorithms small program size limited memory use

• Often cryptic code

• Not user-friendly

• Emphasis on programmer’s

productivity team development reusability of code easier maintenance portability

• Better documented

• User-friendly

1950-1970's: Now:

Page 11: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-11

Software Development Tools

• Editor programmer writes

source code

• Compiler translates the source

into object code (instructions specific to a particular CPU)

• Linker converts one or several

object modules into an executable program

• Debugger steps through the

program “in slow motion” and helps find logical mistakes (“bugs”)

Page 12: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-12

The First “Bug”

“(moth) in relay”

Mark II Aiken Relay Calculator (Harvard University, 1945)

Page 13: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-13

Compiled Languages:Edit-Compile-Link-Run

Editor Sourcecode

Compiler Objectcode

Linker Executableprogram

Editor Sourcecode

Compiler Objectcode

Editor Sourcecode

Compiler Objectcode

Page 14: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-14

Interpreted Languages:Edit-Run

Editor Sourcecode

Interpreter

Page 15: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-15

Compiler vs. Interpreter

• Compiler: checks syntax generates

machine-code instructions

not needed to run the executable program

the executable runs faster

• Interpreter: checks syntax executes appropriate

instructions while interpreting the program statements

must remain installed while the program is interpreted

the interpreted program is slower

Page 16: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-16

Java’s Hybrid Approach:Compiler + Interpreter

• A Java compiler converts Java source code into instructions for the Java Virtual Machine.

• These instructions, called bytecodes, are the same for any computer / operating system.

• A CPU-specific Java interpreter interprets bytecodes on a particular computer.

Page 17: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-17

Java’s Compiler + Interpreter

Editor

Hello.java

Compiler

Hello.class

Interpreter

Hello,World!

Interpreter

Page 18: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-18

Why Bytecodes?

• Platform-independent

• Load from the Internet faster than source code

• Interpreter is faster and smaller than it would be for Java source

• Source code is not revealed to end users

• Interpreter performs additional security checks, screens out malicious code

Page 19: 2-1 Hardware CPU Memory - 2 kinds Network Graphics Input and Output Devices.

2-19

// Mike Bollhorst

// Aug 19, 2013

// Hello: my first program - prints hello world on screen

public class Hello

{

public static void main (String[] args)

{

System.out.println(“Hello world!”);

}

}