ecpe 170 –instructor: vivek pallipuram–university of the

51
ì Computer Systems and Networks ECPE 170 – Instructor: Vivek Pallipuram– University of the Pacific Introduction These slides are credited to Dr. Jeffrey Shafer

Upload: others

Post on 02-Nov-2021

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ECPE 170 –Instructor: Vivek Pallipuram–University of the

ìComputer Systems and NetworksECPE 170 – Instructor: Vivek Pallipuram– University of the Pacific

IntroductionThese slides are credited to Dr. Jeffrey Shafer

Page 2: ECPE 170 –Instructor: Vivek Pallipuram–University of the

A Modern Computer – iPhone XS

Fall 2021Computer Systems and Networks

2

Page 3: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Applications

Computer Systems and Networks

3

Fall 2021

Page 4: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Application – Pokemon Go

ì Written in a high level language (Objective C)

ì What resources does Pokemon Go need to run?(i.e. what does the executable file need to execute?)ì Hardware

ì Processor(s) – Run program, display graphics, …ì Memory – Store programs, store dataì I/O – Touch screen, storage, network, 3-axis gyro, …

ì Software - Operating system

Computer Systems and Networks

4

Fall 2021

Page 5: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Software - Operating System

ì Apple iOS – Used in iPads, iPhones, iPods, Apple TVì Variant of Mac OS X operating system used on

traditional Macs

ì What are some jobs of this operating system?ì Manage hardwareì Manage applications (multitasking)

ì Written in high-level languagesì C, C++, Objective C (varies by component)ì Can we run this code directly on the processor?

Computer Systems and Networks

5

Fall 2021

Page 6: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Software - Compilers / Interpreters

ì These are programs that build other programs!

ì Goal: Convert high-level languages into machine code that can be directly executed by hardware

ì Examples ì Apple Xcodeì Microsoft Visual

Studio

ì What’s the differencebetween a compiler and interpreter?

Computer Systems and Networks

6

Fall 2021

Page 7: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Hardware

Computer Systems and Networks

7

https://www.ifixit.com/Teardown/iPhone+XS+and+XS+Max+Teardown/113021 Fall 2021

Page 8: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Hardware

Computer Systems and Networks

8

Apple A12 64-bit Processor + 4GB of RAM (layered)Power ManagementAudio AmplifiersPower ManagementBattery Charger

https://www.ifixit.com/Teardown/iPhone+XS+and+XS+Max+Teardown/113021 Fall 2021

Page 9: ECPE 170 –Instructor: Vivek Pallipuram–University of the

iPhone XS Processor

ì Apple A12 Processorì Clock speed – 2.5GHzì 6 coresì 4GB RAM

ì What does a processor do?ì Executes machine language instructions

ì Machine language?

ì How does the processor execute the instructions?

Computer Systems and Networks

9

What do these mean?

Fall 2021

Page 10: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Microarchitecture

Computer Systems and Networks

10

Fall 2021

Page 11: ECPE 170 –Instructor: Vivek Pallipuram–University of the

How Does It Work?

ì Apple won’t tell us – trade secret!

ì Experts can dissolve (with acid), burn, or grind off outer protective layers of chip and then peer inside:ì Need a really good

microscope!ì Reverse Engineering in

the Semiconductor Industry: http://www.scribd.com/doc/53742174/Reverse-Engineering

Computer Systems and Networks

11

Fall 2021

Page 12: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Computer Systems and Networks

12

Can see this level of detail with your own eyes…

Divided into logic blocks with different functions:

• Processor• Cache memory• Memory

Controller• Video (GPU)

https://www.anandtech.com/show/13393/techinsights-publishes-apple-a12-die-shot-our-take Fall 2021

Page 13: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Computer Systems and Networks

13

SEM Cross-Section of (older) Apple A5Fall 2021

Page 14: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Digital Logic

Computer Systems and Networks

14

Memory cell Transistor

Fall 2021

Page 15: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Transistors

Computer Systems and Networks

15

ì You can still make assumptions at this level that the transistor is either “on” (1) or “off” (0)

ì But below this are analog circuits

Fall 2021

Page 16: ECPE 170 –Instructor: Vivek Pallipuram–University of the

The Computer Level Hierarchy

ì Level 6: The User Level – “Pokemon Go”ì Program execution and user interface level

ì Level 5: High-Level Language Level – “Objective C”ì Programming languages like C++, Java, Python, …

ì Level 4: Assembly Language Level – “ARM Assembly”ì Program directly at this level, or …ì Use a compiler/interpreter to process/convert high-

level code

Computer Systems and Networks

16

User Level

High-Level Language

Assembly

Fall 2021

Page 17: ECPE 170 –Instructor: Vivek Pallipuram–University of the

The Computer Level Hierarchy

ì Level 3: System Software Level - “iOS”ì Controls active programs and manages system

resourcesì Assembly language instructions often pass through

Level 3 without modification

ì Level 2: Machine Levelì Instruction Set Architecture (ISA) Levelì Instructions are particular to the architecture of the

specific machine (i.e. Intel processors, ARM processors, IBM processors…)

Computer Systems and Networks

17

User Level

High-Level Language

Assembly

System

Machine

Fall 2021

Page 18: ECPE 170 –Instructor: Vivek Pallipuram–University of the

The Computer Level Hierarchy

ì Level 1: Control Levelì Decodes and executes instructions and moves data

through the systemì ECPE 173 – Computer Organization & Architecture

ì Level 0: Digital Logic Levelì Digital circuits, gates and wires implement the

mathematical logic of all other levelsì ECPE 71 – Digital Design

ECPE 174 – Advanced Digital Design

Computer Systems and Networks

18

User Level

High-Level Language

Assembly

System

Machine

Control

Digital Logic

These levels are too hardware-oriented for ECPE 170…

Fall 2021

Page 19: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Hardware / Software “Stack”

Computer Systems and Networks

19

Software

Hardware

CPU Memory StorageDisk, SSD

GPU Network …

User-Space(“Applications”)

Kernel-Space(“OS”)Operating System

Shell(Bash)

TerminalFirefox LibreOffice …

Device Drivers

Fall 2021

Page 20: ECPE 170 –Instructor: Vivek Pallipuram–University of the

ìCourse Overview

Computer Systems and Networks

20

Fall 2021

Page 21: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Motivating Question

ì What do you, as a programmer, need to know about the underlying system (software and hardware) to write more efficient code?ì Role of the tools

ì Compiler, assembler, linker, profilerì Role of the operating system and its efficient usageì Assembly programming (using the CPU efficiently)ì Memory hierarchy and its impact on performance

Computer Systems and Networks

21

Fall 2021

Page 22: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Course Goals

ì Present a complete view of how computer systems are constructedì From the CPU assembly programming level

to the user application level

ì Understand the relationship between computer software and hardware

ì Lay the foundation for future coursesì Advanced Digital design / VLSIì Operating systemsì Computer networkingì Application development

22

Computer Systems and Networks Fall 2021

Page 23: ECPE 170 –Instructor: Vivek Pallipuram–University of the

C Programming Language

ì Why not Python, Java, Ruby, Perl, PHP, …?

ì High-level languages (especially interpreted, managed code…) try to hide the underlying machine from you

ì ECPE 170 wants to reveal the underlying machine to you!

ì Industry demand for systems programmers

Computer Systems and Networks

23

CFall 2021

Page 24: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Linux

ì Course will be taught 100% in Linux

ì Did you have to choose Linux for ECPE 170?

ì No, not really, but…ì Too many Pacific graduates were

escaping without a working knowledge!ì Feedback from co-op employers and

graduates: “More Linux/Unix skills please!”

Computer Systems and Networks

24

Fall 2021

Page 25: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Linux

ì Who here has used a Linux desktop/laptop/server before?

ì Who here has used a Linux “device” before?ì I’d be surprised if it isn’t everyone…ì Android runs a Linux kernelì Amazon Kindle runs a Linux kernelì TiVO runs a Linux kernel

Computer Systems and Networks

25

Fall 2021

Page 26: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Discussion

ì What is open-source?

ì What is an operating system kernel?ì Is the kernel everything you need from an OS?

ì What is Linux?

ì What is Ubuntu Linux? (RedHat? Debian? …)

Computer Systems and Networks

26

Fall 2021

Page 27: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Virtual Machine

ì Course will be taught 100% from a virtual machine booting Linux that youinstall!

ì Couldn’t you just give us remote access to a server someplace that is already configured?

ì Yes, but…ì By installing it yourself you will have

the skills to use it again in the future

Computer Systems and Networks

27

Fall 2021

Page 28: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Discussion

ì What is a Virtual Machine?

ì How is it different from dual booting?

ì Which comes first, the virtual machine, or the OS?ì Answer: It depends!ì Typical desktop install: hosted virtualizationì Typical server install: bare-metal virtualization

Computer Systems and Networks

28

Fall 2021

Page 29: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Hosted Virtualization

Computer Systems and Networks

29

Recommended technique for ECPE

170

Fall 2021

Page 30: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Bare-Metal Virtualization

Computer Systems and Networks

30

More efficient, but not as easy to install.

The virtual machine monitor acts like an operating system itself!

Fall 2021

Page 31: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Version Control

ì Course will use version control! ì Only way to get lab code or turn in

assignments

ì Did you have to mandate VCS for ECPE 170?

ì No, not really, but…ì Too many Pacific graduates were avoiding

learning this on their own!ì Feedback from co-op employers and

graduates: “Only n00bs work without version control!”

ì Used everywhere: Source code of all kinds!(C++, Python, Matlab, VHDL/Verilog, …)

Computer Systems and Networks

31

Fall 2021

Page 32: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Version Control

Computer Systems and Networks

32

Fall 2021

ì Who here has used a version control system before?ì What system?ì Where at?ì What purpose?

Page 33: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Questions?

ì Questions?ì Concerns?

Computer Systems and Networks

33

Fall 2021

Page 34: ECPE 170 –Instructor: Vivek Pallipuram–University of the

ìCourse Mechanics

Computer Systems and Networks

34

Fall 2021

Page 35: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Websites

Computer Systems and Networks

35

• http://ecs-network.serv.pacific.edu/ecpe-170

Main website (syllabus, schedule)

• http://canvas.pacific.edu

Canvas website (gradebook)

• http://bitbucket.org

Bitbucket.org (version control)

Fall 2021

Page 36: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Textbook

ì No official textbook

ì Optional reference books(useful for this class and beyond)ì The C Programming

Language, 2nd Edition

ì Please suggest useful online or print references throughout the semester

Computer Systems and Networks

36

Fall 2021

Page 37: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Gradingì 70% - Labs

ì Points assigned to each lab will vary based on complexityì Each lab begins as an in-class activity

ì Unfinished work becomes homework/projectì Labs are large – assume “the usual” amount of homework/projects for a 4-credit class

ì Tip: The best students last semester started the labs outside of class, and finished them as an in-class activity

ì 15% - Video Presentation (1)

ì Perform a sequence of technical activities or solve a problemì Explain in your own words how and why you solved the problem

ì 15% - Final Examì In-class during the scheduled exam day

Computer Systems and Networks

37

Fall 2021

Page 38: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Class Attendance

ì See class schedule on website

ì Strong – Class will have significant new lecture content or in-class participation problem

ì Moderate – Class will have significant lab activity

ì Recommended – Students have the option of performing their work outside of the class, as long as they are confident in performing the required task on their own

Computer Systems and Networks

38

Fall 2021

Page 39: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Honor Code

ì All assignments are submitted individually

ì Encouraged Activitiesì Collaborating with your classmates

(asking questions, solving problems together)ì Searching for solutions online

ì Provided code copied does not exceed 25% of total assignment length

ì Provided you clearly document this copy in your source code and lab reportì What did you copy? Where did it come from?

Computer Systems and Networks

39

Fall 2021

Page 40: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Honor Code

ì Risky Activitiesì Having your classmates type on your computer or

assignment fileì Posting solutions to Discord

ì Forbidden Activitiesì Copying someone’s work verbatim (classmate or

otherwise)ì Copying someone’s work and obfuscating its source

ì Your code will be checked for similarity with other submissions with an automated tool. More than a 30% match on non-trivial code is a red flag.

Computer Systems and Networks

40

Fall 2021

Page 41: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Lab Topics

1. Linux

2. Version Control

3. C Programming

4. C Programming Project

5. Performance Measurement

6. Performance Optimization(compiler and programmer techniques)

7. Performance Optimization(Memory systems)

8. Network Programming 1 (Python)

9. Network Programming 2

10. Assembly Programming 1(MIPS)

11. Assembly Programming 2

12. Assembly Programming 3

Computer Systems and Networks

41

Fall 2021

Page 42: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Class Time

ì The goal* in designing this course:

Computer Systems and Networks

42

* Actual time in any specific class may vary

0%

25%

50%

75%

100%

Me Talking You Doing(Hands-on activities)

Fall 2021

Page 43: ECPE 170 –Instructor: Vivek Pallipuram–University of the

ìLab 1 - Linux

Computer Systems and Networks

43

Fall 2021

Page 44: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Homework

ì Before the next class1. Skim “Virtual Machine Setup” tutorial instructions

on websiteì http://ecs-network.serv.pacific.edu/ecpe-

170/tutorials/vm_setup

2. Decide on what computer system you want to use for this class

3. Download all softwareì Virtual machine installer (VMware Player)ì Linux .iso image (installer) – 64-bit version

Computer Systems and Networks

44

Fall 2021

Page 45: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Next Class - Linux Installfest

ì Tutorial Day

ì Objectivesì Follow the “Virtual Machine Setup” tutorial from

website to install Linuxì Debug individual problems if neededì Verify OS worksì Submit screenshot to “Pre-Lab 1” assignment on

Canvas as proof of success

Computer Systems and Networks

45

Fall 2021

Page 46: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Next Class - Linux Installfest

ì I want you to be comfortable as professionalsworking independently to solve problems

ì If you complete the “Virtual Machine Setup” tutorial independently (and submit to Canvas a screenshot by Thursday morning), you don’t need to attend Thursday’s class.

ì I will still be here to answer all questions and solve problems

Computer Systems and Networks

46

Fall 2021

Page 47: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Next Class - Linux Installfest

ì Warning: Don’t skip class Thursday, and then tell me next Tuesday at Lab #1 that your OS doesn’t work!

Computer Systems and Networks

47

Fall 2021

Page 48: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Lab 1 - Linux

ì The first lab is next Tuesdayì Topic: Linuxì Crash course in command-line usage

ì Lab 1: Pre-Labì Submit to Canvas the screenshot of your working

command prompt in Linux. Hopefully you will have this done by end-of-class Thursday

ì Pre-Lab is due at the start of the lab

Computer Systems and Networks

48

Fall 2021

Page 49: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Bring Laptop!

Computer Systems and Networks

49

Every class – bring your laptop

Fall 2021

Page 50: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Bring Laptop!

Computer Systems and Networks

52

Every class – bring your laptop!!

Just assume we’ll do significant lab activity in class unless it’s been made crystal clear in advance that a day will

be all lecture/discussion instead…

Fall 2021

Page 51: ECPE 170 –Instructor: Vivek Pallipuram–University of the

Questions?

ì Questions?ì Concerns?

Computer Systems and Networks

53

Fall 2021