Chapter 3 Computer Hard ware Mathematics Department 1 • A computer performs basically five major operations : 1. it accepts data or instructions by any way of input, 2. it stores data, 3. it can process data as required by the user, 4. it gives results in the form of output, and 5. it controls all operations inside a computer Mathematics Department 2 Computer Hardware • Refers to the physical components • Not one device but a system of many devices • Major types of components include: – – – – – Central Processing Unit Main memory Secondary storage devices Input devices Output devices Slide 1- 3 Organization of a Computer System Central Processing Unit Input Device Main Memory Output Device Secondary Storage Slide 1- 4 The CPU • Fetches instructions from main memory • Carries out the operations commanded by the instructions • Each instruction produces some outcome • A program is an entire sequence of instructions • Instructions are stored as binary numbers • Binary number - a sequence of 1’s and 0’s Slide 1- 5 Main Memory • Commonly known as random access memory, or just RAM • Holds instructions and data needed for programs that are currently running • RAM is usually a volatile type of memory • Contents of RAM are lost when power is turned off Slide 1- 6 Secondary Storage • A nonvolatile storage medium • Contents retained while power is off • Hard disk drives are most common – Records data magnetically on a circular disk – Provides fast access to large amounts of data • Optical devices store data on CD’s as pits • USB flash memory devices – High capacity device plugs into USB port – Portable, reliable, and fits easily in a pocket Slide 1- 7 Input Devices • Any type of device that provides data to a computer from the outside world • For example: – Keyboard – Mouse – Scanner Slide 1- 8 Output Devices • Any type of device that provides data from a computer to the outside world • Examples of output data: – A printed report – An image such as a picture – A sound • Common output devices include: – Monitor (display screen) – Printer Slide 1- 9 Knowing About: Computer Hardware • Evolution of hardware – 1950s: all hardware units were built using relays and vacuum tubes – 1960s: introduction of transistors – mid-1960s: introduction of integrated circuits (ICs) – Present computers: use of microprocessors • Bit: smallest and most basic data item in a computer; represents a 0 or a 1 • Byte: a grouping of eight bits – E.g., 00010001 – What does this represent? • Word: a grouping of one or more bytes Slide 1- 10 (Low-Level) Languages • Low-level languages – First-generation and second-generation languages – Machine-dependent languages – The underlying representation the machine actually understands • First-generation languages – Also referred to as machine languages – Consist of a sequence of instructions represented as binary numbers – E.g.: Code to ADD might be 1001 . To add 1+0 and then 1+1 our program might look like this: • 1001 0001 0000 • 1001 0001 0001 Slide 1- 11 (Low-Level) Languages • Second-generation languages – Also referred to as assembly languages – Abbreviated words are used to indicate operations – Allow the use of decimal numbers and labels to indicate the location of the data • Assemblers – Programs that translate assembly language programs into machine language programs – Our add program now looks like: • ADD 1,0 • ADD 1,1 Assembler 1001 0001 0000 1001 0001 0001 Slide 1- 12 (High-Level) Languages • High-level languages – Third-generation and fourth-generation languages – Programs can be translated to run on a variety of computer types • Third-generation languages – Procedure-oriented languages – Object-oriented languages • Our Add program might now look like: sum = value1 + value2 Compiler 1001 0001 0000 1001 0001 0001 Slide 1- 13 Third-Generation and FourthGeneration (High-Level) Languages (Continued) The Evolution of Programming Languages Slide 1- 14 Third-Generation and FourthGeneration (High-Level) Languages • Procedure-oriented languages – Programmers concentrate on the procedures used in the program – Procedure: a logically consistent set of instructions which is used to produce one specific result • Object-oriented languages – Items are represented using self-contained objects – Often used for graphical windows environments, ability to re-use code efficiently Slide 1- 15 1- Input units • This units are used for the process of entering data and programs in to the computer system. • The input unit takes data from us to the computer in an organized manner for Processing. • Examples of input units : Mouse, Modem, Keyboard, Net card, Camera, microphone, CD, DVD,HD Mathematics Department 16 2. Storage • The process of saving data and instructions permanently is known as storage. • All data and instructions are stored before and after processing • Intermediate results of processing are also stored here. Mathematics Department 17 CPU Components • Two typical components of a CPU are: • The arithmetic logic unit (ALU), which performs arithmetic and logical operations. • The control unit (CU), which extracts instructions from memory and decodes and executes them, calling on the ALU when necessary. Mathematics Department 18 ALU • The actual processing of the data and instruction are performed by Arithmetic Logical Unit • The major operations performed by the ALU are addition, subtraction, multiplication, division, logic and comparison. • Data is transferred to ALU from storage unit when required Mathematics Department 19 Control Unit (CU) • The Control Unit acts like the supervisor • It extracts instructions from memory and decodes and executes them, and sends the necessary signals to the ALU to perform the operation needed. • The control unit determines the sequence in which computer programs and instructions are executed. • Processing of programs stored in the main memory, interpretation of the instructions and issuing of signals for other units of the computer to execute them. Mathematics Department 20 4- Output Units This is the process of producing results from the data for getting useful information. The output is also stored inside the computer for further processing. Examples of output units: Screen, printers, plotters, net card,.. Mathematics Department 21 Physical computer components • • • • • • 1. Central Processing Unit (CPU) 2. Computer Memory (RAM and ROM) 3. Data bus 4. Ports 5. Motherboard 6. Hard disk 7. Output Devices 8. Input Devices Mathematics Department 22 MEMORY • There are two kinds of computer memory: primary and secondary. • Primary memory is accessible directly by the processing unit. • RAM (Random access memory) is an example of primary memory • As soon as the computer is switched off the contents of RAM is lost. • You can store and retrieve data much faster with primary memory compared to secondary memory Mathematics Department 23 • Secondary memory such as floppy disks ,hard magnetic disk, etc., is located inside and outside the computer. • Primary memory is more expensive than secondary memory. • The size of primary memory is less than that of secondary memory. • Primary memory is faster than secondary memory. Mathematics Department 24 Memory is used to store: • i) instructions to execute a program and • ii) data. When the computer is doing any job, the data that have to be processed are stored in the primary memory. This data may come from an input device like keyboard or from a secondary storage device like a floppy disk. Mathematics Department 25 Capacity of Primary Memory • • • • • • • In computer’s memory both programs and data are stored in the binary form The binary system has only two values (bits ) 0 and 1. Each of RAM’s locations stores one byte )8 bits) (1 kilobyte is 1024 bytes) (1Megabyte is 1024 kilobytes) (1 terabyte is 1024 megabytes) Thus 64 kilobyte (KB) memory is capable of storing 64 X 1024 = 32,767 bytes Mathematics Department 26 • Each cell of memory contains one character or 1 byte of data • Primary storage is referred to as random access memory (RAM) because it is possible to randomly select and use any location of the memory directly store and retrieve data. It takes same time to any address of the memory as the first address. • It is also called read/write memory Mathematics Department 27 • The storage of data and instructions inside the primary storage is temporary. • It disappears from RAM as soon as the power to the computer is switched off. • The memories, which loose their content on failure of power supply, are known as volatile memories Mathematics Department 28 Read Only Memory (ROM) • There is another memory in computer, which is called Read Only Memory (ROM). • The storage of program and data in the ROM is permanent. • The ROM stores some standard processing programs supplied by the manufacturers to operate the computer. • The ROM can only be read by the CPU but it cannot be changed. Mathematics Department 29 • The basic input/output program is stored in the ROM that examines and initializes various equipment attached to the PC when the switch is made ON. • The memories, which do not loose their content on failure of power supply, are known as non-volatile memories. • ROM is non-volatile memory. Mathematics Department 30 • • • PROM is another type of primary memory in computer, which is called Programmable Read Only Memory (PROM). You know that it is not possible to modify or erase programs stored in ROM, but it is possible for you to store your program in PROM chip. Once the programmes are written it cannot be changed and remain intact even if power is switched off. Programs or instructions written in PROM or ROM cannot be erased or changed. Mathematics Department 31 • EPROM: Erasable Programmable Read Only Memory, which over come the problem of PROM & ROM. • EPROM chip can be programmed time and again by erasing the information stored earlier in it. • When the EPROM is in use information can only be read. Mathematics Department 32 Cache Memory • The speed of CPU is extremely high compared to the access time of main memory. • Therefore the performance of CPU decreases due to the slow speed of main memory. • Cache Memory is a small memory chip is attached between CPU and Main memory whose access time is very close to the processing speed of CPU. • CACHE memories are accessed much faster than conventional RAM. It is used to store programs or data currently being executed or temporary data Mathematics Department 33 Registers: • • • • The CPU processes data and instructions with high speed, there is also movement of data between various units of computer. It is necessary to transfer the processed data with high speed. So the computer uses a number of special memory units called registers. They are not part of the main memory but they store data or information temporarily and pass it on as directed by the control unit. Mathematics Department 34 auxiliary memory or secondary storage • 1-Hard Disk, in computer science, one or more inflexible platters coated with material that allows the magnetic recording of computer data. • Hard disks provide faster access to data than floppy disks and are capable of storing much more information. Because platters are rigid, they can be stacked so that one hard-disk drive can access more than one platter. • Most hard disks have from two to eight platters. Mathematics Department 35 • Magnetic Tape: Magnetic tapes are used for large computers like mainframe computers where large volume of data is stored for a longer time • Floppy Disk: It is similar to magnetic disk discussed above. They are 5.25 inch or 3.5 inch in diameter. They come in single or double density and recorded on one or both surface of the diskette. The capacity of a 5.25inch floppy is 1.2 mega bytes whereas for 3.5 inch floppy it is 1.44 mega bytes. Mathematics Department 36 • floppy disk * small magnetic data storage disk: a small flexible magnetically coated disk in a rigid plastic case on which data can be stored or retrieved by a computer * a regular floppy disk holds approximately 1.44 megabytes. Mathematics Department 37 CD- ROM • CD-ROM, short for compact disc read-only memory, a rigid plastic disk that stores a large amount of data through the use of laser optics technology. • Because they store data optically, CD-ROMs have a much higher memory capacity than computer disks that store data magnetically. • However, CD-ROM drives, the devices used to access information on CD-ROMs, can only read information from the disc, not write to it. • CD-ROMs can store large amounts of data and so are popular for storing databases and multimedia material. The most common format of CD-ROM holds approximately 630 megabytes . Mathematics Department 38 INPUT OUTPUT DEVICES • When you work with the computer you feed your data and instructions through some devices to the computer. These devices are called Input devices. • Input Devices: Keyboard, Mouse, Scanner, Optical Character Recognition (OCR) • Output Devices • Visual Display Unit: The most popular input/output device is the Visual Display Unit (VDU). It is also called the monitor Mathematics Department 39 • Terminals: It is a very popular interactive input-output unit. • It can be divided into two types: hard copy terminals and soft copy terminals. A hard copy terminal provides a printout on paper whereas soft copy terminals provide visual copy on monitor. • A terminal when connected to a CPU sends instructions directly to the computer. Mathematics Department 40 Printer • It is an important output device which can be used to get a printed copy of the processed text or result on paper. • There are different types of printers that are designed for different types of applications. • Depending on their speed and approach of printing, printers are classified as impact and non-impact printers. Mathematics Department 41 • Impact printers use the familiar typewriter approach of hammering a typeface against the paper and inked ribbon. • Dot-matrix printers are of this type. • Non-impact printers do not hit or impact a ribbon to print. • They use electro-static chemicals and ink-jet technologies. • Laser printers and Ink-jet printers are of this type. • This type of printers can produce color printing and elaborate graphics. Mathematics Department 42