Coding & Computation or What s all this about 1s and 0s? File: coding-computation-slides.tex.

Similar documents
Chapter 101. Coding & Computation. Coding & Computation or What s all this about 1s and 0s? Topics

8/16/12. Computer Organization. Architecture. Computer Organization. Computer Basics

Computer Basics 1/24/13. Computer Organization. Computer systems consist of hardware and software.

Discussion. Why do we use Base 10?

Computer Basics 1/6/16. Computer Organization. Computer systems consist of hardware and software.

CMSC131. Hardware and Software. Hardware

CMSC131. Hardware and Software

Unit - II. Computer Concepts and C Programming 06CCP13. Unit II

INTRODUCTION TO COMPUTERS

C H A P T E R 1. Introduction to Computers and Programming

Bits, bytes, binary numbers, and the representation of information

Worksheet - Storing Data

Chapter 1: Introduction to Computers and Java

8/23/2014. Chapter Topics. Introduction. Java History. Why Program? Java Applications and Applets. Chapter 1: Introduction to Computers and Java

DATA PROCESSING Scheme of work for 2016 SS Three Extension Class

Variables and Data Representation

Memory Addressing, Binary, and Hexadecimal Review

3. WWW and HTTP. Fig.3.1 Architecture of WWW

Digital Fundamentals

Final Labs and Tutors

Introduction to Computers. Joslyn A. Smith

Chapter 3 DATA REPRESENTATION

The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Purpose of Chapter. External Representation of Information.

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Bits and Bytes and Numbers

Introduction to Numbering Systems

Review of HTML. Ch. 1

Lesson 5: Multimedia on the Web

OBJECTIVES After reading this chapter, the student should be able to:

CSC-105 Exam #1 October 10, 2013

IT 1204 Section 2.0. Data Representation and Arithmetic. 2009, University of Colombo School of Computing 1

umber Systems bit nibble byte word binary decimal

Software and Hardware

Survey Reading the Notes. COSC 122 Computer Fluency. Information Representation. Survey Class Still Easy? Key Points

COSC 122 Computer Fluency. Information Representation. Dr. Ramon Lawrence University of British Columbia Okanagan

Topic Notes: Bits and Bytes and Numbers

Full file at

Announcement. (CSC-3501) Lecture 3 (22 Jan 2008) Today, 1 st homework will be uploaded at our class website. Seung-Jong Park (Jay)

Lecture 1: What is a computer?

Chapter 2. Data Representation in Computer Systems

St. Benedict s High School. Computing Science. Software Design & Development. (Part 2 Computer Architecture) National 5

Digital Fundamentals

Course Schedule. CS 221 Computer Architecture. Week 3: Plan. I. Hexadecimals and Character Representations. Hexadecimal Representation

IBM 370 Basic Data Types

Homeschool Enrichment. The System Unit: Processing & Memory

User. Application program. Interfaces. Operating system. Hardware

Chapter 4: Computer Codes. In this chapter you will learn about:

Chapter 2: Computers: The Machines Behind Computing.

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

Common Technology Words and Definitions

1.1 Information representation

Digital Logic Lecture 4 Binary Codes

IT101. Characters: from ASCII to Unicode

LOGIC DESIGN. Dr. Mahmoud Abo_elfetouh

Topic Notes: Bits and Bytes and Numbers

Chapter 7. Representing Information Digitally

(Refer Slide Time: 00:23)

Notes on Turing s Theorem and Computability

Topics. Hardware and Software. Introduction. Main Memory. The CPU 9/21/2014. Introduction to Computers and Programming

CMPS 10 Introduction to Computer Science Lecture Notes

An Overview of the Computer System. Kafui A. Prebbie 24

Chapter 1: An Overview of Computers and Programming Languages. Objectives. Objectives (cont d.) Introduction

lesson 3 Transforming Data into Information

Processor: Faster and Faster

Binary Numbers. The Basics. Base 10 Number. What is a Number? = Binary Number Example. Binary Number Example

[301] Bits and Memory. Tyler Caraza-Harter

Lecture (03) Binary Codes Registers and Logic Gates

9/3/2015. Data Representation II. 2.4 Signed Integer Representation. 2.4 Signed Integer Representation

Lecture #3: Digital Music and Sound

Digital Computers and Machine Representation of Data

The Programming Process Summer 2010 Margaret Reid-Miller

Chapter 4 The Components of the System Unit

2nd Paragraph should make a point (could be an advantage or disadvantage) and explain the point fully giving an example where necessary.

Lecture (02) Operations on numbering systems

Parts are adapted from Windows 98 by Mark Twain Media, Inc. A Computer System has Hardware and Software

CSE COMPUTER USE: Fundamentals Test 1 Version D

3D printed heads let hackers and cops unlock your phone

COSC 243 (Computer Architecture)

Information Science 1

LING 388: Computers and Language. Lecture 5

Chapter 4 The Components of the System Unit

Java Oriented Object Programming II Files II - Binary I/O Lesson 3

Chapter 4: Data Representations

a- As a special case, if there is only one symbol, no bits are required to specify it.

(Refer Slide Time: 01:40)

Digital codes. Resources and methods for learning about these subjects (list a few here, in preparation for your research):

Express Yourself. The Great Divide

PHP and MySQL for Dynamic Web Sites. Intro Ed Crowley

Chapter 1: Introduction to Computer Science and Media Computation

JavaScript CS 4640 Programming Languages for Web Applications

Chapter 2. Prepared By: Humeyra Saracoglu

Inf2C - Computer Systems Lecture 2 Data Representation

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

GCSE Computer Science Component 02

CHAPTER 2 Data Representation in Computer Systems

Homework 1 graded and returned in class today. Solutions posted online. Request regrades by next class period. Question 10 treated as extra credit

CHAPTER 2 Data Representation in Computer Systems

CS Prof J.P.Morrison

COPYRIGHTED MATERIAL. An Introduction to Computers That Will Actually Help You in Life. Chapter 1. Memory: Not Exactly 0s and 1s. Memory Organization

What is Java Platform?

COMS 469: Interactive Media II

Transcription:

Coding & Computation or What s all this about 1s and 0s? File: coding-computation-slides.tex. 1

File: coding-computation-slides.tex. Created: January 28, 2001, sok. 1-1

Topics Aim: Communicate certain fundamental concepts about computers and computing. Relax. Digital encoding (Digital) computation Fundamental programming Applied programming 2

Digital encoding Digital discrete (Analog continuous) Encode = to put into or represent with a code Code a system of symbols... used for communication (Morse code, braille, one if by land,... ), for instructing computers (machine code), &c. Code are discrete: elements are in or out. Period. 3

Digital encoding: Examples of codes Written words: Bob, Carol, Ted, Alice Words stand for things, events, relations, etc. sentences, etc. Make up Letters of the alphabet What an idea! With a few letters, all the words; with a few thousand words, an infinite number of sentences. 4

Digital encoding: Examples of codes Morse code: Dots: Dashes: A J S B K T C L U D M V E N W F O X G P Y H Q Z I R (There s more for other symbols, e.g. Ä is ) 5

Digital encoding: Comments on Morse code How many elementary / primitive symbols? Answer: 2. Why? How many symbols do we need to cover the letters of the 26 letters of the alphabet? Answer: 2 1 + 2 2 +... + 2 n until > 26, i.e., n = 4. Note: Why not just 2 5? Why do the different letters have the symbol patterns they have? 6

Digital encoding: Examples of codes Braille: array of 3 2 = 6 dots, raised or not. Character codes in computing 1. ASCII (American Standard Code for Information Interchange) Standard in computing. See the IDT book. 2. EBCDIC: IBM mainframes 3. Unicode: For all the world. 7

ASCII Binary code: 1s and 0s. 7 or 8 bits (= binary digits) P is decimal 80 = 8 10 1 + 0 10 0 or in binary = 0 2 7 + 1 2 6 + 0 2 5 + 1 2 4 + 0 2 3 + 0 2 2 + 0 2 1 + 0 2 0 or 01010000 in 8-bit binary. 01010000 in 7-bit binary, with parity even. 11010000 in 7-bit binary, with parity odd. 8

Number coding systems Decimal (10-based) has 10 symbols possible per slot : 0, 1, 2,..., 9 Binary (2-based) has 2 symbols possible per slot : 0 and 1 Octal (8-based) has 8 symbols: 0, 1, 2, 3, 4, 5, 6, 7, and 8 Hexidecimal (16-based) has 16 symbols: 0, 1,..., 9, A, B, C, D, E, and F Number coding can be in any base: 2, 3,..., n. Why base 2 for computers? Why base 8, base 16? 9

Digital encoding. We encode from a list of atomic symbols (e.g., the alphabet) and compose more complex things by combining these symbols (e.g., words are composed of letters of the alphabet, sentences are composed of words). At the most abstract, general level, we can use numbers to be our atomic symbols (numerals, actually). So, e.g., P = 80 decimal = 01010000 binary in ASCII. Let dash ( ) = 0, dot ( ) = 1. Then in Morse code, P = 1001 binary 10

Digital encoding: Comments Conventionality (arbitrariness) Why not P = 1010111? etc. Generality Can one type of encoding encode everything that another type of encoding can encode? Does it matter whether we do decimal or binary? Why? (Prove it!) Wait: 01010000 is a (binary) number, yet it s an encoding of P. Which is it? How can you tell? Why isn t it ÄH in Morse code? Or a sound or a picture or a movie? 11

Digital computation... or a program instruction? Roughly, a computation is a manipulation and/or recognition of a digital encoding A computer is a machine that does computations, that manipulates, recognizes, and acts on digital encodings Our computers work on binary (1s and 0s) encodings. Why? 12

Digital computation Is that all? Can t some computers do more than others? Yes, that s possible. Size, speed, of course. Actually, just a few instructions are sufficient to compute all possible manipulations on binary digital encodings, and these are in turn fully general. An amazing fact. 13

Digital computation So, all real computers are fundamentally equivalent, just some are bigger and faster than others. What about interacting with the world? I/O as we say. Same thing, just hooked to I/O devices. Clarification: manipulations aren t just arithmetic; they re anything (on binary encodings). 14

Fundamental programming Computers run by executing program instructions, one after another. The program instructions instruct the computer to manipulate, recognize, and act upon digital (binary) encodings. How are program instructions represented to the computer? As binary encodings. What about the data used by the program? Same thing. How does it know? Basic cycle: (1) fetch the next instruction (from memory into the CPU), (2) execute the instruction, (3) figure out where the next instruction is and go to (1). 15

Applied programming Don t like them 1s and 0s (machine language) So, higher-level languages: metaphor Compiler: takes your higher-level jottings and translates them into machine language, so your program can be executed. Note: machine language programs are specific to the machine type you are running: Intel X, Intel Y, Macintosh, Sun, Alpha, IBM, etc. 16

Applied programming Interpreter: Accepts a compact semi-compiled (byte-code) version of your jottings and executes it by translating it on the fly to machine code and sending it off for execution. Visual Basic, Excel. Possibility: Interpreters for each type of mahcine (hardware), but all can then execute the same byte-code. Write once, run everywhere. Think of the Internet. And: Java. 17

Applied programming: On the Internet, etc. Where does/can code execute? On your PC (your client, whether Wintel, Mac, Linux, Unix,... ): Your browser (Internet Explorer, Netscape, Hot Metal,... ) On your PC: Spreadsheet programs, word processing programs,... 18

Where does code execute? (con t.) On the server: The Web server program that responds to requests from your browser and serves up files to you. On the server: Business programs that run in response to your inputs from your browser: shopping carts, billing, etc. (Think of buying something on the Web, or participating in an auction.) On the server: Business programs that create HTML pages and send them to you on the fly. PHP, ASP, JSP. 19

Where does code execute? (con t.) On your PC, via your browser: JavaScript, VBScript for graphics and animation (but primitively) On your PC, via your browser: ActiveX (Microsoft) and Java applets Downloaded in real time from the server! Why? Pluses? Minuses? Worries? 20

/* $Header: /home/sok/cvsrepos/misidtbook/coding-computation-slides.t