An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

Similar documents
An Introduc+on to Computers and Java CSC 121 Spring 2017 Howard Rosenthal

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

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

IB Computer Science Topic.2-

Pharmacy college.. Assist.Prof. Dr. Abdullah A. Abdullah

Chapter 1: Introduction to Computers and Programming

Microprocessors I MICROCOMPUTERS AND MICROPROCESSORS

CC411: Introduction To Microprocessors

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

Computer Principles and Components 1

Memory Addressing, Binary, and Hexadecimal Review

Chapter 3: Operating-System Structures

CS 101, Mock Computer Architecture

HARDWARE. There are a number of factors that effect the speed of the processor. Explain how these factors affect the speed of the computer s CPU.

Dec Hex Bin ORG ; ZERO. Introduction To Computing

machine cycle, the CPU: (a) Fetches an instruction, (b) Decodes the instruction, (c) Executes the instruction, and (d) Stores the result.

Computer Fundamentals

Computer Fundamentals

OS and Computer Architecture. Chapter 3: Operating-System Structures. Common System Components. Process Management

! Learn how to think like a computer scientist. ! Learn problem solving. ! Read and write code. ! Understand object oriented programming

Week 0: Intro to Computers and Programming. 1.1 Why Program? 1.2 Computer Systems: Hardware and Software. Hardware Components

Chapter 1: Why Program? Main Hardware Component Categories 8/23/2014. Main Hardware Component Categories: Why Program?

Explain the functions of the main components of a basic computer system (Part 2) S. Neebar

The x86 Microprocessors. Introduction. The 80x86 Microprocessors. 1.1 Assembly Language

Chapter 3: Operating-System Structures

Digital Systems. John SUM Institute of Technology Management National Chung Hsing University Taichung, ROC. December 6, 2012

The Programming Process Summer 2010 Margaret Reid-Miller

Chapter One. Introduction to Computer System

Chapter 1 Introduction to Computers and Programming

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

Chapter 3: Operating-System Structures

INTRODUCTION TO COMPUTERS

TUTORIAL Describe the circumstances that would prompt you to use a microprocessorbased design solution instead of a hard-wired IC logic design.

User. Application program. Interfaces. Operating system. Hardware

Computers Are Your Future

THE MICROCOMPUTER SYSTEM CHAPTER - 2

Lecture 01: Basic Structure of Computers

Diskrečioji matematika

Introduction to Java Programming

Chapter Two. Hardware Basics: Inside the Box

CHAPTER 1 Introduction to Computers and Java

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

Computer Organization and Programming

Last class: OS and Architecture. OS and Computer Architecture

Last class: OS and Architecture. Chapter 3: Operating-System Structures. OS and Computer Architecture. Common System Components

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

Expressions and Data Types CSC 121 Spring 2015 Howard Rosenthal

Operating-System Structures

PDF created with pdffactory Pro trial version How Computer Memory Works by Jeff Tyson. Introduction to How Computer Memory Works

Computer is an electronic machine that can receive, store, transform and output data of all kinds (image, text, numeric, graphics and sound).

lesson 3 Transforming Data into Information

N.B. These pastpapers may rely on the knowledge gained from the previous chapters.

INTRODUCTION TO INFORMATION & COMMUNICATION TECHNOLOGY (ICT) LECTURE 2 : WEEK 2 CSC-111-T

Computers Are Your Future

A computer is an electronic device, operating under the control of instructions stored in its own memory unit.

Segment 1A. Introduction to Microcomputer and Microprocessor

Programming 1 - Honors

Chapter 9: A Closer Look at System Hardware

Chapter 2: Computers: The Machines Behind Computing.

System Unit. By: Khadeeja Farkash

Chapter 9: A Closer Look at System Hardware 4

CS150 Introduction to Computer Science 1. What is CS150? Who Are We? CS150 is a programming course You will learn

Module 3: Operating-System Structures. Common System Components

Computer chip: A very small pieces of silicon or other semi-conducting material onto which integrated circuits are embedded Circuit board: A thin

What is the typical configuration of a computer sold today? 1-1

(Refer Slide Time 00:01:09)

Programming 1. Lecture 1 COP 3014 Fall August 28, 2017

About the Presentations

OS And Hardware. Computer Hardware Review PROCESSORS. CPU Registers. CPU Registers 02/04/2013

BITG 1113: Introduction To Computers And Programming Language LECTURE 1 LECTURE 1 1

Homeschool Enrichment. The System Unit: Processing & Memory

Memory Study Material

Module 3: Operating-System Structures

COMPUTER ORGANIZATION AND ARCHITECTURE

Chapter 1 INTRODUCTION

5 Computer Organization

Expressions and Data Types CSC 121 Fall 2015 Howard Rosenthal

CSc 10200! Introduction to Computing. Lecture 1 Edgardo Molina Fall 2013 City College of New York

CSC-105 Exam #1 October 10, 2013

Downloaded From :

- Input hardware - Processing hardware - Storage hardware

v.m.g.rajasekaran ramani sri sarada sakthi mat. Hr. sec. school

CMSC 1513 Lecture 1.2

Introduction. Arizona State University 1

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

COMPUTER SYSTEM. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U. COMPUTER SYSTEM IB DP Computer science Standard Level ICS3U

Computer Systems. Binary Representation. Binary Representation. Logical Computation: Boolean Algebra

OPERATING SYSTEMS UNIT - 1

Q1. Describe C.P.U and its subunits with the help of diagram?

Computer Architecture 2/26/01 Lecture #

Operating-System Structures

1.1 Information representation

National 5 Computing Science Software Design & Development

A+ Guide to Hardware: Managing, Maintaining, and Troubleshooting, 5e. Chapter 1 Introducing Hardware

Elements of Computers and Programming Dr. William C. Bulko. What is a Computer?

Technology in Action

NETW3005 Operating Systems Lecture 1: Introduction and history of O/Ss

ZONAL EDUCATION OFFICE - JAFFNA

Introduction to Computers. Joslyn A. Smith

Transcription:

An Introduction to Computers and Java CSC 121 Spring 2015 Howard Rosenthal

Lesson Goals Learn the basic terminology of a computer system Understand the basics of high level languages, including java Understand algorithms Understand how characters and numbers are represented in a computer 2

What Is A Computer? Basic Definitions A computer is a machine that performs computations, logical operations, data manipulation, etc. according to some sequence of constructions called a program. Today pretty much all computers are electronic. Hardware and software working in tandem comprise a computer system Can you name some examples of computers. 3

The Rapid Evolution of Computers Essentially the computer industry, much like television, took off after WWII transistors and integrated circuits didn t exist Into the 1970s most computing involved having a textual workstation connected to a close by computer once you got past the age of punch cards In the 1980 s the head of an extremely successful computer company Digital stated that he saw no need for anyone to have a computer in their home At the start of 1990 s PCs stood alone no networking to the home During the 1990 s Seinfeld episodes featured George waiting for a phone booth. In the late 1990s Best Buy still had a large CD section! Google only started in 1995! Today we are completely integrated into a computerized, networked world. We do our research, make purchases, talk on the phone, text incessantly. All because of computers. See the timelines and history of computer in the reference files Bottom line This is a great field to be in a good job and excellent pay awaits those who succeed 4

The Basic Components of A Computer (1) The four basic elements of a computer are: The CPU Primary or random access memory Secondary or long term memory Note: some of these devices are becoming closer to RAM devices as they are built with solid state circuitry and electro mechanical parts more like RAM Input and output devices disks printers, etc. 5

The Basic Components of A Computer (2) 6

The Basic Components of A Computer (3) 7

The CPU The CPU The CPU Control Unit The CU takes the instructions, interprets them, and decides how to handle them. It determines what all the other parts of the CPU do. It is basically the Coordinator for everything that happens in the CPU. It contains the instruction Registers, and program counter Arithmetic Logic Unit - This is where all the calculations are actually performed. The Arithmetic part is where all the operations like ADD, Subtract, Multiply, and Divide take place. In the Logic part, is where numbers are Compared through functions such as Equal-to, Less-Than, greater-than, Not equal to. The CPU's General purpose Registers and Accumulator are also found here. The Clock synchronizes all the activities in the CPU 8

The Memory Memory Unit - The parts that make up the Memory Unit are the read only memory (ROM) and random access memory (RAM). ROM is a special type of memory in which data is written onto a chip during manufacturing. Information stored to ROM is permanent and cannot be changed. The System ROM stores the BIOS - Basic Input/Output System, which is the set of instructions that a computer uses during the first stages of power up and initialization. Without the BIOS, the computer would not have a way to verify that the main hardware components, such as the hard drive, floppy drive, mouse, CD-ROM etc., are installed and working properly. The BIOS also includes Bootstrapping, allowing the BIOS to look for and start the loading of the operating system from the selected location. RAM, often referred to as main memory, or Primary Memory or Read-Write Memory is a temporary form of memory that the computer uses as a work area. This type of memory is dynamic, meaning that it is constantly changing because of the activity of the CPU. When you shut off the power to the computer, RAM loses everything stored in it the memory is volatile. RAM stores program instructions and related data for the CPU to access quickly without the need for extracting the data from a much slower form of memory, such as the Hard Disk. Generally, The Closer the Memory is to the CPU's ALU and CU, the faster the memory will be. As a result, it will be the most expensive, and the most limited type of memory in terms of availability and size 9

Input and Output Input - Basically where information is passed to the CPU. This is from devices like Keyboard, mice, etc. Output - Basically where information is presented from the CPU. This is from devices like your Monitor, Printers, etc. Storage - Where the information is kept and stored. For the most part, it is connected to the Memory Unit. There are many levels and types of storage, some of which are parts of memory. A nice summary from the net: http://www.emperorshammer.org/notes.php?id=121 10

How is Data Stored In A Computer Computers today store information in binary format with 0 s and 1 s that correspond to off and on this is currently the easiest way to build a digital computer. Each binary digit is called a bit. A string of 8 bits is typically called a byte. Bytes are typically organized into 32 bit words. The byte is the lowest addressable unit of information in a computer. 11

Where Is Data Stored In A Computer Data is stored by memory addresses We often deal with the addresses, known as references, rather than with the data itself Memory Address Memory Contents 000 00001001 (9) 001 00010001 (17) 010 01111111 (127) 011 100 101 00100100 (36) 110 111 12

Basic Concepts In Computer Software Operating System Software that controls all aspects of the computer DOS, Windows, MAC OS, UNIX, etc. Machine Language expressed in 0 s and 1 s. This is what the machine understands. A long time ago programmers coded in 0 s and 1 s. It was very hard to write complex programs. Higher Level Languages Used to write programs in a more understandable form. Compilers Compilers translate source code written in a programming language into machine language. Compilers are not machine independent. Therefore the source code may also need to be tailored based on the capabilities of the targeted machines. And the output of the compiler was also machine specific Layered Architectures An approach that allows application programmers to take advantage of software written by others i.e. IO drivers, databases, user interfaces, etc. in order to make the life of the application writer easier 13

A Layered Computer Architecture 14

Syntax and Semantics Languages have a syntax its grammatical structure - and its semantics - which give it meaning syntax... is the study of the principles and rules for constructing sentences in natural languages. Semantics... is the study of meaning. It focuses on the relation between signifiers, such as words, phrases, signs and symbols, and what they stand for Can you write programs that are syntactically correct and yet work incorrectly? Examples I am a boy. grammatically correct and means something I boy. syntactically incorrect but does convey meaning I am a building. Syntactically correct but is meaningless. Syntax varies by language. We need to learn the syntax of the computer language since the computer is not all that adaptable (unless we write programs to teach them that adaptability). 15

Algorithms An algorithm is a step by step procedure for accomplishing a task or solving a problem All computer programs require the use of algorithms A simple algorithm find the greatest of three numbers A complex algorithm find the shortest route between two points on a map 16

Java Is Machine Independent JAVA solves the problems of machine dependence. JAVA standardizes the language and the compiler, which creates Bytecode a form of binary representation. The Bytecode is then presented to a Java Virtual machine which interprets bytecode exactly the same way regardless of the machine. This is called Machine Independence. The Bytecode is the machine language of the JVM 17

What Is The Binary System? In the normal decimal system each place indicates a different power of ten. For example: 13,472 = 1x10 4 + 3x10 3 + 4x10 2 +7x10 1 +2x10 0 Similarly in base 2 arithmetic each place has a value associated with it: One s place = 2 0 Two s place = 2 1 Fours place = 2 2 Eights place = 2 3 Sixteen s place = 2 4 So let s try a few examples with eight bits: 1 = 00000001 = 1x2 o 3 = 00000011 = 1x2 1 + 1x2 0 4 = 00000100 = 1x2 2 Now try a few on your own write 9 and 14 in binary format 18

Adding and Subtracting in Binary It s the same as normal adding and subtracting in the decimal system but you only use o s and 1 s 00100110 = 38 + 00110111 = 55 01011101 = 93 01101100 = 108-00010101 = 21 01010111= 87 19

Converting From Decimal To Binary Successive division is used to convert from decimal to binary Example convert 14 to binary 14/2 = 7 r0 7/2 = 3 r1 3/2 = 1 r1 ½ = 0 r 1 1110 = 14 Try using this algorithm to find the binary value for 47 20

Expressing Negative Numbers Java uses a method called two s complement to express negative numbers. Most computers use two s complement because the logic for adding is much easier Great example- http://stackoverflow.com/questions/6853524/why-twos-complement If the left most bit is negative it means that you are looking a negative number There is a three step algorithm to create a negative binary representation Step 1 write the decimal number as a positive binary number Step 2 toggle all the digits Step 3 add 1 So lets look at the 8 bit representation of -95 Step 1: 95 = 01011111 Step 2: Toggle: 10100000 Step 3: Add 1: 10100001 Note the 1 in the leftmost bit Another approach the two s complement of a number x is 2 n -x In the example above 128-95 = 33 which is what the right most 7 bits equals Some explanations use n= 8 and show that 256-95 = 161. That is the value of all 8 digits Question How large an integer do you think you can store in 8 bit integer if negatives are represented with a two s complement 2 8-1 or 01111111 See the two s complement tutorial under Reference Material - Twos Complement Tutorial.pdf 21

Unicode Unicode is a way of representing individual characters It actually uses two bytes per character, unlike the ASCII system which uses a single byte ASCII representation with extra zeroes to the left are used in Unicode Unicode allows us to represent many more characters 2 15 as opposed to 2 7 Unicode includes ASCII characters as a subset the first 128 characters are the same 22

Original ASCII TABLE 23

UNICODE Options To see what unicode gives you go to this site: http://www.unicodetables.com 24