1 / 18

Introduction to Programming

Introduction to Programming. Hardware, Software, and Number Systems. David Goldschmidt, Ph.D. Computer Science The College of Saint Rose. wireless router. hard drive. system unit. power supply. motherboard (with CPU). video card. processor cooling fan. sound card. memory cards.

Download Presentation

Introduction to Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Programming Hardware, Software, andNumber Systems David Goldschmidt, Ph.D. Computer Science The College of Saint Rose

  2. wireless router hard drive system unit power supply motherboard (with CPU) video card processor cooling fan sound card memory cards Hardware

  3. Cool Hardware • Tablet PCs combine laptop and PDA features

  4. Cool Hardware • Docking stations…

  5. Operating Systems • System Software • Computer programs that directlycontrol the operations of thecomputer and its devices • Operating System • Coordinates and orchestrates all activitiesof the hardware devices in a computer • Provides a Graphical User Interface (GUI) forusers to interact with the computer

  6. Operating Systems • Microsoft Windows • Windows 2000, Windows XP,Windows XP Tablet PC,Windows Vista, Windows 7 • Macintosh • Mac OS v9.1, Mac OS X • Others • UNIX, Linux, etc.

  7. Hardware (a Closer Look)

  8. CPU ArithmeticLogicUnit e.g. addition, subtraction, logical AND, OR, NOT executes machine language programs Control Unit Memory Central Processing Unit (CPU) Instruction (input) Result (output)

  9. Main memory can be visualized as a column or row of cells. 0x000 A section of memory is called a byte. A byte is made up of 8 bits. 0x001 1 0 1 0 1 0 1 0 0x002 0x003 0x004 0x005 A section of two or four bytes is often called a word. 0x006 0x007 Memory

  10. LDA #47 STA $570 DEX JSR $817 CPX #0 BNE #14 Translation program (Assembler) 000101000011001010000100010010010101010101010010 Assembly language program Machine language program (executable file) Low-Level Languages

  11. 000101000011001010000100010010010101010101010010 C/C++ Compiler Machine language program (object “.obj” file) 000101000011001010000100010010010101010101010010 000101000011001010000100010010010101010101010010 C/C++ Linker Precompiled Libraries (e.g. iostream) Machine language program (executable “.exe” file) Compiling a C/C++ Program #include <iostream> int main() { float x; cout << “ ... C/C++ program

  12. The CPU’s control unit fetches, from main memory,the next instruction in the sequence of program instructions. Fetch The instruction is encoded in the form of a number. The control unit decodes the instruction and generates an electronic signal. Execute Decode The signal is routed to the appropriate component of the computer (such as the ALU, a disk drive, or some other device). The signal causes the component to perform an operation. Fetch-Decode-Execute Cycle • The CPU performs the fetch-decode-execute cycle to “run” program instructions

  13. Source code (.java) Saves Java statements Is read by Byte code(.class) Java compiler Produces Is interpreted by Program Execution Java Virtual Machine Results in Java Program Development Text editor

  14. 000101000011001010000100010010010101010101010010 Java Compiler Java byte code (“.class” file) Compiling a Java Program public class ex01 { double x; int y; ... Java program

  15. 000101000011001010000100010010010101010101010010 Java Virtual Machine Precompiled libraries (i.e. byte code) Executing a Java Program 000101000011001010000100010010010101010101010010 Java byte code (“.class” file)

  16. Numbering Systems • We count using our fingers.... • Base 10: • Computers count using binary digits or bits.... • Base 2: 006 000 001 003 004 005 002 007 008 009 011 012 013 010 00000110 00000111 00000000 00000001 00000010 00000011 00000100 00000101 00001000

  17. unsigned byte ranges from 0 to 255 128 64 32 16 8 4 2 1 base 10 value 1 1 0 1 1 0 0 1 64 16 8 1 + + + + Base Conversion • A byte is a grouping of 8 bits • Convert an unsigned binary number (11011001) to decimal (base 10): • What about negative integers? 128 = 217

  18. two’s complement byte ranges from -128 to 127 Two’s Complement • Conversion from binary to decimal is identical, except the leftmost bit always has a negative weight base 10 value = -39 + + + +

More Related