computer fundamentals - northern college for … science... · web viewthe computer acts as a...
TRANSCRIPT
Computer FundamentalsPhilip Bird
The Northern College Diploma Programme
Introduction
The microprocessor has changed our lives in so many ways that it is difficult to recall how different things were before its invention. In the 1960s, computers filled entire rooms. Their expensive processing power was available only to a select few in government labs, research universities and large corporations. The mid-1960s development of the integrated circuit had enabled the miniaturisation of electronic circuitry onto a single silicon chip. Today’s world is being reshaped by technology in ways previously unthinkable. We now live in a digital age. Millions of people use personal computers connected in networks that form a global information system. World news, personal correspondence, educational pursuits, music, arts and business flow through this network, connecting people and ideas in distant countries.
In addition, microprocessors are improving existing products of all kinds, not just the PC. Tucked under the bonnets of today’s cars, processors control brakes and engine management, and remind you to fasten your seat belt. Processors can be found in thermostats and toys, in cellular phones, microwave ovens and alarm clocks. These processors change how existing products function and allow the creation of new ones. In the aggregate, they change how we live, how we work, how we entertain ourselves and how we are able to imagine – and thus create – the world of the future.
This module looks at the basic building blocks of a computer system. The different pieces of hardware and software needed to make a computer work together with how data is stored, how programs are run and how computers communicate with both users and other computers.
Topic ActivityIntroduction – A Binary World Number ConversionLogic Circuits Logic and Truth TablesProcessor Architecture Processor ArchitectureThe Fetch Execute Cycle Assembly LanguageProgramming Languages and Top-Down Design
Pseudo-code
Operating Systems Assessed Task 1The Components of a PC Component SpecificationNetworking and Data Communications
Assessed Task 2
Computer Fundamentals Page 2
A Basic Computer System
Most computer systems conform to this general picture, a Central Processing Unit and Peripherals. The peripherals serve to input data to the CPU where a program transforms the data and then other peripherals are used to either save the data or output it.
It may be that the computer is packaged together in one box or may be spread over different units, possibly in different locations.
Not only do most computers share similar layouts but the way they actually run programs, as we shall see, is also remarkably similar.
The differences between them are most apparent when we look in more detail at the size, throughput and methods of operating them. The distinctions between them are becoming increasingly blurred as technological advances improve performance.
Computer Fundamentals Page 3
Printer - Output
Keyboard/Mouse - Input
CPU - Processor
Monitor - Output
Number Systems & Logic
Binary & Hexadecimal
All data inside the computer is stored as a binary value. Computers can only store and process things in terms of on’s and off’s – represented by voltages. We now live in a digital world as TV signals, films and music are all stored as binary values. Binary number are usually grouped together in long strings (8 binary digits (bit) is usually called a byte.) Hexadecimal is a convenient method for talking about large strings of binary data. It uses base 16, with the letters A..F to represent the numbers 10..15.
Base4 Base3 Base2 Base1 Base0
16 8 4 2 1 Binary
65536 4096 256 16 1 Hex
10000 1000 100 10 1 Decimal
The easiest way to convert decimal to binary is to use this grid and calculate the decimal equivalent
8 4 2 1 Whole numbers
1 1 0 1 =13
As well as storing numbers a byte could be used to store a character. Characters are encoded (usually using ASCII – the American Standard Code for Information Interchange) E.g 65=’A’, 97=’a’ etc
128 64 32 16 8 4 2 1 Characters
0 1 0 0 0 0 0 1 65 = A
To get negative numbers one method is to use one bit (in this case the most significant bit) to represent a negative value.
-8 4 2 1 Negative numbers
Computer Fundamentals Page 4
1 1 0 1 = -3
Binary values can be interpreted in one other way and that is as a fraction. In this case the grid looks like
½ ¼ 1/8 1/16 Fractions
1 1 0 1 =13/16
Thus binary numbers can be used to store positive and negative whole numbers (integers), characters and fractions (real numbers). It is up to the computer programmer to decide what type is being stored.
Logic Gates
Computers are constructed of logic gates working on binary data. Originally the gates were implemented as valves – making early computers very large, requiring lots of power and generating heat. The next development was the transistor which enabled smaller and more reliable computers to be build. A 'chip' is a combination of many transistors integrated into one package. The gates make up circuits and are governed by the following rules.
Operation Truth Table Rule
In1
a
In2
b
Out
Y
NOT0 1
The output is the opposite of the input.
1 0
AND 0 0 0 The output is 1 if all the inputs are 1.
0 1 0
Computer Fundamentals Page 5
1 0 0
1 1 1
OR 0 0 0 The output is 1 if any of the inputs are 1.
0 1 1
1 0 1
1 1 1
XOR 0 0 0 The output is 1 if either of the inputs are 1 but not both.
0 1 1
1 0 1
1 1 0
Task – Number Conversion
1. Convert the following to Binary
151646113223
2. Convert the following to Decimal
0101010110101010
Computer Fundamentals Page 6
111100000001111100100000
3. What is the result of adding the following Binary numbers together? Check your answers by converting to decimal.
0000010100001010
0000110000001011
0000111100000001
1111111100000001
4. Convert the following byte
01000101 into a positive decimal integer11000101 into a negative decimal integer01000101 into an ASCII character01000101 into a positive real number
Computer Fundamentals Page 7
Computer Logic Circuits
Computer circuits are built from large numbers of logic gates. The operations they perform are essentially simple, the computer gaining its power from the speed of operation rather than the complexity of the circuits. (The first IBM PC from the early 80’s only consisted of 29,000 transistors and worked at almost 5 million clock ticks per second.)
Control Switches
Regulate the flow of data along the buses. Much like a light switch.
Masks
Are used to select bits of the data stream. The output is determined by the control input. Try masking 01100001 with 11011111 then convert them to ASCII.
Computer Fundamentals Page 8
Addition
A truth table to perform binary addition looks like this:
In1 In2 Carry Sum
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
And a circuit to do this:
The problem with this circuit is that it cannot accommodate carry forwards. Our circuit to add two binary numbers needs 3 inputs and looks like this:
The adder circuit forms the heart of the arithmetic and logic unit of the CPU. This requires two input registers and an output register. These feed the bits to be added into a number of full adders to add up the bits in parallel.
Computer Fundamentals Page 9
It is easy to extend the circuit to do subtraction (subtraction in binary is done by reversing all the bits of one of the numbers and adding one – this is simply a matter of adding some NOT gates as the Carry In can be set to add one). Once we have a circuit to do addition and subtraction it is possible to do multiplication and division through repeated additions or subtractions.
Computer Fundamentals Page 10
Task – Logic and Truth Tables
1) I will have another beer if I have the money and can stand at the bar or if someone else is buying. Draw a truth table to solve this problem!
2) Produce a truth table for the following circuit. What purpose does it seem to have?
3) Use Circuit Shop to animate the full adder circuit. Use this to produce a truth table for the circuit.
4) What is this circuit doing? (Animate it using Circuit Shop to observe the behaviour.)
Computer Fundamentals Page 11
Processor Architecture
The architecture of processors varies from one device to another however they all share the same ancestry and have much in common. That ancestry is the 'Von Neumann' architecture – where programs and data live in the memory of the computer. The computer acts as a re-defineable machine, each program does a different job, one minute a word processor, the next a spreadsheet. Most, but not all, computers share this common Von Neumann architecture. However all models of computation are the same, if a problem can be solved on one type of computer it can be solved by any, all that matters is the speed. It is also important to know that there are many problems that cannot be solved by a computer as no known algorithm exists.
A processor is made up of a number of functionally different units linked together by buses. These units are the:
Control Unit Arithmetic and Logic Unit Memory Input/Output Unit.
Memory
This is usually RAM or ROM made up of individually addressable cells each capable of holding one byte. (Also known as Main Memory or Immediate Access Storage to distinguish it from Backing Storage).
Access to the contents of memory is governed by an address register, that stores the address of the cell to access, and an address decoder, that deciphers the address to provide an electrical pathway to the cell. Once accessed the contents of the cell is passed to a data register to await transfer.
The size of the MAR determines the maximum amount of memory that a computer can address. If it is 16 bits then after decoding 65536 distinct cells
Computer Fundamentals Page 12
can be addressed. (216). This is 64K as found on many early home computers, most modern micro's have an 18-32 bit MAR. (This gives an address range of 256K to 4 Gigabytes – the limit of processors up to the Pentium 3). Modern Pentium processors (with support from Windows Vista) have 64 bit MAR’s and can address 16 Terabytes. Most memory is organised in byte sized chunks, most character codes are still byte sized and it makes sense, when dealing with data, for each memory location to store one character. This causes problems when we want to store numbers, an integer may occupy 2 bytes whilst a real number 5 bytes, each will have a different interpretation. Most pixels on screen require 3 bytes to store the colour value. (One byte each for Red, Green and Blue.)
Memory is used for storing both data and program instructions. An instruction is made up of an operation code and an operand, which is usually the memory address of some data.
Arithmetic and Logic Unit
The ALU performs the actual calculations. It has an accumulator, which is the main working register of the processor, the logic circuits which do the work, (e.g. adders), and a set of condition codes, or status flags, which can pass information to and from the unit to influence the calculation.
Such information might be from Zero, Negative or Carry Flags. These flags will be set by previous calculations and can be used to test the result. They allow the programmer to build conditions into the program e.g. if age<16 then display “Too young”
Input / Output Unit
This handles the processor's communication with its peripherals. E.g. Disc drive, monitor, printer etc. There are registers to hold the data coming in or going out and a peripheral device selection unit which determines which interface to send the data to.
Control Unit
This unit directs the step by step working of a program based on timing pulses sent from a clock.
The two main registers are the Program Counter, (Instruction Pointer or Sequence Control Register), that contains the address of the next program instruction. The PC is usually the same size as the MAR as quite often the PC feeds the MAR.
The second main register is the Instruction Register, which holds a copy of the current program instruction. This is fed into an instruction decoder that determines which control switches to set to carry out that instruction.
Computer Fundamentals Page 13
There may be many other registers including stack pointers and index registers. (The latter is used to address memory in different ways).
The timing of the clock determines the machine cycle. An instruction may take a number of machine cycles to complete. For example to load the accumulator with some data may take 4 cycles on an 8088 but only 1 cycle on a RISC processor. Clock timing is usually measured in hertz (cycles per second), the 8088 as found in the first basic IBM PC runs at 4.77 Mhz, the 80486 can run at 60 Mhz. The latest Pentium processors run at over 3 Ghz
Reduced Instruction Set (RISC) processors have only a limited number of instructions but are optimised to perform those instructions very quickly. As processors spend much of their time moving data around the lack of extra instructions is traded against this speed of operation. Complex Instruction Set (CISC) processors have many instructions, for example to multiply data, these have to be coded up as a combination of many instructions in a RISC chip.
The latest Pentium Xeon processors include multiple cores that double the key processing units on each chip and achieve performance improvements from running in parallel.
The size of micro-processors has grown in recent years to devices that are capable of handling 64 bits with speeds of over 3 Ghz and 16 Terabytes of memory.
Processor Transistors Processor/Data bus
Speed Year Computer
Intel 4004 2300 4/4 108Khz 1971 Calculators
Intel 8080 6000 8/16 2Mhz 1974 Altair
Intel 8086 29,000 16/16 5Mhz 1978 IBM PC
Intel 80386 275,000 32/32 16Mhz 1985 IBM PS2 Model 80
Intel 80486 1,200,000 64/32 25Mhz 1989 Various
Intel Pentium
3,100,000 64/32 60Mhz 1993 Various
Computer Fundamentals Page 14
Intel Pentium II
7,500,000 64/32 200Mhz 1997 Various
Intel Pentium 4
42,000,000 64/32 1.5Ghz 2000 Various
Intel Xeon 42,000,000 64 2Ghz 2001 Various
Computer Fundamentals Page 15
Complete CPU Architecture
This is a highly simplified diagram, most microprocessors would include other registers to allow memory to be addressed in other ways.
Computer Fundamentals Page 16
Task – Processor Architecture
Visit the Intel Museum (www.intel.com) and find out what is meant by “Moore’s Law”
Print out the graph of processor transistor development over time.
Watch the film clip on Moore’ Law.
Use the Intel site to find how many transistors the Intel Core 2 Duo processor has?
Computer Fundamentals Page 17
The Fetch/Execute Cycle
As the architecture of most processors is the same so is the way in which the machine performs computations. This is based on the fetch/execute cycle. All Von Neumann computers work this way.
PC=Address of next instruction
repeat
MAR=PC
PC=PC+1
Decode MAR
MDR=Memory[MAR]
IR=MDR
Execute IR
until halt
The execution phase depends on what instruction has been fetched from memory. If it is a jump then the address field of the instruction is copied straight into the PC. If it is a load instruction then another access to memory is needed, unless the load is immediate then the same process as for a jump is performed.
The instructions are in machine code – pure binary – made up of two parts. An Operation code and an operand. E.g. 0100 0101 may mean add the contents of memory address 5 onto the accumulator. The op code meaning add, the operand being the address 5. However these are very difficult to work with and it was soon discovered that programs could be written in an assembly language that could then be translated by the computer into machine code.
What follows is an example of assembly language instructions (there are only a few instructions, most microprocessors would understand many more, but apart from input and output instructions these are all that would be required to program any problem that has ever been run on a computer.)
Computer Fundamentals Page 18
Op code
Operand
Meaning
HLT ; Halt
LOD 5 ; Load contents of address 5 into Accumulator
STO 5 ; Store Accumulator in memory address 5
LDI 5 ; Load 5 into the Accumulator
ADD 5 ; Add contents of address 5 into Accumulator
SUB 5 ; Subtract contents of address 5 from Accumulator
ADI 5 ; Add 5 to the Accumulator
SBI 5 ; Subtract 5 from the Accumulator
INC ; Increase Accumulator by 1
DEC ; Decrease Accumulator by 1
JMZ 5 ; Jump to address 5 if Accumulator is zero
JNZ 5 ; Jump to address 5 if Accumulator is not zero
JMN 5 ; Jump to address 5 if Accumulator is negative
JMP 5 ; Jump to address 5
JCS 5 ; Jump to address 5 if Carry is set to 1
JCC 5 ; Jump to address 5 if Carry is set (clear) to 0
An example program may look like this
LOD 10 ; Load contents of address 10 into Acc
ADD 10 ; Add contents of address 10 to Acc
STO 10 ; Store Acc back in address 10
HLT
In other words if the number 7 was in memory address 10 by the time this program completes the number 14 would be in address 10. I.e. the original
Computer Fundamentals Page 19
number would be doubled. The words that follow the semi-colon are comments and would be ignored by the translator, they are there to make programs more readable for human understanding. After translation the machine code program would look like this
0001 1010
0100 1010
0010 1010
0000 0000
Computer Fundamentals Page 20
Task - Example Assembly Programs
Trace through the execution of the following assembly language programs and try to determine what they are doing. The first number is the address in memory, where the instruction or data is stored, to make it easy to follow some of the jumps. These programs can be tried on the SCAry Simulator (Simple Computer Archytecture)
Program 10 LOD 101 ADD 102 STO 103 HLT10 7
Program 20 LDI 51 ADI 92 HLT
Program 30 LOD 101 ADD 112 ADD 123 STO 134 HLT10 711 512 8
Program 40 LDI 31 DEC2 JMZ 43 JMP 14 HLT
Computer Fundamentals Page 21
Program 50 LOD 101 SUB 112 JMN 53 LOD 104 JMP 65 LOD 116 HLT10 711 9
Try entering different values into memory locations 10 and 11 and observe the results.
What is the result of executing this program?
Program 60 LOD 141 ADD 132 STO 143 LOD 124 DEC5 STO 126 JNZ 07 HLT12 313 514 0
Try entering different values into memory locations 12 and 13 and observe the results.
What is this program doing?
Computer Fundamentals Page 22
Programming Languages
Three Generations Of Languages
Machine code was developed as a way of programming the computer in binary. The first translator allowed machine code programs to be written as an assembly language. Thus 00110101 could be written as ADD 5. Cobol was one of the first high level languages, developed in the late 1950’s to allow business users to program their own problems. E.g. MULTIPLY PENSALES BY SALESCOST GIVING PENINCOME
Assembly language and machine code programs are machine specific, a program written for an Pentium computer will not work on an Apple. High level language programs, in theory, should be easy to port across computers. As assembly language programs are tied to a particular processor and are close to the machine code they are known as low level languages.
It usually takes many assembly language instructions to achieve the same effect as a single high level language statement however there is often a very significant improvement in terms of both the size of the final, runnable program and the speed at which it runs.
High Level Languages
Good High Level Language programs should be easy to read and understand, efficient (programs must be translated quickly and the resulting program should run quickly), simple to use and easy to port across different computer systems.
Often these objectives clash. Languages that are terse, e.g. C++ and Fortran, tend to be more efficient than those which are more wordy and readable. Any translator that makes use of a particular machines graphics and sound capabilities tends to make programs lack portability.
Programming in a HLL is still fairly difficult. To this end database query languages have taken a more important role in program development. Languages like SQL have made it easier for non-programmers to access data stored in a database. (These are sometimes called 4th Generation languages) The development of query languages and HLL's now go hand-in-hand with systems like Microsoft Access which includes the facilities to ask queries in SQL or to modify the package using a macro language (like Visual Basic for Applications).
Computer Fundamentals Page 23
Generation Level Example
Machine Code 1st Low 0011 0101
Assembly Language 2nd Low ADD 5
Visual Basic 3rd High score = score + 5
SQL 4th High update stock set qty = qty + 5
Features Of High Level Languages
The features found in most HLL’s include
The ability to store data in variables and constants. The ability to perform in-built mathematical operations on the data.
The ability to define your own functions or procedures.
The ability to sequence instructions into a series of functions or procedures.
The ability to loop through a series of instructions.
The ability to select between a number of alternative instructions.
The ability to add comments to the program code so as to make it more readable.
The ability to pass data from one procedure to another.
The ability to write libraries of commonly used procedures and call them in as necessary.
The ability to group data into larger collections for manipulation or storage.
The purpose of language translation is to convert the source into object code. Usually from a high level language into machine code. In doing the translation attempts are made to find errors (“bugs”) and report these to the programmer (syntax errors). Programs are usually expressed as an algorithm – a series of steps to solve a problem. It often helps to design a program using some intermediate language (sometimes as a structure diagram) before it is committed to a computer. This helps to get the logical flow of the program correct (logical errors), it is often more difficult to solve errors when looking at the program code on screen. The most common technique for program
Computer Fundamentals Page 24
design is top-down design where the algorithm is produced by breaking the problem down into smaller and smaller stages. The final type of errors is a run-time error, these can only be found by test running the program and using debugging tools. Such errors occur when unexpected events occur and can often cause the program to crash.
Computer Fundamentals Page 25
Top Down Design
In writing HLL programs it is a good idea to design the solution first. There are a number of techniques that can be used, the most common being top-down design. This is done by taking the problem and breaking it down into a number of steps. Each step may then be refined in more detail. By doing the design in this way logical errors can be spotted and corrected before you start coding. Problems are expressed as an "algorithm", this can be shown as a flowchart or as a series of pseudo-code statements.
This process can be very time consuming but will lead to better designed programs which have evolved into code in the form of modules, expressed as subroutines/procedures and functions in the program.
There are no hard and fast rules as to how many steps one breaks the problem down into and in practice many programmers will jump stages especially towards the coding stage. It often depends on your level of confidence and how well you know the language you are using.
It is often difficult to see the advantages of using design methods, especially for small programs. You will find, however, that the more time that is spend designing the program the less will be spent on frustrating debugging at a later stage.
An Example
The problem is 'Making a cup of coffee'. The top level design is as follows.
Coffee
Fill Kettle
Get Cup
Add Coffee
Add Milk
if sweet tooth then Add Sugar
Make Drink
End
Each line is then taken and refined further. (Only two refinements are shown below).
Add Coffee
Get Coffee from cupboard
Put Coffee in cup
Replace Coffee
End
Computer Fundamentals Page 26
Make Drink
while water not boiling do
wait
endwhile
pour water into cup
End
We carry on doing this until we reach a point where we need continue no longer. We might choose to refine 'Get Coffee from cupboard'.
Note that we tend to be doing similar things in a number of places, such as Add Coffee and Add Sugar, and what would we need to change if we wanted tea instead of coffee? Parameters are a way of allowing use to make use of the design for slightly different purposes.
Beverage
Fill Kettle
Get Cup
beverage = Ask What Drink
Add Item (beverage)
Add Milk
if sweet tooth then Add Item (sugar)
Make Drink
End
Add Item (Ingredient)
Get Ingredient from cupboard
Put Ingredient in cup
Replace Ingredient
End
Although impossible to program, this algorithm contains all the constructs used to build programs. A sequence of statements (usually grouped into functions), loops of statements and selection between alternative statements. A program is an algorithm applied to some data (usually stored in variables).
Computer Fundamentals Page 27
Task - Example Algorithms
Task 1
Come up with an algorithm for washing your hair. (Assume you are doing it in the shower!)
Task 2
What game is this algorithm design to play?
YouWorkItOutvariables cards, money, value, currentcard, lastcard, choice
cards=1 money=100 GetCard lastcard=value repeat Deal until (money<=0) or (cards>=10) print (money)end
GetCard value=Random (13)+1 print (value)end
Deal GetChoice GetCard currentcard=value CheckAnswer cards=cards+1 lastcard=currentcardend
GetChoice print ('Higher <h> or Lower <l>') input (choice)end
CheckAnswer if (choice='h' and currentcard>lastcard)
or (choice='l' and currentcard<lastcard) then money=money+25 else money=money-25end
Computer Fundamentals Page 28
Task 3
Design an algorithm to play a number guessing game. The idea is for the computer to think of a random number (say between 0 and 11) and for the user to input a guess. If the guess is too low the computer displays the message ‘Too Low’, if the guess is higher than the number picked by the computer then the message ‘Too High’ is displayed. If the guess is the same as the computers choice then ‘Correct’ is displayed. The game continues until the number has been correctly guessed.
Computer Fundamentals Page 29
Operating Systems
Computers vary considerably in size and complexity and there is a wide variety of ways in which they can be operated. Each method of operation requires a different type of operating system. (OS).
An OS is a program, or set of programs, usually written in a low level language for speed and size, which are used to manage the computer resources, memory, discs, printers etc. It acts on the raw hardware providing a software support for higher levels of software, such as translators and application programs. It also offers facilities to simplify user interaction with the computer.
Part of the OS will remain in memory controlling the running of other programs, this is the Kernel, the rest is stored on disk and is called when needed, e.g. to format a disk.
1. Hardware. (Plus Driver software)
2. OS. (Windows, Unix)
3. Translators. (Compilers, Interpreters, Assemblers).
4. Application Programs. (Stock control, Word processor etc.)
Computer Fundamentals Page 30
Modes Of Operation
Batch Processing vs Real Time
Processing is time driven. Source documents are collected over a period of time, maybe in machine readable form, (OCR, MICR, Mark sensing, Bar coding, Kimball tags) and transferred onto a transaction file. A number of jobs, (programs and data), can then be stored on disk to be run off, one after another. The user must wait for the results until the job has finished, there is no interaction. A good example of a batch system is a payroll system.
A real time OS is one that can receive input, process it and produce results quickly enough to influence the source of the input. Process control in factories or the control of traffic lights. A data processing example would be airline booking systems where customers in two different towns were trying to book seats on the same flight.
Single Program
The simplest type of OS allowing one user to run one program at a time. Early micro-computers had this type of OS. An example would be CP/M or MS-DOS as used in the first IBM PC.
Multi-Access (Timesharing or Interactive)
Many users running their programs simultaneously with each user apparently getting an immediate response. The CPU shares its time giving each user a time slice every 1/100..1/10 of a second. This is known as polling in a round robin. If the CPU finds that a user does not require any processor time it will move onto the next job, this often happens as people tend to work slower than the CPU. Input data is stored in a buffer while waiting for the next time slice.
Multi-Programming / Multi-Tasking
Where two or more programs resident in the computers main memory. Memory is partitioned and the jobs are allocated priorities for the use of peripherals. Multi-programming is suitable for both batch and interactive users. Early multi-access OS were only capable of running one program e.g. an office word processing package for use in a typing pool. Windows is an example of a multi-tasking OS.
Multi-Processing
Where there may be more than one processor in the system (or one processor with multiple cores). This allows many users to each have a dedicated processor or one user to spread the work over many processors. (Parallel processing).
Computer Fundamentals Page 31
Networks
Each user has a single processor but can share data and resources with other users connected to the network. The OS must be able to detect if more than one user is trying to send messages at the same time. Networks may make use of spooling techniques to share peripherals such as printers.
Networks may be Local Area or Wide Area, LAN or WAN. A LAN is wired together within the same site and can take a number of different forms, (topologies), Bus, Star, Ring. One machine on the network often acts as a file server looking after a high capacity storage device.
WANS are computers linked via gateways to other computers which are geographically distant. They may make use of dedicated phone lines or go through the normal BT lines using modems. They usually use packet switching techniques to transfer data between nodes.
Computer Fundamentals Page 32
The advantages of networks can be many. Each terminal has its own processing power so the user is less affected if the central computer in a multi-access system crashes. Different micros may be networked to a common system allowing data and resources to be shared whilst performance of each machine remains constant.
The ISO have defined a model for network systems that allows manufacturers to develop networks that can communicate easily. It is known as the 7 layer model.
Functions of An Operating System
The OS has four main functions. These are:
Storage Management
This includes both main memory, (immediate access storage), and backing storage.
To increase the throughput of data from memory to the processor cache memory can be used. Modern CPU's are now so fast that they have to slow themselves down to access RAM. The cache is an area of very high speed memory that is loaded with the instructions that the processor is using at that time. This is possible as most programs are sequential with only small loops in them.
Processor Management
The way in which the processor is utilised depends on the mode of operation. On single user machines the processor is dedicated to one job. On multi-access systems queues need to be kept of all the jobs.
Computer Fundamentals Page 33
Process Management
Many processes running in the same computer may, at times, come into conflict. They may want to use the same resource at the same time. The OS needs to break this deadlock if it occurs.
Device and File Management
The OS handles all input and output from/to peripheral devices. It attempts to give the user a device independent view to simplify the interface. Large systems may include 'spooling' facilities to allow a printer to be shared among a number of users.
Conclusion
Operating Systems are large and complex pieces of software. Early ones were very unfriendly with incomprehensible error messages and often taking as much as 30% of the processors time to execute. The rapid spread of computers has brought about smaller, friendlier and better integrated Operating Systems, often allowing mouse control and graphical front ends.
Computer Fundamentals Page 34
Assessed Task 1 - Windows
Windows provides an integrated, mouse driven, environment too enable the user to control the computer. Windows has a number of features and principles that make the use and management of a computer system relatively simple.
These include having:
Ease of use – graphics, icons, mouse control – point and click control. A consistent interface across applications.
Device independence – e.g. printer, screen. Once a printer is installed it can be used by all applications immediately.
Data conversion between applications. The ability to copy and paste between applications.
Co-operation between applications. The ability to run an application from within another to add functionality. (Often through the insert object menu option.)
Multi tasking facilities – to enable two programs to be run at the same time.
Describe and explain these features by reference to examples from Windows. You may use annotated screen shots to illustrate.
Computer Fundamentals Page 35
The Components Of A PC
A PC is made up of a number of standardised components. This modular nature means that components of different specifications from different manufacturers can be used together.
Case and Power Supply Motherboard (with serial and parallel interfaces - for printer, mouse and
modem)
Memory
Processor
Hard Disk
CD-ROM/DVD
Floppy Disc
Graphics Card (and monitor)
Sound Card (and speakers)
Operating System
The specification and cost of these components changes rapidly over time. They can all be purchased separately to enable people to build or upgrade their computer system.
When purchasing a complete system there are usually 3 price/performance bands. The top of the line uses the latest, highest specification components and would have an expected life of, roughly 5 years. At the bottom end a life expectancy would be 3 years but the price would probably be a third of the high-end machine. The life expectancy is determined by progress through the development of operating system software. Each new generation of OS requires more powerful equipment on which to run.
Computer Fundamentals Page 36
Task - The Components Of A PC
A PC is made up of a number of standardised components. This modular nature means that components of different specifications from different suppliers can be put together to create a complete system. Use the Internet to research the typical specification (and price) of the marked components.
Processor Name?…………………………Speed?………………………..Cost?………………………….
Hard Disk Capacity? ……………………..Cost? ………………………….
Graphics Card Memory? ………………………Cost? ………………………….
RAM Memory Quantity? ………………………Cost? ………………………….
Computer Fundamentals Page 37
Data Communications and the Internet
The area of data communications is a huge one and is, in many ways, fundamental to the area of computing. Along with the computer it has lead to the growth of Information Communication Technology, (ICT), the processing and communication of textual, audio and graphical information.
Parallel
This is a mode of communication using a multi-stranded wire. A number of bits are transmitted simultaneously. Over long distances 'skew' can occur. This is when the bits get out of sync, some arriving earlier than others. (Hence the use of a strobe line to co-ordinate pulses). However parallel transmission is fast although cabling more expensive.
Serial
Data is transmitted 1 bit at a time. In theory only 1 wire is needed but there is a need for control signals and a ground. If communication is to be 2 way then there needs to be a data in line as well as a data out line.
Interface
This is a device placed at either end of a transmission line to send and receive the binary signals. Parallel interfacing is usually fairly simple as data is transmitted in the same way as on the internal data busses. The most common serial interface is the USB. The serial interface can work in 1 of 2 ways. Asynchronously or synchronously. These methods determine the 'framing' of characters. When 2 computers are running at different speeds
Computer Fundamentals Page 38
async has to be used. Each character to be transmitted is framed by start and stop bits and may include an extra bit to check for parity.
Parity is a simple way of checking for errors in communications. The sending computer will send an extra bit to make sure that the data bits add up to either an even or odd number. The receiving computer can count the number of bits it receives and if the parity does not match then an error has occurred. ASCII is the American Standard Code for Information Interchange and is probably the best known character code.
In sync transmission both computers have to be running at the same speed. A continuous stream of bits is sent, in packets or blocks, of, say, 128 bytes. Thus a larger volume can be sent at higher speed - no need for start and stop bits. However synchronisation must be achieved and maintained, this is done by sending a stream of special characters. (SYN in ASCII). The receiving computer keeps testing the incoming signal until it recognises the character. It can then receive the data. Over time they may become unsynchronised thus a further stream of SYN's may be sent.
Buffer
Buffers are used in many places in a computer/communications system. They act as temporary storage for data as it is being transmitted. Different devices work at differing speeds, the buffer can store the data until the receiving device is ready to process it. The size of buffer is determined by the devices it is serving, a printer buffer may hold 256 Kbytes, (more for laser printers that need to buffer a whole page), a buffer used to store data going to/from immediate access memory may only hold 1 byte.
In some multi-user systems double buffering may be used where there is input or output to a number of peripherals. It allows the processor to continue working flat out when switching between jobs.
Multiplexing
This allows one data link to be used to carry signals from a number of devices. Time Division Multiplexing involves each device being given a portion of time, in turn, to send data. An example might be the use of a modem shared between 4 computers.
Modems
A good deal of data communication occurs over phone lines. Telephone lines do not carry signals in the same way as computers. A MODulator/DEModulator is used to convert serial signals from the computer into signals (tones) to be sent down the phone line.
Computer Fundamentals Page 39
Modes
Transmission is possible in 3 modes.
Simplex Transmission in one direction only.
Half Duplex Transmission in either direction but not in both directions simultaneously.
Full Duplex Transmission in both directions at the same time.
Protocols and Packets
Data is usually sent in packets, especially when sent in sync. This is combined with a set of rules, known as protocols, which specify such things as the structure and size of the packet, what control codes are to be used, what should be done when an error is detected. A packet will have a header, (it's destination, source and packet number), followed by signals to indicate start of text, end of text, end of transmission etc. The ASCII code includes such special characters as well as others such as ACK and NAK that allow machines to pass information as to the state of the transmission.
Errors
Transmitted signals can be corrupted by 'noise', especially on phone lines. Boosters are often used to take a weak signal, reconstitute it, before passing it on. It is possible to recover from errors in 2 ways. By including enough 'redundancy', (duplication), to enable the receiver to reconstruct the message. This method has high overheads especially if there are no errors. The second method is to use an error detection scheme and to request re-transmission when an error is detected.
Parity and cyclical redundancy checks can be used. CRC uses a 'checksum' that is based on a mathematical formula to derive a figure that is appended to the packet of data being sent. If an error is detected the receiver may send a NAK, depending on the type of protocols being used, and ask for, either re-transmission of the whole message or selectively the part with the error in it.
Computer Fundamentals Page 40
Switching
Switching can take 1 of 3 forms.
Circuit - This is the way the normal phone system works. A dedicated link is established between 2 computers via an exchange. The link is terminated when communication has finished.
Message - The message to be sent includes the 'address' of the destination. Thus messages can be 'stored and forwarded' to their destination when the receiving computer is not ready to accept the message. Each computer in the system must be connected to its neighbours and each link can run at different speeds. A message may go through any route to reach its destination. It is possible to broadcast messages to all nodes in the system.
Packet - Message switching may mean that large messages can hog the network, locking other people out. Packet switching splits the message into smaller messages allowing for sending a message through different routes at the same time. The physical organisation is the same as with message switching but more data needs to be sent as each packet needs header information. TCP/IP are the protocols used by the Internet to determine the size, routing and error correction mechanisms for packets of data. Typically packets are 64K large. IP protocols determine how the packets are routed whilst TCP handles error detection and correction. (212.58.224.131 is the IP address of the BBC web site)
Many Wide Area Networks are linked via packet switching, often through dedicated links. The Internet is the connection of many of such networks.
Computer Fundamentals Page 41
Packet routing means that only a local call need to be made and data can be sent anywhere in the world.
Data can take one of a number of forms over the Internet.
E-mail – using SMTP or POP3 protocols to deliver messages to post offices. Messages are retrieved when the user logs onto the system.
World Wide Web – using HTTP protocols to deliver pages of information to a client’s computers where they are viewed.
File Transfer Protocol – using FTP to download files of information.
News – using mail protocols to establish bulletin board services.
Telnet – logging into a remote computer system.
The College uses the Joint Academic Network (JANET) as its ISP. Connection is via a network that first connects all the Colleges in South Yorkshire then all the Universities in Yorkshire. This is known as the Yorkshire and Humberside Metropolitan Area Network (YHMAN). The universities are then connected to a central hub that eventually route all traffic to other networks that make up the Internet.
Computer Fundamentals Page 42
Computer Fundamentals Page 43
Assessed Task 2 – The Internet
Describe the development of the Internet with a stress on the technical, social, political and economic impact that the Internet has had and is likely to have in the near future.
The report must address the following issues.
What is required to connect to the Internet. A historical and technical perspective on the development of the
network. (Including the development of TCP/IP and routers, e-mail and the World Wide Web.)
How the use of the technology is shaping social interaction. (Both between individuals and with policy makers/government.)
How the use of the technology is going to effect economic interaction. (Both the sale of goods and services and the growth of information availability.)
The advantages to the individual offered by the Internet.
The threats to an individual posed by the Internet. (Including how the Internet may be controlled or affected by central governments or regulatory frameworks.)
The report should be 1,200 – 1,800 words.
Computer Fundamentals Page 44
Assessment Criteria
The Learner should be able to:
The Learner has achieved this outcome because s/he can:Level 2 Level 3 HE
Understand the basic hardware components of a computer system.
List the components of a computer system and how data is stored and processed.
Describe the components of a computer system and how data is stored and processed.
Describe typical limitations to the standard computing architecture.
Understand the role of operating system.
Identify the key features of an operating system.
Assess the features of a typical operating system.
Critically evaluate a range of operating systems.
Demonstrate a knowledge of computer networking and data communications.
Identify the key features of a computer network.
Assess the advantages of inter-connecting computer systems.
Evaluate the socio-economic benefits of inter-connections of computer systems.
Place the development of computer systems into an historical context.
Give examples of the development of computing in a specific area.
Describe the key issues in the development of computing in a specific area.
Critically assess the development of computer systems in a specific area.
To understand the impact of ICT on society in respect of the prevailing regulatory and advisory frameworks and examination of good practice.
List relevant good practice relating to computer hardware and operation.
Describe the impact of ICT with regard to frameworks or good practice
Critically assess the impact of ICT with regard to frameworks or good practice.
Computer Fundamentals Page 45
Various Bits and PCs (Groan)
Facts and figures
Yotta 1023 Typical MP3 Music track 4Mb
Zetta 1021 Web domains (2006) 77 million
Exa 1018 DVD 4.5Gb
Peta 1015 Human (50 years) 1010 bits
Tera 1012 Colour photo 206 bits
Giga 109 TV frame 106 bits
Mega 106 Hard disk 80Gb
Kilo 103 Floppy disk 1.4Mb
Hecto 102 RAM in PC 512Mb
Deca 101 CD-ROM 656Mb
Centi 10-1 RAM access 5-90 nanosecs
Milli 10-3 Hard disk access 5-80 millisecs
Micro 10-6 Modem 56Kbits per sec
Nano 10-9 Atoms in universe1 1080
Pico 10-12 Speed of light 3010 cm sec
Femto 10-15 This document in Word 174Kb
Atto 10-18 Internet response rate 200 millisecs
Computer Fundamentals Page 46
Zepto 10-21 Amazon database (2003) 13Tb
Yocto 10-23 Google servers2 160,000
1 Atom weighs 10-27kgs. Star weighs 1030kgs. Atoms in a star 1057. Stars in the galaxy 1011. Number of galaxies in the universe 1012 therefore Atoms in universe 1080.
2 When Google was formed the founders miss-spelt googol, which is 10100, when they registered the web site. The term googol was invented in 1938 by the 9 year old niece of a mathematician who used it when describing how big that number was.
Computer Fundamentals Page 47
The ASCII Chart
This is the 7 bit ASCII chart.
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 NUL SOH STX ETX EOT ENQ ACK BEL BS TAB LF VT FF CR SO SI
1 DLE DC1 DC2 DC3 DC4 NAK SYN ETB CAN EM SUB ESC FS GS RS US
2 SP ! " # $ % & ' ( ) * + , - . /
3 0 1 2 3 4 5 6 7 8 9 : ; < = > ?
4 @ A B C D E F G H I J K L M N O
5 P Q R S T U V W X Y Z [ \ ] ^ _
6 ` a b c d e f g h i j k l m n o
7 p q r s t u v w x y z { | } ~ DEL
Non-printing (Data Communication) Characters
NUL (Null char.)SOH (Start of Header)STX (Start of Text)ETX (End of Text)EOT (End of Transmission)ENQ (Enquiry)ACK (Acknowledgment)BEL (Bell)BS (Backspace)TAB (Horizontal Tab)LF (Line Feed)VT (Vertical Tab)FF (Form Feed)CR (Carriage Return)SO (Shift Out)SI (Shift In)DLE (Data Link Escape)DC1 (XON) (Device Control 1)DC2 (Device Control 2)DC3 (XOFF) (Device Control 3)DC4 (Device Control 4)NAK (Negative Acknowledgement)SYN (Synchronous Idle)ETB (End of Trans. Block)CAN (Cancel)EM (End of Medium)SUB (Substitute)ESC (Escape)FS (File Separator)GS (Group Separator)RS (Request to Send)(Record Separator)US (Unit Separator)SP (Space)
Computer Fundamentals Page 48
First Computer Bug
At Harvard one August night in 1945, Grace Hopper a US Navy programmer was working on an early valve powered computer (Harvard Mark 1) "Things were going badly; there was something wrong in one of the circuits of the long glass-enclosed computer," she said. "Finally, someone located the trouble spot and, using ordinary tweezers, removed the problem, a two-inch moth. From then on, when anything went wrong with a computer, we said it had bugs in it."
This is the 1945 log book now in the collection of Naval Surface Weapons Centre with the bug attached.
Computer Fundamentals Page 49
Answers to Tasks
Task – Number Conversion
1. Convert the following to Binary
15 = 0000111116 = 0001000046 = 00101110113 = 01110001223 = 11011111
2. Convert the following to Decimal
01010101 = 8510101010 = 17211110000 = 24000011111 = 3100100000 = 32
3. What is the result of adding the following Binary numbers together? Check your answers by converting to decimal.
000001010000101000001111 = 15
000011000000101100010111 = 23
000011110000000100010000 = 16
1111111100000001100000000 = 256
4. Convert the following byte
01000101 into a positive decimal integer = 6911000101 into a negative decimal integer = -5901000101 into an ASCII character = E01000101 into a positive real number = 69/256
Computer Fundamentals Page 50
Task – Logic and Truth Tables
1) I will have another beer if I have the money (M) and can stand at the bar (S) or if someone else is buying (B). Draw a truth table to solve this problem!
M S B Beer
0 0 0 0
0 0 1 1
0 1 1 1
0 1 1 1
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 1
2) Produce a truth table for the following circuit. What purpose does it seem to have?
3) Use Circuit Shop to animate the full adder circuit. Use this to produce a truth table for the circuit.
Computer Fundamentals Page 51
S R Q
0 0 0
0 1 0
1 0 1
1 1 0
A B Cin Carry Sum
0 0 0 0 0
0 0 1 0 1
0 1 1 1 0
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
4) What is this circuit doing?
Comparing A and B. If A=B then top line is active, if A<B then middle line is active, if A>B then bottom line is active.
Computer Fundamentals Page 52
Task – Processor Architecture
Visit the Intel Museum (www.intel.com) and find out what is meant by “Moore’s Law”
“In 1965, Intel co-founder Gordon Moore saw the future. His prediction, now popularly known as Moore's Law, states that the number of transistors on a chip doubles about every two years.”
Print out the graph of processor transistor development over time.
Use the Intel site to find how many transistors the Intel Core 2 Duo processor has?
291,000,000 transistors.
Computer Fundamentals Page 53
Task - Example Assembly Programs
Trace through the execution of the following assembly language programs and try to determine what they are doing. The first number is the address in memory, where the instruction or data is stored, to make it easy to follow some of the jumps. These programs can be tried on the SCAry Simulator (Simple Computer Archytecture)
Program 50 LOD 101 SUB 112 JMN 53 LOD 104 JMP 65 LOD 116 HLT10 711 9
What is the result of executing this program? The largest number is left in the accumulator. Trying different values in 10 and 11 always leaves the largest number in the accumulator.
Program 60 LOD 141 ADD 132 STO 143 LOD 124 DEC5 STO 126 JNZ 07 HLT12 313 514 0
Try entering different values into memory locations 12 and 13 and observe the results. What is this program doing? This program multiplies the contents of memory 12 by the contents of memory 13 leaving the answer in memory 14.
Computer Fundamentals Page 54
Task - Example Algorithms
Task 2
What game is this algorithm design to play?
Play Your Cards Right
Task 3
Design an algorithm to play a number guessing game. The idea is for the computer to think of a random number (say between 0 and 11) and for the user to input a guess. If the guess is too low the computer displays the message ‘Too Low’, if the guess is higher than the number picked by the computer then the message ‘Too High’ is displayed. If the guess is the same as the computers choice then ‘Correct’ is displayed. The game continues until the number has been correctly guessed.
NumberGamedim guess, computer_choice Get Random Number do Get Guess Got It Correct loop until guess=computer_choiceend
Get Random Number computer_choice:=random (12)end
Get Guess print ('Im thinking of a number between 0 and 11') input (guess)end
Got It Correct if guess=computer_choice then print ('Correct') else if guess<computer_choice then print ('Too Low') else print ('Too High')end
Computer Fundamentals Page 55