MARR Computer Systems MARR This set of notes is matched with the Computer Systems Workbook S3 What is a computer? Have you ever wondered what the word “computer” means? If you look it up in a dictionary, you will find something like: “an electronic device which runs a program to process data at great speed” We will come to the words program and data soon; however, the word “computer” means “something that computes”. So what does “compute” mean? Well, it means to calculate or work out. The very first computers were actually people. They did sums – all day, every day! From around the 1700s until the 1950s, teams of these “computers” used to carry out complex calculations (and check each other’s work). Representing Information A computer is a machine that processes information (data) using instructions given to it by a human. Computers are electronic machines, so the instructions and information they work with is represented electronically – by switches. Switched on No matter what kind of computer you are using – a desktop PC, smartphone, games console or embedded computer – it is doing one thing: processing information (data). Since a computer is made up of switches, then the information it processes is represented by the positions of switches. How is this possible? Well, think about an ordinary switch. It has two positions – OFF and ON – but we could also call these positions (or make them stand for): YES or NO BLACK or WHITE 0 or 1 If we had two switches, there would be four possible combinations of these. Look at the table below that shows the four combinations of two switches and examples of the way that you could represent different kinds of information by these. Switch positions Numbers Colours Letters OFF / OFF 0 Black A OFF / ON 1 Blue B ON / OFF 2 Red C ON / ON 3 White D Now consider if there were millions of switches – you can see how there could be almost endless combinations of OFF and ON for all of these switches. A modern computer does contain millions (even billions) of tiny switches and they are used to represent all such information. The silicon chip As you have seen, a computer is basically a collection of electronic switches. Over the years, the technology used for this has changed from old electronic valves used in Colossus to the silicon chip. Incredibly, a modern silicon chip can contain over a billion switches (called transistors) on a wafer of silicon smaller than your fingernail! Binary: The language of computers No matter what you are using your computer for – watching a movie, listening to music or surfing the web – the data (information) that the computer is processing is represented by the positions of millions of switches. Computing scientists like to call the positions 0 and 1 instead of OFF and ON. This is known as binary. It may seem strange, but it is easier than you might think. Bits and Bytes Computers can sense when a signal being sent is on or off. This is represented by a ‘1’ (on) or a ‘0’ (off). Each individual 1 or 0 is called a binary digit or bit and it is the smallest piece of data a computer system can work with. Eight bits are grouped together to make one byte. One byte provides enough codes (256) to represent all of the characters that appear on a standard keyboard. A byte is the basic unit used to measure computer memory size. Main memory A running program is stored along with its data in the main memory of the computer. We will cover this in more detail. Main memory is divided up into storage locations each with its own address. A single storage location can hold one or more bytes of information. Main memory size This is the amount of memory allocated to a computer system. Most modern computers come with a minimum of 1 gigabyte of RAM. Stored program All programs and instructions that are stored in main memory are called stored programs. Concept of machine code Machine code is the computer's own language. It consists of only the numbers 0 and 1. This is the binary system. Representation of positive whole numbers We can represent any number, however large, in binary. Remember we can only store numbers between 0 and 255 in one byte. This is obviously rather restrictive since it's not dealing with large integers, negative numbers or decimal numbers. A table exemplifying the representation of numbers in binary Storing text (ASCII) Representing Text Each character on the keyboard has a special one byte (8-bits) code to represent it. A standard for representing these characters is the ASCII set. ASCII stands for the American Standard Code for Information Interchange. Characters like letters a to z and A to Z and the digits 0 to 9 are each given a standard code which is the same on all computer systems. A table showing different representations of a list of characters in binary, and decimal. The whole range of characters recognised by a computer system is known as the character set of that computer. Bitmapped Graphics Calculation of storage requirement of black and white bit-map You may need to calculate the storage required for a black and white graphic. To do this you: multiply the width by the height to get the number of pixels (dots), this equals the numbers of bits divide by 8 to get the number of bytes divide by 1024 to get the number of kilobytes divide by 1024 to get the number of megabytes Inside every computer, there is a processor. This is a chip containing digital electronic circuits. These circuits work with tiny pulses of electricity and electronic components. The pulses of electricity can be represented by the digits 1 and 0. Every item of data and every instruction for the processor is represented by a group of these binary digits. Processors only 'understand' these binary digits. The only inputs you can make to a processor are groups of binary digits. The only output that a processor can make is a group of binary digits. Instructions and commands made for processors in this binary digital form are known as machine codes. Here is an example of machine code. These two programs both print the letter "A" 1000 times on the screen. Machine Code 169 1 160 0 153 0 128 153 0 129 153 130 153 0 131 200 208 241 96 BASIC (A High Level Language) 5 FOR I=1 TO 1000: PRINT "A";: NEXT I There are several problems with machine code: Machine codes for different processors are different They are very hard for humans to understand and use They take up a lot of space to write down It is difficult to spot errors in the codes. Machine code is an example of a low-level language. To get around these difficulties computer scientists invented high-level languages. High Level Languages High-level languages are similar to human languages. Instead of binary codes they use normal English words. For example VB6 uses words like IF, WHILE, PRINT, RAW_INPUT, INT and so on. So with high level languages using English words it makes the code easier to understand, easier to spot errors and more readable. . Translators High-level languages have some great advantages compared to machine code however there is one major problem – processors don’t understand high-level language at all. To get round this problem computer scientists have developed translator programs that translate high-level languages (written by humans) into machine code (understood by processors). Translator Program Compiler or Interpreter 10001001 11001001 1001000 11100001 10001101 1000111 Interpreter An interpreter takes each line of high-level language and translates it into machine code and passes it to the processor to carry out that instruction. It then works its way through the program one line at a time in this way. Advantages Disadvantages A program will run even if it is not finished. No copy of the machine code is saved. Meaning the source code has to be translated every time taking longer. Easy to spot errors during the translation. The process of translating the program slows down the running of it. Program will run as soon as the first line is translated. You will need to have a translator program or you cannot run it. Compiler A compiler takes your high level language and translates the whole program into machine code once. The machine code can then be saved and kept and does not need to be translated before it is run. This is an example of .exe file. Software that you buy, such as a games or an application, will have been compiled into machine code before being distributed and sold. Advantages Disadvantages The machine code is saved so the program only needs to be translated once. You have to wait until the code is complete and the errors have been fixed before the translation can be finished and the machine code is run. The user does not need a translator program to run the machine code therefore the program runs quicker. Each time the program is changed it needs to be re-translated. Computer Architecture A simple computer consists of the following components as represented in this block diagram: Processor; Memory; Input/output device; Backing Storage Communication channels Input Devices An input device is a piece of hardware that lets you put information onto or into a computer to be processed. Keyboard Mouse Microphone Digital Camera Scanner Webcam Touch Screen Output Devices An output device is a piece of hardware that provides the user with information. Monitor Printers Loudspeakers Storage Devices When we talk about ‘storing’ data, we mean putting the data in a known place. We can later come back to that place and get our data back again. ‘Writing’ data or ‘saving’ data are other ways of saying ‘storing’ data. ‘Reading’ data, ‘retrieving’ data or ‘opening’ a file are ways of saying that we are getting our data back from its storage location. Magnetic Magnetic Capacity Hard Drives Magnetic Tapes Floppy Disk Zip Drive 500Gb – 1Tb 1.44Mb 750Mb Hard-drives have a very large storage capacity. They can be used to store vast amounts of data, sometimes used to store all types of films, including huge files such as movies. Data access speeds are very fast. Optical Optical Capacity CD-ROM CD-R CD-RW DVD-ROM DVD-R DVD-RW Blu-Ray 700Mb 700Mb 700Mb 4.7Gb 4.7Gb 4.7Gb 25-50Gb Read-Only storage devices such as CD-ROM, DVD-ROM and Blu-Ray have data written onto them when they are manufactured. This data cannot be changed. CD-ROMs are used to distribute all sorts of data: software (e.g. office applications or games), music, electronic books (e.g. an encyclopaedia with sound and video.) DVD-ROMs are used in the same way as CD-ROMs but, since they can hold more data, they are also used to store high-quality video. Blu-Ray discs are used in the same way as DVD-ROMs but, since they can hold more data, they are also used to store very high-quality, high-definition (HD) video. Writeable storage devices such as CD-R and DVD-R can be written to. For example you could burn some music onto a CD-R or write your holiday video to a DVD-R. Rewriteable storage devices such as CD-RW and DVD-RW allows you to re-write data to the disk multiple times. This means you could burn a CD-RW with some music then a few months later use the same disc to rewrite new songs onto it. Portable Hard Drive A portable hard-drive is one that is placed into a small case along with some electronics that allow the hard-drive to be accessed using a USB or similar connection. Portable hard-drives allow very large amounts of data to be transported from computer to computer. Processor Type & Speed Processors were originally developed with only one core. There are different types of processors in today’s markets. Dual-core and Quad-core are the most common in many products today. If a processor has multiple cores it can run multiple instructions at the same time, increasing overall speed for programs. Dual-core processor has two cores (e.g. AMD Phenom II X2, Intel Core Duo) Quad-core processor contains four cores (e.g. AMD Phenom II X4, Intel's quad-core processors, see i3, i5, and i7 at Intel Core) Processors are measured in Hz (Hertz). In most modern computer systems processors are in GHz (GigaHertz). Below is an example of a typical processor type and speed. Apple iMac Processor 2.9GHz quad-core Intel Core i5 processor (Turbo Boost up to 3.6GHz) with 6MB L3 cache Memory: RAM & ROM People often get confused between main memory and backing storage, they are not the same. Main memory is located inside the computer system. It can either be RAM or ROM. Backing storage is outside the main processor, e.g. Hard Drives, CD/DVD drives, USB Flash Memory (Pen Drives). Main memory in today’s computers is on average around 4-6 Gb of RAM. Backing Storage is much bigger with average computers having around 500 Gb or more. ROM (Read Only Memory) ROM is used to store a small part of the operating system called the bootstrap loader. Data is stored permanently in ROM, Data is not lost when the power goes off Data in ROM cannot be changed RAM (Random Access Memory) This is where the operating system is stored; it also holds all programs and data. You can purchase additional RAM chips and install them in your desktop computer, which normally speeds up multi-tasking. The processor can write to and read from RAM at high speed Data held in RAM can be changed All data in RAM is lost when the power is switched off Operating System An operating system is a large program which manages the hardware and software of the computer system. Windows 7, Windows 8, OS X, Android and iOS are examples of operating systems. To run a certain program you may need to have a certain operating system. This kind of information is normally stated in the documentation with the program what operating system is required. Networking What is a network? A collection of computers interconnected by communication channels that allow sharing of resources and information. Stand Alone or Networked Most computer systems today are connected to a network most of the time or at least some times. If a computer is just stand alone then it has no access to share resources and communicate with other computers. Local Area Network (LAN) A group of linked computers in close proximity to each other, such as in an office building, a school or at home. LANs are useful for sharing resources such as files, printers or other applications. Wide Area Network (WAN)/Internet A WAN covers a large geographical area. Most WANs are made from several LANs connected together. The Internet is a WAN Transmission Media In a network data is sent from one computer to another in various forms. We are going to look at three of these, wired, optical and wireless. Wired Cat 5 cable is used in structured cabling for computer networks such as Ethernet. The network in the school uses this type of cable to connect the computer to the server. You may also use this type of cable at home if you do not use Wi-Fi. Wireless Wireless network refers to any type of computer network that is not connected by cables of any kind. Some businesses will use wireless as it saves money not having to lay down all the cable. Wireless lets you connect portable devices such as tablets and smartphones and can make a network feel more portable. Security Risks Virus A computer virus is a piece of program code that, like a biological virus, makes copies of itself by attaching itself to another program. The virus can waste the host's resources, and sometimes destroy or change files. While viruses are usually malicious - destroying data or crashing network services - many do nothing or are just annoying (for example, displaying a message to the user). Many viruses are made to wait a long time before doing anything, usually destroying data on a certain day, like a holiday. Viruses are usually spread by a computer network, by e-mail, or by removable media, like a memory stick. Worms A computer worm is a computer program that makes lots of copies of itself, like a computer virus. The main difference between the two is that a computer virus attaches itself to another computer program, but a worm works by itself. As well as copying itself, a worm can be made to do all sorts of things, like delete files on a computer, or send e-mails to everyone the owner has in their address book Trojans A type of 'malware' software. A Trojan seems to do an useful task and so the user will use it. But in the background, the Trojan is also carrying out its real purpose which is hidden and unknown to the user. For example, you download a free game, it's great! You keep on using it. But meanwhile the Trojan may also install a permanent keylogger that now tracks every keystroke you make and sends it off over the Internet to whomever created the Trojan. Anti-virus Software This is referring to software that can detect the presence of a virus within a computer file and warn you there is a problem. The anti-virus software may then offer to 'quarantine' the file so it cannot be used to spread the virus. Many packages will also try to remove the virus, but this is not always successful.