Introduction to Computers and Programming

Slides:



Advertisements
Similar presentations
Lecture 1: Intro to Computers Yoni Fridman 6/28/01 6/28/01.
Advertisements

Introduction to Computers
ICS 102 Computer Programming University of Hail College of Computer Science & Engineering Computer Science and Software Engineering Department.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
ICAICT101A Operate a Personal Computer. A computer is an electronic device that allows you to process and store data (information)… 2.
COMP Computer Basics Yi Hong May 13, 2015.
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
The Computer Systems By : Prabir Nandi Computer Instructor KV Lumding.
©Silberschatz, Korth and Sudarshan1.1 Chapter 1: Introduction to Computers and Java Objects Background information  hardware  software  computer languages.
Windows XP Basics By Jane Maringer-Cantu CSIS 572.
Introduction to Computers
Introduction to Computers
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
1 Introduction to Computers Lect 1 Won’t tell you much you don’t know. (Misleading– the course gets more conceptual as we create webpages.) Will go into.
What is a Computer? An, electrical machine, that can be programmed to accept data (input), process it into useful information (output) and store it away.
Computer Parts. Two Basic Parts Hardware & Software.
COMPUTER TECHNOLOGY MRS. SEALE COMPUTER PERFORMANCE.
Introduction to Computer Systems and the Java Programming Language.
Mrs. Ulshafer August, 2013 Java Programming Chapter 1.
School of Computer Science & Information Technology G6DICP Introduction to Computer Programming Milena Radenkovic.
© 2006 Pearson Education Chapter 1: Computer Systems.
The Computer System CS 103: Computers and Application Software.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Computer Systems. Bits Computers represent information as patterns of bits A bit (binary digit) is either 0 or 1 –binary  “two states” true and false,
Computer and Programming. Computer Basics: Outline Hardware and Memory Programs Programming Languages and Compilers.
1 Introduction to Computers Prof. Sokol Computer and Information Science Brooklyn College.
Introduction To Computer Programming – 1A Computer Parts, Words, and Definition Herriman High School.
Chapter 1Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 1 l Background information »important regardless of programming.
Introduction to Programming. Key terms  CPU  I/O Devices  Main memory  Secondary memory  Operating system  User interface  Application  GUI 
Information Technology (IT). Information Technology – technology used to create, store, exchange, and use information in its various forms (business data,
Computer Graphics HARDWARE. Computers  Computers are automatic, electronic machines that –accept data & instructions from a user (INPUT) –store the data.
Chapter 1: Introduction to Computers and Programming
Computer Basics Computer system: hardware + software
Computer Architecture and Number Systems
Introduction to Computers
Java Programming: From the Ground Up
BASIC PROGRAMMING C SCP1103 (02)
An Overview of the Computer System
Chapter 1: An Overview of Computers and Programming Languages
Topics Introduction Hardware and Software How Computers Store Data
Programming Language Hierarchy, Phases of a Java Program
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
An Introduction to The computer.
Computer Hardware and Software
What is Binary? Binary is a two-digit (Base-2) numerical system, which computers use to process and store data. The reason computers use the binary system.
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Introduction to Computers and Java
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
Introduction to Computers
An Introduction to The computer.
Looking Inside the machine (Types of hardware, CPU, Memory)
Chapter 1: Introduction to Computers and Programming
An Overview of the Computer System
An Overview of the Computer System
Computer Science I CSC 135.
Introduction to Computers
Topics Introduction Hardware and Software How Computers Store Data
Chapter 3 Hardware and software 1.
Computer Hardware.
National Diploma in Computer Studies
Chapter 3 Hardware and software 1.
From Problems to Algorithms to Programs
Computing Essentials Module 1.
Computing Essentials Module 1.
ICS103 Programming in C 1: Overview of Computers And Programming
Computer components.
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

Introduction to Computers and Programming Hardware Software Computer languages Compiling, interpreting and assembling

Computer Basics A computer system consists of both hardware and software. Hardware - the physical components Software - the instructions, or rather, computer programs, that tell the hardware what to do

Common Hardware Components Memory Processor (CPU) Input Devices (such as mouse and keyboard) Output Devices (such as video display or printer) Processor: Central Processing Unit (CPU) interprets and executes program instructions Memory: volatile and non-volatile holds data and instructions Input devices: keyboard, mouse, touch-screen game controllers sensors Output device(s) video display, printer robotic devices

Classification of Memory At a high-level there are two types of memory: Volatile – contents are lost when power is turned off: Main memory (stores programs and data during execution) Cache memory Fastest and most expensive form of memory, per byte Non-Volatile – contents are maintained when power is turned off: Hard drive (internal or external, stores programs and data permanently) CD, DVD Flash drive, floppy disk Tape (still used extensively) Slowest and cheapest form of memory, per byte

Memory Organization Bit = one binary digit, either 0 or 1 Byte = 8 bits Word = machine dependant, typically 4 bytes Larger groupings: (number of bytes) name approximation exact Kilobyte (KB) 2^10 10^3 Megabyte (MB) 2^20 10^6 Gigabyte (GB) 2^30 10^9 Terabytes (TB) 2^40 10^12 Petabyte (PB) 2^50 10^15 Exabyte (EB) 2^60 10^18 Zetabyte (ZB) 2^70 10^21 Yottabyte (YB) 2^80 10^24

Binary Encodings Everything in memory is “encoded” in binary, i.e., as a sequence of bits. “A” => 1000001 45 => 101101 “DOG” => 01000100 01001111 01000111 Generally, the encoding of an object is unique among all similar objects, e.g., the encoding of “A” is different from the encoding of “B.” How many binary sequences are there on n bits? How many bits are needed to uniquely encode k items?

Main Memory Organization A list of locations, each containing one byte of data. Each location has an associated “number,” which is commonly referred to as its’ address. Is said to be byte addressable. Also called Random Access Memory (RAM). The number of bytes per data item may vary from one item to another, and from one computer system to another. Integer => 4 bytes (1 word) Character => 1 or 2 bytes

Running (Executing) a Program A (computer) program is a set of instructions for a computer to follow, or rather, execute. The term application is sometimes used to informally refer to a computer program (we will use the term more formally later). Program Computer Data (input for the program) Output

Many Types of Programs System Software - Part of the computers “infrastructure,” and necessary for the system to operate: Operating Systems - DOS, Microsoft Windows, MacOS, Linux, UNIX, etc. Database Systems – Oracle, IBM DB2, SQL Server, Access Networking Software Web Servers Application Servers User Applications - Not required for the system to operate: Games Office Applications – Word, Powerpoint, Excel Web Browsers Text Editors – textedit, vi, emacs, notepad

Various Types of User Interfaces Graphical User Interface (GUI) Windows, menus, buttons, sliders, etc. MacOS, Windows Sometimes also called “event-driven” interfaces First developed by Xerox Corporation Command-Line: User types in commands one line at a time DOS (Start -> run -> cmd) Unix xterm Application Program Interface (API) Allows one program to communication, interact or “interface” with another, or with some external, physical device. ODBC, JDBC, Swing, AWT

Programming Language Hierarchy Programs are written, or coded, in a programming language. There are many different types of programming languages. Machine Language Assembly Language High-Level Language

High-Level Languages High-Level Language (HLL): Java, C, C++, C#, COBOL, FORTRAN, BASIC, Lisp, Ada, etc. closest to natural language words, numbers, and math symbols multi-line statements/commands relatively easy for people to read (it’s for people) not directly understood by hardware “portable” (hardware independent) A program in a HLL is frequently referred to as: a source program source code source file source

High-Level Language Example (Java) public class SimpleProgram { public static void main(String[] args) System.out.println(“Hello out there.”); System.out.println(“I will add two numbers for you.”); int x; double d; x = 3752; d = 3.14156; System.out.println(“The sum of ” + x + “ and ” + d + “ is:”); System.out.println(x + d); }

Machine Languages Machine Language (lowest level): just 0s and 1s single-line commands very difficult for humans to read directly understood by hardware not portable (hardware dependent) A program in machine language is frequently referred to as: an object program object code executable program executable code executable

Machine Language Example 000000 000001 000010 000110 100000 100011 000011 001000 000100 :

Assembly Languages Assembly Language: a more readable version of machine language (also for people) words, abbreviations, letters and numbers replace 0s and 1s single-line statements/commands easily translated to machine executable code like machine code, not portable (hardware dependent) So, if we already have HLLs for people, why do we need assembly language? compilation results in a loss of meaning…sort of control over the resulting machine code

Assembly Language Example PUSH DX MOV AH 08 INT 21 CMP AL 30 JB 0203 CMP AL 46 JA 0203 CMP AL 39 JA 021B MOV AH 02 MOV DL AL SUB AL 30 POP DX RET CMP AL 41 SUB AL 37

Getting from Source to Machine Code Translating a program in a high-level language to machine code is called compiling. A program that compiles programs is called a compiler. A program that translates an assembly language program into machine code is called an assembler. Compilers and assemblers need to know the specific target hardware. There is, however, one additional type of translation called interpreting…

Compilers vs. Assemblers vs. Interpreters Compilers and Assemblers: translation is a separate user step from execution entire source program is translated before execution sometimes said to be “off-line,” i.e. not at run time Interpreters: (another way to translate source to object code) translation is not a separate user step from execution translation and execution occur “line at a time” sometimes said to be “on-line,” i.e. at run time The difference between compiling (or assembling) and interpreting a computer program, is analogous to the difference between translating a book, and interpreting a speaker.

Java Program Translation Executing a java program involves both compilation and interpretation. Java Program Translation & Execution: Step #1: A java program is compiled; this produces a program in byte code. Similar to assembly code, but hardware independent. Step #2: An interpreter, called the Java Virtual Machine (JVM) translates the byte code program to hardware-specific machine code, and executes it. Execution is done in an interpretive manner Question: Why not compile directly to machine code, rather than byte code? Answer: To make a long story short, portability over the internet.

Java Program Translation Including Linker Oh, and, one other part of the translation process is linking… Java Program Previously Compiled Helper Programs Java Compiler Byte-Code Program Byte-Code Interpreter Machine-Language Instructions Class Loader (i.e., Linker) Computer Execution of Machine-Language Instructions