computer basics
play

Computer Basics and software. Hardware includes the tangible parts - PowerPoint PPT Presentation

Hello Hello World World Hardware and Software Computer systems consist of hardware Computer Basics and software. Hardware includes the tangible parts of computer systems. TOPICS Software includes programs - sets of


  1. Hello Hello World World Hardware and Software ▪ Computer systems consist of hardware Computer Basics and software. ▪ Hardware includes the tangible parts of computer systems. TOPICS ▪ Software includes programs - sets of • Computer instructions for the computer to follow. Organization • Data Representation ▪ Familiarity with hardware basics helps • Program Execution us understand software. • Computer Languages CS 160, Summer Semester 2016 2 Hello Hello World World Computer Organization Hardware ▪ The majority of modern computers have similar components including: ▪ Input devices (keyboard, mouse, etc.) ▪ Output devices (display screen, printer, etc.) ▪ Central Processing Unit (CPU) or processor ▪ Main and auxiliary (secondary) memory CS 160, Summer Semester 2016 3 CS 160, Summer Semester 2016 4

  2. Hello Hello World World Computer Architecture Processors ▪ The processor is also called the CPU (Central Processing Unit) ▪ Processes a relatively simple set of instructions. ▪ Programs must be translated into the specific instruction set. ▪ The power of computing comes from speed and program intricacy. CS 160, Summer Semester 2016 5 CS 160, Summer Semester 2016 6 Hello Hello World World Main memory Auxiliary Memory ▪ Working memory used to store ▪ Also called secondary memory ▪ set of instructions for current program ▪ Disk drives, optical drives (CD/DVD), ▪ data the program is using flash drives, etc. ▪ results of intermediate calculations ▪ More or less permanent (nonvolatile) ▪ Now measured in gigabytes ▪ Usually measured in gigabytes ▪ e.g. 8 gigabytes of RAM ▪ e.g. 512 gigabyte hard drive ▪ RAM is short for random access memory ▪ A byte is a quantity of memory CS 160, Summer Semester 2016 7 CS 160, Summer Semester 2016 8

  3. Hello Hello World World Data Representation Bits, Bytes and Words ■ Computers store data as binary numbers, not Bit : 0 or 1 decimal! ■ ■ Numbers can be used to represent almost any Byte : sequence of eight bits: 00101110 ■ type of data: Word : sequence of 2, 4 or 8 bytes ▪ Characters (e.g. ‘a’) are represented by numbers, ■ strings (e.g. “foo”) are just groups of characters To computer, everything is a sequence ■ ▪ Pictures are represented by dividing them into picture of bits! elements known as pixels ▪ Video images or animations are represented by If we have 4 bits, how many things can ■ placing several pictures one after another we represent? ▪ Sounds are represented by sampling the pressure wave at regular intervals CS 160, Summer Semester 2016 9 CS 160, Summer Semester 2016 10 Hello Hello World World Bit Permutations Main Memory 1 bit 2 bits 3 bits 4 bits 0 00 000 0000 1000 1 01 001 0001 1001 10 010 0010 1010 11 011 0011 1011 100 0100 1100 101 0101 1101 110 0110 1110 111 0111 1111 Each additional bit doubles the number of possible permutations. CS 160, Summer Semester 2016 11 CS 160, Summer Semester 2016 12

  4. Hello Hello World Bit Permutations World Positional Representation ■ Each permutation can represent a particular item ■ Decimal number representation: ■ What does 256 mean? ■ There are 2 N permutations of N bits 2 * 100 + 5 * 10 + 6 ■ N bits are needed to represent 2 N unique items 2 * 10 2 + 5 * 10 1 + 6 * 10 0 2 1 = 2 items ■ Binary number representation: 1 bit ? How many ■ What does 10010 mean? 2 2 = 4 items 2 bits ? items can be 2 3 = 8 items 1 * 2 4 + 0 * 2 3 + 0 * 2 2 + 1 * 2 1 + 0 * 2 0 3 bits ? represented by 1 * 16 + 0 * 8 + 0 * 4 + 1 * 2 + 0 * 0 = 18 2 4 = 16 items 4 bits ? ■ Let’s count 0 to 15 in binary. 2 5 = 32 items 5 bits ? ■ Add 1 each time, carry just like in base 10 How many items can be represented by 8 bits? 16 bits? 32 bits? 64 bits? CS 160, Summer Semester 2016 13 CS 160, Summer Semester 2016 14 Hello Hello World World Text Representation ASCII ■ Remember to a computer everything is stored in a binary format ■ Need to convert from characters (what is on a keyboard) to bit representation ■ ASCII: 7 bit mapping in one byte, ■ Each character maps to different value, ■ A decimal digit is also a character and has a mapping, e.g., ‘0’ is 00110000 (48 in decimal). CS 160, Summer Semester 2016 15 CS 160, Summer Semester 2016 16

  5. Hello Hello World World Pixels Pixels ■ Everything is stored as 0’s and 1’s ■ Pictures are reduced to rectangles, or pixels CS 160, Summer Semester 2016 17 CS 160, Summer Semester 2016 18 Hello Hello World World Animation Sound/Audio CS 160, Summer Semester 2016 19 CS 160, Summer Semester 2016 20

  6. Hello Hello World World Analog to Digital Conversion Files ▪ Large groups of bytes in auxiliary memory are called files. ▪ Files have names and extensions, managed by operating system. ▪ Files are organized into groups called directories or folders. ▪ Java programs are stored in files, and are copied to memory before running. CS 160, Summer Semester 2016 21 CS 160, Summer Semester 2016 22 Hello Hello World World The Operating System Computer Languages ■ Low-Level Languages ▪ The operating system is a supervisory ■ Machine Code program that: ■ Assembly Code ■ High-Level Languages ▪ oversees the operation of the computer ■ Fortran ▪ controls resources such as disk drives ■ COBOL, BASIC ■ Pascal, C, ▪ retrieves and starts program for you ■ C++, Java ▪ Well-known operating systems: ■ Perl, Python ■ R, Matlab ▪ Microsoft Windows, Apple Mac OS, Linux, ■ Interpretation versus Compilation and UNIX. ■ Visual Languages CS 160, Summer Semester 2016 23 CS 160, Summer Semester 2016 24

  7. Hello Hello World World Programming Languages Compilers ▪ A compiler translates a program from a ▪ High-level languages are relatively high-level language to a low-level easy to use for the programmer: language that the computer can run. ▪ Java, C#, C++, Python, Ruby, etc. ▪ You compile a program by running the ▪ Low-level languages are very complex compiler on the source code of the and error prone, but computers don’t high-level program. understand high-level languages! ▪ Compilers produce machine or ▪ High-level language programs must be assembly-language programs called translated into low-level languages. object programs. CS 160, Summer Semester 2016 25 CS 160, Summer Semester 2016 26 Hello Hello World World Java Byte-Code Java Byte-Code ▪ The Java compiler doesn’t translate a ▪ A byte-code program is easy to Java program into assembly or translate into machine language for any machine language for a particular particular computer, this can be done computer. ‘on-the-fly’. ▪ Instead, it translates a Java program ▪ A program called an interpreter into byte-code. translates each byte-code instruction, ▪ Byte-code is the machine language for a executing the resulting machine- hypothetical computer (or interpreter) language. called the Java Virtual Machine. CS 160, Summer Semester 2016 27 CS 160, Summer Semester 2016 28

  8. Hello Hello World World Compiling, Interpreting, Running Portability ▪ Use the compiler to translate the Java ▪ After compiling a Java program into program into byte-code (done using the byte-code, the byte-code can be used javac command). on any computer with a byte-code interpreter without recompiling. ▪ Use the Java virtual machine for your computer to translate each byte-code ▪ Byte-code can be sent over the Internet instruction into machine language. and used anywhere in the world, this makes Java highly portable and thus ▪ Eclipse tool makes all this very easy! suitable for Internet applications. CS 160, Summer Semester 2016 29 CS 160, Summer Semester 2016 30 Hello Hello World World Running a Program Running a program another view word in 1. First the program and all its data are copied from the hard disk into main memory. 2. The CPU goes to the location of the program instruction and reads that word. 3. The CPU determines what action is requested by decoding its bit pattern representation. 4. The CPU performs the action, usually a math operation or memory read/write. 5. The CPU moves to the location of the next program instruction in memory and repeats the process. CS 160, Summer Semester 2016 31 CS 160, Summer Semester 2016 32

  9. Hello Hello World World Instruction Execution Model Instructions ■ CPU ■ Format: <operation, operand, operand> ■ Instruction cycle ■ Operations ■ Fetch instruction from main ■ Arithmetic & logical memory ■ Data movement ■ Decode instruction ■ Control ■ Fetch operands ■ Operands: locations of data and instructions ■ Execute instruction ■ Examples: ■ Store operands ■ Add reg1 reg2 ■ Determine the next ■ Move reg1 010010100101001010010100 instruction to execute ■ Goto 110101110101110101110101 CS 160, Summer Semester 2016 33 CS 160, Summer Semester 2016 34

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend