You are on page 1of 20

CISC 101

2015-09-14

Monday September 14, 2015


CISC 101
How computers work
Structured problem solving
Professor Oteafy
Office hours: Monday 11 1 pm
oteafy@cs.queens.ca
Course
Website: cisc101.weebly.com
o Password: c101$harief
Lectures
o Exams will cover everything explained in lectures
Labs
o Chance for you to practice what you covered in class
o TAs will help
Office hours
o Email for more flexible meeting times

Class Format
o Single topic per lecture
o Often uses Kinaesthetic Learning
Learning by doing
Ex. Demos, live exercises
o The 3-minute rule
Course book
o Introduction to Computer Science Python
Assessment
o 4 quizes, every other week in Lab
30-45 min each
Will focus on core topics covered in previous classes
o 5 assignments

Wednesday September 16, 2015


Come up with a problem
Define it
How many sub problems?

How do we explain it to a computer?


What is a satisfactory solution?

Phase 1 Problem definition

What is the problem?


o Clear definition
o Are there sub-problems? Eg. Best fit given 50 seats

What
o
o
o

Separate important factors from fluff


o Do we care about their heights?

Just like Math, we assign variables


o T = number of tables
o C = number of chairs
o

are the parameters?


Number of guests
Number of troubling guests?
Capacity

o
Phase 2 Explain it to a computer

Do we know the computers language?


Clear Instruction
Are they sequential?
How to handle different problem inputs
Required output?
This is called an ALGORITHM

An Algorithm is
o A finite number of clearly described, unambiguous doable
steps
o They can be systematically followed to produce a desired
result for given input.
o The Word algorithm is derived from the 9th century Arab
mathematician, AL-Khwarizmi who worked

Algorithms are Key


o Every single program follows an algorithm
o Computer algorithms are central to computer science.

How to we measure the speed of computers

o Clock rate!
Frequency at which a central processing unit (CPU) runs
o This is for only one Core
Phase 3 The Solution
What defines a solution
Are there multiple solutions
How do we find the best of these solutions
What if there is no solution

Recap
Computer Science is about solving Computational problems
Programming is only one part of it
We ordered instructions in an algorithm

Thursday, September 17, 2015


By the end of this term

1)
2)
3)
4)
5)
6)

Code.org

Analyze a real word problem


Abstract it
Derive a computational model
Design a solid algorithm
Code it
Present all possible solutions

Computational Problem Solving


Representation that captures all the relevant aspects of the
problem
Algorithm that solves the problem using the representation
The use of Abstraction
A representation that leaves out detail of what is being represented
is a form of abstraction

*** Password for class files: cisc101$harief


Monday, September 21, 2015

Computer Hardware
The importance of a universal language
ASC11
Binary
Programing languages
Universal Computing Device
All computers can compute the exact same thing
o Given enough time and storage
We needed
A simple language
One realistic hardware implementation
All we have is electricity
Having n binary digits
We can represent
(2^n) 1
Information Theory

Fundemental Theorem of information Science Claud Shannon


states all information can be represented by the use of only 2
symbols, 0 and 1
This is referred to as:
o Binary Representation
Shannon is known as:
o The Father of Information Theory

The Binary system


For representing numbers, any base (radix) can be used.
For example, in base 10, there are ten possible digits (0, 1,9)
For numbers in base 2, there are two possible digits (0,1) in which
each column value is a power of two:

Binary digits
With 8 bits
0000 0000
0000 0001

1000 0001

1111 1111

0
1
129
255

Binary conversions
Learn how to convert binary to decimal
Learn how to convert decimal to binary
Wednesday, September 23, 2015
Quiz Next Tuesday
Includes Everything
Except:
o Jokes
o Details of Non Neumann Architecture
Binary Digits = Bits
Always start counting from zero 0
o Dont want to waste any space
Bits and Bytes
Converting Decimal to binary
o Successive division of the number by 2, then padding with
zeros from the left
o 99/2 = 49, with remainder 1
o 49/2 = 24, with remainder 1
o 24/2 = 12, with remainder 0

o 12/2 = 6, with remainder 0


o
6/2 = 3, with remainder 0
o
3/2 = 1, with remainder 1
o
1/2 = 0, with remainder 1

ASCII Table
o Assigned each binary number to a symbol or letter
o Was a translation table

What is computer hardware?


Physical parts of the computer system
It includes the all important components Central processing unit
(CPU) and main memory
It also includes :
Input
o Keyboard
o Mouse
o Scanner
o Touch panel
o Mic
o Network
Output

o Screen
o Printer
o Speakers
o Network
Storage
o Hard disk
o Flash drives
o Dvds/cds
CPU
o Processors
o RAM
o ROM
o Cache

All these devices communicate in 0s and 1s


Digital computing: its all about switches
Computer hardware must be reliable and error free
The key to developing?

Decimal digitalization
o In electronic copmputing, values are represented by dicrete
voltage levels

o Suppose we used base 10 (decimals)


Binary Digitalization
o In this representation each digit can be one of only two
possible values, similar to a light switch that can be either on
or off
Vaccum Tube system
o 1946
Transistors
o First demonstrated in 1947, at bell labs by William Shockley
o Give us the ability to represent 0s and 1s electrically
Integrated Circuits
Limits of INtigrated Circuits technology: Moores Lax

Understanding Hardware components


Fundemental hardeware components
o CPU the brain of the computer system. Interprets and
executes instructions
o Main memory is where currently executing programs reside
It is volatile, contents lost when power is turned off
o Secondary memory provides long term storage of programs
and data
Non-volatile, contents retained when power is turned off
o Input/output devices mouse, keyboard, monitor, printer etc.
o Buses transfer data betwee components within a computer
system
Bus speed

System bus (specifically between CPU and main


memory)

So how do they all work?


John Von Neumann Architechture
o Developed in 1944/5
o The structure we have been referring to:
Separate units for input and output
Data is stored in a separate memory location
The ALU carries out instructions on data items moved
into the ALU
The Control unit: acts as a stage manager
Thursday, September 24, 2015
Carrying out an instruction
1) Get next instruction from memory
2) Decode
3) Get the operands from memory
4) Execute it
5) Update instruction counter

Von Neumann Cycle


Fetch
o The address of the next instruction is read from the
instruction counter. The next instruction is read from this
memory address to instruction register
Decode
o The instruction is translated to a format that isusable for the
execution unit by the decoder
Fetch operands
o Depending to the actual instruction operands from a memory
location have to be fetched to be accessible for the execution
unit.
Execute
o The arithmetical logical unit performs the operation and writes
the results to registers or memory according to the instruction
Update
o Instruction counter
Von Neumann Architecture
ENIAC
o Still used vacuum cubes
Digging Deeper in Representation (binary and more)
Cant write binary as code
o Would take way to long
But remember the only thing the computer can read is zeros and
ones

Hexadecimal Numbers:
A base 16 system with 16 digits
0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F
For Example:
o r=16, a hex number: (B65) base 16 =
o B=11x16^3
o 6=6x6^2
o 5=5x16^1
Conversions
WE can convert from binary or hex to decimal
How to
Can computers handle any number

Not all numbers


A computer has a finite amount of memory to store a number
Only a portion of most real numbers can be stored
The majority of real numbers cannot be stored on a computer

Only numbers that are a sum of powers of 2 can be stored exactly


Most calculations made with real numbers on a computer can only
yield?

Monday September 28, 2015


Quiz #1 this week
Go over previous slides
Study from chapter 1 slides as well (publisher)
o Some self test questions
Will cover
o Short answer
o True/false
o Multiple choice
o Fill in the blanks
o Oct and hex conversions will be on it
Should take 30 mingiven 45 min
What is the quiz about

Reminds you of important topics


Making sure you are staying up to date on material
Anything under 80% is not sufficient
Mental prep for future concepts

Hexadecimal to Binary conversions


Converting between binary and hex is much easier done by
grouping the digits
For example:
o (2C6B.F06) base 16 = (groups of binary numbers) base 2
o (2 C 6 B . F 0 6) base 16
2 = 0010
C = 1100
6 = 0110
B = 1011
.
F = 1111
0 = 0000
6 = 0110
Computer Hardware
Millions of transistors

Boolean Logic
Created by George Boole (1815 1864)
1847 Boolean Algebra
Boolean algebra deals with TRUE or FALSE
Just like elementary Algebra deals with decimals
Boolean Algebra operates:
o AND OR NOT
Elementary Algebra
o +, -, /, x

A AND B Is true only if A and B are both true


A OR B Is true if either A or B are True
NOT A Negates (flips) the value of A
Example:
o I will wear a jacket if it is cold OR if it is raining
o I will travel if I find a ticket AND Im on vacation
Example:
o A logic gate implements a Booleam function
o It carries out a logical operation
o This is where we use transistors

o Logic cicuits are made of many


Remember the transistor
A 5V signal applied to the gate or base is enough to cause current
flow
Zero volts turns the signal off
Simply the AND gate
o A B Out
o 00
0
o 01
0
o 10
0
o 11
1
current/output only goes through if both A AND B are
on
Simply - The OR gate
o A B Out
o 00
0
o 01
1
o 10
1
o 11
1
current/output goes through if A or B are on
Simply The NOT gate
o Input
output
o
1
0

IEEE standard
Logic gates have been used for decades
We often need to represent complex relations between many gates
So, wed better draw them
Standard created in 1991
NOR gate
Only true if neither A nor B are ture
o Both A and B are false
o

AB
00

out
1

Wednesday September 30, 2015


Liam Collins (New TA)
Thursday 12:30-1:30
collins@cs.queensu.ca
Standard Distinctive Shapes (logic gates)
AND

You might also like