1 / 24

Topic 1: Introduction to Computers and Programming

Topic 1: Introduction to Computers and Programming. “ A journey of a thousand miles must begin with a single step.” - Lao Tzu. Introduction to Computer Organization. Computers are composed of two distinct components:

tomai
Download Presentation

Topic 1: Introduction to Computers and 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. Topic 1: Introduction to Computers and Programming “A journey of a thousand miles must begin with a single step.” - Lao Tzu

  2. Introduction to Computer Organization • Computers are composed of two distinct components: • Hardware – the equipment used to perform computations. This includes the CPU, memory, hard disk, etc… • Software – the programs that determine the operations to be performed by the hardware. CISC 105 – Topic 1

  3. Hardware Components • Hardware consists of many types of components: • Primary Storage • Secondary Storage • The Central Processing Unit (CPU) • Input Devices • Output Devices CISC 105 – Topic 1

  4. Primary Storage andSecondary Storage • There are two primary types of storage in a computer: • Primary Storage – often referred to as main memory, or just memory. This storage is very quickly accessed by the various hardware components. • Secondary Storage – includes such devices as a hard disk, floppy disk, CD-ROM, DVD-ROM, etc… CISC 105 – Topic 1

  5. Memory Organization • Computer memory is organized into memory cells. Each cell has a unique address, which allows the accessing of each cell individually. • Programs are transferred from secondary storage into primary storage before they can be run. CISC 105 – Topic 1

  6. The Central Processing Unit (CPU) • The CPU is responsible for coordinating all computer operations and performing the operations specified in a program. • The CPU fetches an instruction from a program loaded in memory, decodes the instruction, retrieves necessary data, performs the operation, and then saves the result. • The CPU contains very high speed memory cells termed registers, which holds the data being operated on. CISC 105 – Topic 1

  7. Input and Output Devices • Input devices are used to communicate from some external source to the computer. They include the keyboard and the mouse. • Output devices are used to communicate from the computer to some external source. They include the monitor and the printer. CISC 105 – Topic 1

  8. Computer Software • All major computers run an operating system. • An operating system is a special type of program which controls the interaction between all hardware components and the user. CISC 105 – Topic 1

  9. Operating Systems Tasks • Responsibilities of the OS include: • Communicating with the user(s) • Managing resources including memory and processor time among programs • Collecting data from input devices • Providing data to output devices • Accessing data from secondary storage • Writing data to secondary storage CISC 105 – Topic 1

  10. Binary Math A binary digit or bit for short is the smallest unit of computer information. Just as our familiar decimal number system has 10 digits,(0,1,2,3,4,5,6,7,8,9) the binary number system has only 2 digits (0,1). This is the perfect number system for computers since we can store a binary digit by making an electrical or magnetic field either on or off, positive or negative, 1 or 0. In the decimal system we can count 10 (we start counting with 0) items with one decimal place, 100 with two decimal places, 1000 with three decimal places and so on. CISC 105 – Topic 1

  11. Binary Math The binary number system works the same way except since we only have 0s and1s our base is 2. So we can count 2 permutations of 1 bit: 0 1 4 permutations of 2 bits: 00 01 10 11 8 permutations of 3 bits: 000 001 010 011 100 101 110 111 16 permutations of 4 bits: 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 ...and so on. CISC 105 – Topic 1

  12. Binary Math So in an eight bit byte, the numbers are represented this way: Bit: - - - - - - - - Value: 128 64 32 16 8 4 2 1 Example: 1 0 1 1 0 1 1 0 Values: 128 + 0 + 32 +16 + 0 + 4 + 2 + 0 = 182 The minimum number is 0 (all 0s) and the maximum number is 255 (all 1s), so you can represent 256 numbers (0-255) with one byte. CISC 105 – Topic 1

  13. Computer Programming - Machine Language • Computer programs were originally written in machine language. Machine language is a sequence of binary numbers, each number being an instruction. • Each instruction is computer-understandable. 00000000 00010101 00010110 CISC 105 – Topic 1

  14. Computer Programming - Assembly Language • To make machine language more abstract, assembly language was introduced. • Assembly language provides a one-to-one mapping between a machine instruction and a simple human-readable instruction. CLR A ADD A ADD B 00000000 00010101 00010110 CISC 105 – Topic 1

  15. Computer Programming – Assembly Language • Assembly language is converted to computer-understandable machine language by an assembler. • Although assembly language is much more clear and understandable than machine language, it is still very difficult to program. • The assembly code for the sqrt() function in C is composed of hundreds of assembly instructions. CISC 105 – Topic 1

  16. Computer Programming – High-Level Languages • In order to get around these obstacles, high-level languages were introduced. • High-level languages provide a one-to-many mapping between one high-level statement and multiple assembly language instructions. • High-level language is converted to assembly instructions by a compiler. CISC 105 – Topic 1

  17. Computer Programming - Compilation A = 6 X 3 MOV EAX, 0 // initialize EAX to 0 MOV EBX, 3 // set multiplicand LABEL1: ADD EAX, 6 // multiplier DEC EBX // decrease count JNZ LABEL1 // loop if need to STOR A, EAX // store result in A CISC 105 – Topic 1

  18. Modern Software Development • Modern software development is done in high-level languages, with few exceptions. • High-level language is first compiled from source code to assembly and then assembler into machine code. Modern compilers perform the assembler function as well. • Compiled source code is called an object file. CISC 105 – Topic 1

  19. Modern Software Development • Programmers often use library functions, which are pre-written functions provided as part of the compiler/development toolset. • A library is an object file. • After the source code is compiled into machine code, a linker resolves cross-references among these object files, including libraries. The object files are linked into an executable file. CISC 105 – Topic 1

  20. Modern Software Development • The executable file can now be run. • The operating system loader loads the executable file into memory and schedules the program for execution. CISC 105 – Topic 1

  21. Modern Software Development Compiler Source Code File Object File Other Object Files (perhaps libraries) Linker Executable File Loader CISC 105 – Topic 1

  22. The Software Development Method • Specify the problem. • Analyze the problem. • Design an algorithm to solve the problem. • Implement the algorithm. • Test and verify the program. • Maintain and update the program. CISC 105 – Topic 1

  23. Review • Name the principle components of a computer. • What are three responsibilities of the operating system? • What advantage does assembly language have over machine language? • What advantages do high-level languages have over assembly language? CISC 105 – Topic 1

  24. Review • What computer program translates a source code file into an object file? • What program combines object files and produces an executable file? • What part of the operating system is responsible for the loading and scheduling of programs? • What are the steps in the software development method? CISC 105 – Topic 1

More Related