+ All Categories
Home > Documents > Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s...

Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s...

Date post: 12-Aug-2019
Category:
Upload: vanthu
View: 212 times
Download: 0 times
Share this document with a friend
28
Start to Code Instructor: Xiao Liu
Transcript
Page 1: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

Start to CodeInstructor: Xiao Liu

Page 2: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

IntroductionXiao Liu

Third-year Ph.D. Candidate

@ Information Sciences and Technology

Penn State University, University Park

Research Interests:

Programming Languages

Software Engineering & Security

Page 3: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

Why coding?

Page 4: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

Applications

Page 5: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

Today● Course Info● What does a computer do● Turing Machine

Page 6: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

Course Information● Basics about Programming

○ Statement○ Branching○ Loop○ Functions

● Computational Thinking○ Sorting○ Searching○ Parallel Processing

● Programming an Artifact○ Design & Implementation○ Testing & Debugging○ Summarization

Page 7: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law■ Double every 18 months

Page 8: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law■ Double every 18 months■ 10,000,000,000 cal/sec

Page 9: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law■ Double every 18 months■ 10,000,000,000 cal/sec

1 + 2 - 10 + 11 + 7 - 6 - 4 + 22 - 1

Page 10: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

Page 11: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register■ Cache■ Memory■ Hard Disk

Page 12: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register - 32 bits 00000000111111110000000011111111■ Cache ■ Memory■ Hard Disk

Page 13: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register - 32 bits 00000000111111110000000011111111■ Cache - 256 KB (65,536 * size of Register)■ Memory ■ Hard Disk

Page 14: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register - 32 bits 00000000111111110000000011111111■ Cache - 256 KB (65,536 * size of Register)■ Memory - 8 MB (32 * size of Cache)■ Hard Disk - 256 GB (32,768 * size of Memory)

Page 15: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register - 32 bits 00000000111111110000000011111111■ Cache - 256 KB (65,536 * size of Register)■ Memory - 8 MB (32 * size of Cache)■ Hard Disk - 256 GB (32,768 * size of Memory)

Size Increase

Page 16: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register - 32 bits 00000000111111110000000011111111■ Cache - 256 KB (65,536 * size of Register)■ Memory - 8 MB (32 * size of Cache)■ Hard Disk - 256 GB (32,768 * size of Memory)

Why not store everything in Hard Disk?

Page 17: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register - 1 CPU clock cycle, 2 GHz, 2,000,000,000 access/sec ■ Cache - ?■ Memory - ?■ Hard Disk - ?

Page 18: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

■ Register - 1 CPU clock cycle, 2 GHz, 2,000,000,000 access/sec ■ Cache - 100 GB/second ■ Memory - 10 GB/sec ■ Hard Disk - 2000 MB/second

Speed Increase

Page 19: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?

Page 20: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?○ +, - , *, /○ Any more?

Page 21: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?○ +, - , *, /○ Turing Machine - Most General Model about Computing

Alan Turing (1912-1954)

Page 22: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?○ +, - , *, /○ Turing Machine

■ Read the symbol on the square under the head.■ Edit the symbol by writing a new symbol or erasing it.■ Move the tape left of right by one square so that the machine can read and edit the

symbol on a neighbouring square.

Page 23: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?○ +, - , *, /○ Turing Machine

Symbol read Write instruction Move instructionBlank None None0 Write 1 Move tape to the right1 Write 0 Move tape to the right

The current symbol under the head is 0, so we write a 1 and move the tape right by one square.

Page 24: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?○ +, - , *, /○ Turing Machine

Symbol read Write instruction Move instructionBlank None None0 Write 1 Move tape to the right1 Write 0 Move tape to the right

The symbol being read is now 1, so we write a 0 and move the tape right by one square:

Page 25: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?○ +, - , *, /○ Turing Machine

Symbol read Write instruction Move instructionBlank None None0 Write 1 Move tape to the right1 Write 0 Move tape to the right

Similarly, the symbol read is a 1, so we repeat the same instructions.

Page 26: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

What does a Computer do● Fundamentally

○ Calculation - Moore’s Law○ Storage - Different levels

● What kind of calculations?○ +, - , *, /○ Turing Machine

Symbol read Write instruction Move instructionBlank None None0 Write 1 Move tape to the right1 Write 0 Move tape to the right

Similarly, the symbol read is a 1, so we repeat the same instructions.

Page 27: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

Lab 1: Try A Turing Simulatorhttps://turingmachinesimulator.com/

Even Number of Zeros

q0, 0q1, 0, >

Current State

Symbol Read

Next State

Symbol Write

Move

Page 28: Start to Code - personal.psu.edu · What does a Computer do Fundamentally Calculation - Moore’s Law Double every 18 months

Lab 1: Try A Turing SimulatorHow to modify this into

Odd Number of Zeros?


Recommended