Download as pdf or txt
Download as pdf or txt
You are on page 1of 31

Introduction

CSE 311 - Computer Organization


Assoc. Prof. Ahmed Fares
Today
• About this course
• Course logistics

CSE 311 -- Computer Organization 2


What is this course about?
• Computer Systems
• The hardware and system software
that work together to run
application programs
CSE 311
• Understanding how these
components work is vital to
writing correct and efficient
programs
• These concepts will take your
programming to the next level CSE 412
• Allow you to become a “power
programmer”

CSE 311 -- Computer Organization 3


What a happens when a program runs?
• A running program executes
instructions CPU
1. The processor fetches an Register file

instruction from memory PC ALU


System bus Memory bus
2. Decodes and gets the operands
for the instruction Bus interface
I/O
bridge
Main
memory
3. Executes the instruction: i.e.,
add two numbers, access
I/O bus
memory, check a condition, Expansion slots for
other devices such
USB
jump to function, and so forth controller
Graphics
adapter
Disk
controller
as network adapters

• Each instruction is simple, a the Mouse Keyboard Display


Disk
executable
stored on disk
computer can execute billions of
instructions every second
CSE 311 -- Computer Organization 4
CSE 311 -- Computer Organization 5
What is computer organization?

Application

Physics

CSE 311-- Computer Organization 6


What is computer organization?

Application

Gap too large to


bridge in one step

Physics

CSE 311 -- Computer Organization 7


What is computer organization?

Application
In its broadest definition, computer
organization is the design of the
Gap too large to abstraction/implementation layers
bridge in one step that allow us to execute information
processing applications efficiently
using manufacturing technologies.

Physics

Differences between Computer Architecture and Computer Organization


CSE 311 -- Computer Organization 8
What is computer organization?

Application
Algorithm
Programming Language
Operating System
Instruction Set Architecture
Microarchitecture
Register-Transfer Level
Gates
Circuits
Devices
Physics

CSE 311 -- Computer Organization 9


What is computer organization?

Application
Algorithm
Programming Language
Operating System
Instruction Set Architecture
Microarchitecture CSE-311 Computer Organization
Register-Transfer Level
Gates
Circuits
Devices
Physics

CSE 311 -- Computer Organization 10


Abstraction is Good But Don’t Forget Reality
• Most CS courses emphasize abstraction
• Abstract data types
• Asymptotic analysis
• These abstractions have limits
• Especially in the presence of bugs
• Need to understand details of underlying implementations
• Outcomes from taking CSE 311
• Becoming a more effective software developer
• Able to find and eliminate bugs efficiently
• Able to understand and tune for program performance
• Prepare for later “systems” classes in CS
• Compilers, Operating Systems, Networks, Computer Architecture, Parallel
Programming
CSE 311 -- Computer Organization 11
You’ve Got to Know Assembly and C
• Chances are, you’ll never write programs in assembly
• Compilers are better and more patient than you are
• But: Understanding assembly is key to machine-level execution model
• Behavior of programs in presence of bugs
• High-level language models break down
• Tuning program performance
• Understand optimizations done / not done by the compiler
• Understanding sources of program inefficiency
• Implementing system software
• Compiler has machine code as target
• Operating systems must manage process state
• Creating / fighting malware
• Assembly is the language of choice

CSE 311 -- Computer Organization 12


Bits + Context = Information
• Computers store information in bits
• The context we assign to those bits is what gives data meaning
• Example: is x2 ≥ 0?
• For floating point numbers: Yes!
• For integers:
• 40000 * 40000 = 1600000000
• 50000 * 50000 = -1794967296
• Example: does 0.1 + (0.2 + 0.3) == (0.1 + 0.2) + 0.3?
• No!

• Takeaway: ints are an approximation of integers and floats are an


approximation of real numbers
• You must understand their underlying representation in hardware to avoid costly errors
CSE 311 -- Computer Organization 13
Memory Matters

• Memory is not unbounded


• It must be allocated and managed
• Many applications are memory dominated

• Memory performance is not uniform


• Cache effects can greatly affect program performance
• Adapting program to the characteristics of memory system can lead to major speed
improvements

CSE 311 -- Computer Organization 14


Memory System Performance Example

void copyji(int src[2048][2048], void copyij(int src[2048][2048],


int dst[2048][2048]) int dst[2048][2048])
{ {
int i,j; int i,j;
for (j = 0; j < 2048; j++) for (i = 0; i < 2048; i++)
for (i = 0; i < 2048; i++) for (j = 0; j < 2048; j++)
dst[i][j] = src[i][j]; dst[i][j] = src[i][j];
} }

81.8ms 2.0 GHz Intel Core i7 Haswell 4.3ms


• Hierarchical memory organization
• Performance depends on access patterns
• Including how code steps through multi-dimensional arrays

CSE 311 -- Computer Organization 15


Cache Memory is a Large Part of a CPU Area

CSE 311 -- Computer Organization 16


There’s more to performance than asymptotic complexity
• Constant factors matter too
• And even an exact operation count does not predict performance
• Easily see 10:1 performance range depending on how code is written
• Must optimize at multiple levels: algorithm, data representations, procedures, and
loops
• You must understand the entire system to optimize performance
• How programs compiled and executed
• How to measure program performance and identify bottlenecks
• How to improve performance without destroying code modularity and generality

CSE 311 -- Computer Organization 17


Today
• About this course
• Course logistics

CSE 311 -- Computer Organization 18


Website and Textbooks
• Google classroom
• Complete lectures, assignments, ....
labs and exams
• Randal E. Bryant and David R. O’Hallaron (Required)
• Computer Systems: A Programmer’s Perspective, Third Edition
2016
• http://csapp.cs.cmu.edu
• This book really matters for the course!
• How to solve assignments
• Practice problems typical of exam problems
• Brian Kernighan and Dennis Ritchie (Optional)
• The C Programming Language, Second Edition 1988
• Still the best book about C, from the originators of the
language
CSE 311 -- Computer Organization 19
Course Components
• Lectures
• Higher level concepts
• Labs
• Practice to reinforce concepts and prepare you for the exams and assignments
• Sheets and Assignments
• The heart of the course
• Sheets are weekly
• Provide in-depth understanding of the material
• Exams (Two quizzes and two exams --mid and final)
• Test your understanding of concepts & mathematical principles
• Prerequisites
• check bylaws -- ECE221.

CSE 311 -- Computer Organization 20


Your Professor
• Office Hours:
• Office hours by appointment as well
–email me ahmed.fares@ejust.edu.eg
• Background
• Research

CSE 311 -- Computer Organization 21


Grading
• 30% --90 pts -- Assignments, Attendance, Quiz1, Quiz2, ...
• 30% -- 90 pts-- Mid
• 40% --120 pts-- Final

Dont't ask Why???

CSE 311 -- Computer Organization 22


Attendance
• I really want to see each of you every day in class
• We’ll work on problems together during class and labs
• I’ll leave time for questions

• Coming to class is one of the best ways to learn the material

• The attendance policy is governed by EJUST.

CSE 311 -- Computer Organization 23


Electronic Devices in Class
• Please put your phone in “do not disturb” mode
• If you would like to use your laptop/tablet for
taking notes
• You are welcome to do so, but please only use it for
notes
• The use of electronic devices for non-class
related purposes is strongly discouraged

• Consider this class to be an oasis from your


devices

CSE 311 -- Computer Organization 24


Quality
• Gives me feedback about how the
course is going
• A way for you to “grade” the course
• Used by the department and administration
• My goal is to earn “5s” from every one
of you
• If I am not living up to those expectations,
please come talk to me ASAP
• Please don’t wait till the end of the course
• Help me make the course better for you
and your classmates
• I will keep working until I can meet those
goals

CSE 311 -- Computer Organization 25


Late Days
• All assignments are due by the deadline stated on the assignment
handout
• Late will be graded as late
• Late days can only used on assignments, not on labs, quizzes, or final

CSE 311 -- Computer Organization 26


Serious Persistent Personal Issues
• I hope everyone in this class will remain happy and healthy
• If you have a serious personal issue, talk to me as soon as possible

CSE 311 -- Computer Organization 27


Negotiated your grades when allowed
• TAs

Bylaws

CSE 311 -- Computer Organization 28


Academic Integrity
• Exams and assignments must be the sole work of the student turning it in
• What is cheating?
• Sharing code or other electronic files: either by copying, retyping, looking at, or
supplying a copy of a file from this or a previous semester
• Sharing written assignments or exams: looking at, copying, or supplying an
assignment or exam
• Using other’s code from this or previous offerings of 311 or from any other source
such as code found on the Internet
• Using code from the textbook or from the class website is always OK

CSE 311 -- Computer Organization 29


Learning Environment
• I am committed to providing a safe learning environment for all
students

CSE 311 -- Computer Organization 30


Welcome
and Enjoy!

CSE 311 -- Computer Organization 31

You might also like