Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Class Agenda What does a computer consist of? Basic design of a PC The CPU How a CPU stores instructions How are Program Instructions Processed? How is memory organized? Why is different hardware used to store the same type of information? Computer Languages Key Definitions you need to know What does a computer consist of? A computer has 5 distinct properties. It accepts input through some user controlled device It stores information It processes raw data according to a set of instructions It makes coherent data out of raw data It sends the result in a form acceptable to the user Why is a computer different from any other consumer electronic device? It is Programmable - or these processes can be changed! Basic design of a PC If you were to design a computer what would you pick as its major components? -- a memory, a central processing unit, a clock and a set of ports: the memory stores the information used by the system the central processing unit (CPU) processes the raw data the clock controls the rate at which the CPU works the ports connect the CPU to external devices (such as a keyboard, a mouse, a hard disk, a CDROM, a floppy, a printer, a joystick and speakers) The CPU The CPU includes a control unit and an arithmetic/logic unit. The control unit fetches instructions from memory, decodes them and executes them. The arithmetic/logic unit (ALU) performs all arithmetic operations and logical comparisons. The CPU also contains registers where data is stored. The ALU cannot work directly on data in memory. Data needs to be copied into the registers before the ALU can use it. How a CPU stores instructions In a modern computer - that is, a stored program machine - the CPU retrieves instructions and data from memory, processes the instructions and returns the coherent data to memory. The control unit includes a program counter. This counter holds the address of the next instruction to be executed. How are Program Instructions Processed? A program instruction is stored as a binary number. A binary number consists solely of the digits 0 and 1. For example, 01010011. The CPU can only process binary information. The binary number there may be either raw data or a program instruction. Under the stored program concept, there is no way of distinguishing data from a program instruction just by examining the information itself. The manufacturer of the CPU determines the format in which program instructions are stored. This format includes an operation code followed by one or more operands, which are address fields. The operation code is a special code that tells the control unit what to do. The address fields identify the registers and memory addresses that need to be accessed while executing the instruction. Each manufacturer publishes the instruction format and the full set of operation codes for its own CPUs. How is memory organized? Computer memory is organized as a linear collection of bytes. Typically, each byte consists of 8 bits. A bit is a single binary digit, which holds the smallest unit of information. Each byte has a unique address. The addressing is sequential, starts at zero and ends at the size of memory less 1. Note that each byte and not each bit has its own address. For example, 128 bytes of memory consists of 1024 (= 128 * 8) bits where information can be stored, starts at address 0, and ends at address 127. The maximum size of usable memory depends upon the number of bits in the smallest address register in the CPU: in a 32-bit CPU, addresses can range from 0 to 232-1, which is 0 to 4,294,967,295 or 4 Giga. So, the maximum size of usable memory for a 32-bit CPU is 4 Gb (Gigabytes). The size qualifiers are Giga or G (=1024M): 1 Gigabyte = 1024 * 1024 * 1024 bytes Mega or M (=1024k): 1 Megabyte = 1024 * 1024 bytes Kilo or k (=1024): 1 Kilobyte = 1024 bytes Why is different hardware used to store the same type of information? Data can be stored in the CPU registers, the internal cache (L1), the external cache (L2) and RAM (Random Access Memory). The closer the data is to the CPU, the higher the transfer rate. The rate at which information is transferred where the information is stored. In a relative sense, CPU registers process data at less than 10 nanoseconds internal cache can hold 4-16kb data and transfer at less than 10 nanoseconds external cache can hold 128-512kb data and transfer at about 20 nanoseconds RAM can hold 32-128Mb and transfer at 60 nanoseconds a hard disk can hold 1-20Gb data and transfer at 12,000,000 nanoseconds (A nanosecond is 1 * 10-9 seconds.) The ratio of the time it takes a CPU to process data to the time it takes a hard disk to store it is the same as the ratio of the time it takes me to cross this room to the time it takes me to walk around the earth once at the same pace. Fast memory is expensive. Slow memory is inexpensive. The most expensive storage is reserved for the CPU itself while the least expensive is limited to the peripheral devices. Computer Languages – First Generation Each machine instruction is a binary number. Even for a popular CPU, machine language is extremely awkward to write. Machine Languages are First Generation or low-level languages. Machine Language is a series of codes, represented by binary numbers, used to communicate directly with the internal instructions of the PC’s microprocessor. Deciphering Machine Language code or writing it is a complex task However, programs called interpreters and compilers translate commands written in higher-level languages into machine language. Computer Languages – Second Generation The first step towards readability came with Assembly Language in 1951 (or just Assembly). An assembly language instruction might look like MOV 10000001, BX ; move the contents of 10000001 into register BX where MOV is the operation code, 10000001 and BX are the memory address and register fields, ; marks the end of the assembly language statement and move the contents of 10000001 into register BX is commentary for programmer reference. Computer Languages –Second Generation (cont.) In assembly languages, the operation codes are written as simple command words to supply step-by-step instructions for the processor to carry out. Assembly Languages directly manipulates the values contained in those memory scratch pads in the microprocessor called registers. Although more intelligible to human than machine language codes, assembly is still more difficult to use that higher-level languages. However, Assembly remains popular among programmers because it creates compact, fast code. An assembly language program, to be executable on a computer, must be translated into machine language code. A separate program called an assembler does this translation. However, since each manufacturer creates its own operation codes, program instructions vary from machine to machine and new assembly language programs are written for each new CPU. For example, even for the same instruction, the order of the operands may vary. High Level Languages The third generation of programming languages broke the relation to machine language. In high-level languages, the instructions are English-like as opposed to machine-like. Languages such as C and Java allow programmers to write in terms and words that more closely parallel English Java is the current rising star in language since a program written in Java will run on any computer no matter what operating system it is using. At the highest level are languages such as BASIC (Beginners Allpurpose Symbolic Instruction Code), Visual Basic, the DOS batch language and the macro languages used to automate applications such as MS Office However - the only language that a computer can interpret is its native machine language. To convert a program written in a highlevel language to machine language, pass the high-level source through a separate program called a compiler. Some of the Languages Developed since 1950 Over the development history of programming languages, the first three generations were procedural. These languages execute instructions sequentially. The fourth generation languages are non-procedural. Key Definitions (see White, Ron. (2004) How Computers Work. 7th Edition. Que Publishing, New York. Pages 8-9) BIOS (basic input / output system) A collection of software codes built into a PC that handle some of the fundamental tasks of sending data from one part of the computer to another Boot or boot-up The process that takes place when a PC is turned on and performs the routines necessary to get all the components functioning properly and the operating system loaded. The term comes from lifting yourself by your bootstraps Key Definitions (continued) Circuit Board Originally, wires ran form and to any component in any electrical device, not just computers. A circuit board replaces the need for separate wiring with metallic traces printed on the board – sometimes also on the bottom of the board and in the hidden middle layer. The traces lead to connections for processors, resistors, capacitors and other electrical components. The importance of the circuit board is that its entire creation can be automated, and the board packs more components into an ever smaller space. Key Definitions (continued) Clock A microchip that regulates the timing and speed of all of the computers functions. The chip includes a crystal that vibrates at a certain frequency when electricity is applied to it. The shortest length of time in which a computer can perform some operation is one clock, or one vibration of the clock chip. The speed of clocks – and therefore computers themselves – is expressed in megahertz (MHz). One megahertz is 1 million cycles, or vibrations, a second. Thus, a PC can be described as having a 200 or 300 MHz processor, which means that the processor has been designed to work with a clock chip running at that speed. NOTE: posted clock speed is an ideal maximum – the actual speed will always be slower. Key Definitions (continued) CMOS An acronym for complementary metal-oxide semiconductor – a term that describes how a CMOS microchip is manufactured. Powered by a small battery, the CMOS chip retains crucial information about what hardware a PC is comprised of even when the power is turned off. CPU An acronym for central processing unit, it is used to mean the microprocessor – also, processor - which is the microchip that processes the information and the code (instructions) used by a computer. The ‘brains’ of a computer. Key Definitions (continued) Expansion slot Most PCs have unused slots into which the owner can plug circuit boards and hardware to add to the computers capabilities. Most slots today are personal computer interface (PCI). One other slot, the accelerated graphics port (AGP), accepts a video card designed to move images out of memory quickly. Motherboard A sheet of plastic onto which metallic circuits have been printed and to which slots for other components wait to receive daughterboards, smaller circuits that add to the motherboard capabilities. Key Definitions (continued) Operating System Software that exists to control the operations of hardware. Essentially, the operating system directs any operations, such as writing data to memory or to disk, and regulates the use of hardware among several application programs that are running at the same time. This frees program developers from having to write their own code for these most basic operations. Key Definitions (continued) ROM and RAM Acronyms for Read Only Memory and Random Access Memory. ROM is memory chips or data stored on disks that can be read by the computer’s processor. The PC cannot write new data to those chips or disk drives. RAM is memory or disks that can be both read and written to. NOTE: RAM is really a misnomer because even ROM can be accessed randomly. The term originally was used to distinguish RAM from data and software that was stored on magnetic tape, and which could be accessed only sequentially. That is, to get the last chunk of data or code on a tape, a computer must read through all the information contained in the tape until it finds the location where it stored the data code or code for which it is looking. In contrast, a computer can jump directly to any information stored in random locations in RAM chips or on a disk. Key Definitions (continued) System Files Small files that contain software code that are the first files a computer reads from a disk when it is booted. On DOS (disk operating system) and Windows systems, the files are named IO.SYS and MSDOS.SYS and are hidden so that ordinarily you cannot see them in a listing of files on a disk. The systems files contain the information needed, following the initial hardware boot, to load the rest of an operating system. In DOS, one other system file is COMMAND.COM, which contains the operating system’s basic functions, such as displaying a list of files (a directory). A boot disk must contain all three files for a PC to start up. System files can also include CONFIG.SYS, which makes some initial setting of hardware, and AUOTEXEC.BAT, a collection of commands that are executed when all other boot functions are finished. In Windows 95, 98 and Me, the Registry – consisting of two hidden files USER.DAT and SYSTEM DAT – is also necessary for Windows to run and can be considered a system file. Key Definitions (continued) WRITE and READ Writing is the process by which a computer stores data in either RAM chips or on a disk drive. Reading is the process by which a computer transfers data or software code from a drive to RAM or from RAM to the microprocessor. SCSI HardDisk