computing academy ebook

Upload: vatsalsavani

Post on 02-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Computing Academy eBook

    1/214

  • 8/10/2019 Computing Academy eBook

    2/214

  • 8/10/2019 Computing Academy eBook

    3/214

    Terms

    This publication may only be used in accordance with the terms set out at:

    http://www.computingacademy.org.uk/terms. By continuing to access this publication you

    agree to be bound by these terms.

    Computing Academy makes every reasonable e!ort to ensure the quality and accuracy of

    this publication, however errors and omissions do occur. Computing Academy does not

    guarantee that this publication is accurate, suitable or relevant for a particular syllabus or

    examination board. You are responsible for ensuring that this resources meets your needs

    and the requirements of the syllabus you are following; we will accept no responsibility or

    liability for any mistakes, errors or omissions in this publication but we will endeavour to

    correct any errors brought to our attention within a reasonable amount of time.

    ii

    http://www.computingacademy.org.uk/termshttp://www.computingacademy.org.uk/terms
  • 8/10/2019 Computing Academy eBook

    4/214

    Acknowledgements

    All images, photographs, diagrams and text are the original works of the author, with the

    exception of those acknowledgments made below.

    Every e!ort has been made to trace all copyright holders, but if any have beeninadvertently overlooked please do contact us.

    Photo Credits

    p6http://en.wikipedia.org/wiki/File:Charles_Babbage_-_1860.jpg; p10 The University of

    Manchester - used wi th permiss ion ; p27 Paul Wootton Graphics

    (www.graphicnet.co.uk); p43Gnome 3.8 CC BY-SA 3.0; p46 Google Inc; p51 Google

    Inc; p123-138 Apache OpenO"ce Screenshots used with permission from Apache.

    Apache, Apache Foo, Foo, and the Foo logo are trademarks of The Apache Software

    Foundation. No endorsement by The Apache Software Foundation is implied by the use of

    these marks; p140-145 Josh Tynjala, Logicly- used with permission; p150 London Eye:

    http://www.sxc.hu/photo/616616;

    iii

    http://www.sxc.hu/photo/616616http://www.sxc.hu/photo/616616http://www.sxc.hu/photo/616616http://www.graphicnet.co.uk/http://www.graphicnet.co.uk/http://en.wikipedia.org/wiki/File:Charles_Babbage_-_1860.jpghttp://en.wikipedia.org/wiki/File:Charles_Babbage_-_1860.jpg
  • 8/10/2019 Computing Academy eBook

    5/214

    Foreword

    Computer Science isnt a new subject.

    The science of sequencing instructions

    and developing algorithms has beenaround since the 17th Century with

    Gottfried Wilhelm Leibnizs Stepped

    Reckoner; a mechanical counting machine

    built in 1672, Johann Helfrich von Mllers

    Di!erence Engine built in 1786 and the first

    programmable computer built by Charles

    Baggage in 1812.

    Much has changed since then. Computers

    no longer fill entire buildings; indeed it is

    often the case today that we dont even

    notice computers at work.

    Computers have become so embedded in

    our everyday lives and so easy to use that

    weve stopped thinking about how they

    actually work; what goes on inside that

    box?

    This book aims to guide you through the

    fundamental principals of computer

    science, get you thinking about how to use

    computers to solve problems and get you

    excited about creating and running your

    own computer programs and games rather

    than just using existing programs and

    playinggames.

    Students and teachers can use this book

    as a companion for any Computer Science

    course: although we do not endorse any

    particular examination board, we have paidclose attention to the examination board

    specifications and believe that this text will

    prove to be an invaluable resource.

    iv

  • 8/10/2019 Computing Academy eBook

    6/214

    v

  • 8/10/2019 Computing Academy eBook

    7/214

    Contents

    1. Computer Systems ............................................................................ 8

    What Are Computer Systems 9

    Input, Process, Output 11

    Using Computer Systems 13

    Standards 18

    Further Considerations 21

    2. Hardware ............................................................................ 24

    Permanent Storage 26

    Random Access Memory 31

    ROM and Virtual Memory 33

    Central Processing Unit 35

    3. Software ............................................................................ 41

    What Is Software? 42

    Operating Systems 43

    Drivers 49

    Applications 50

    Utilities 53

    4. Data Representation ............................................................................ 54

    Binary 55

    Hexadecimal 71

    ASCII 81

    Images 85

    Sound 90

    vi

  • 8/10/2019 Computing Academy eBook

    8/214

    5. Networking ............................................................................ 95

    What Are Networks? 96

    Network Classification 101

    Network Infrastructure 103

    Network Types 107

    Network Topologies 111

    Network Protocols 114

    The Internet 117

    6. Databases ............................................................................ 128

    Thinking About Data 129

    Database Management Systems 133

    Relational Databases 138

    Queries 145

    7. Algorithms ............................................................................ 148

    Logic 149

    Sequencing 156

    8. Programming ............................................................................ 163

    Programming Languages 164

    The Basics 174

    Variables 176

    Data Types 182

    Operators 186

    IF Statements 199

    Loops 206

    Arrays 208

    Documenting Code 211

    vii

  • 8/10/2019 Computing Academy eBook

    9/214

    Computer Systems

    1Computer systems take a s

    of inputs, process them an

    create a set of outpu

  • 8/10/2019 Computing Academy eBook

    10/214

    What Are Computer Systems?

    Computers today are all around us in one form or another. Take a quick look around a

    typical home and youre sure to find many di!erent types of computers.

    There are obvious examples such as desktop computers, laptop computers, tablet

    computers and mobile phones. There are also computer systems which we take for

    granted and probably dont even think of as being computers such as alarm clocks,

    watches, washing machines and microwaves.

    The first electronic programmable computer, built in 1943 was called Colossus, but as

    Colossus could not store programs the operators had to enter the program from scratch

    each time they turned the machine on.

    9

  • 8/10/2019 Computing Academy eBook

    11/214

    The first computer able to store a program was built at Manchester University in 1948; it

    was called the Small Scale Experimental Machine, or Manchester Baby.

    The first program Baby

    ran took 52 minutes tocomplete; a modern

    computer would take

    less than a second to

    complete the same

    calculation.

    Computers can be

    dedicatedwhich means

    that they have been

    designed for a specific

    purpose such as a satellite or terrestrial television recorder, or a burglar alarm. These

    dedicated computer systems are designed to perform a specific function and nothing else.

    Computers may also be general purpose which means they do not have one main

    function, for example desktop computers and laptop computers.

    Although computers come in all shapes and sizes they share a common principle:

    Key Point

    Computers consist of a set of parts which work together to achieve acommon purpose. All computer systems take a set of inputs, process them

    and create a set of outputs. This is done through a combination of

    hardware and software.

    10

  • 8/10/2019 Computing Academy eBook

    12/214

    Input, Process, Output

    The following diagram shows a computer system in its most basic form.

    Computer systems have one or more inputswhich sense, detect and collectdata. This

    data is then processed, which can include sorting, searching andcalculating. The result

    11

  • 8/10/2019 Computing Academy eBook

    13/214

    of this processing is then output or stored for outputting later. Outputs may include

    displaying data to a screen, printing a hard copy (paper copy), or playing a sound.

    In order to be clear about whether a device is an inputor an outputdevice consider:

    Is data flowingINTOthe computer from the outside world...?

    ...or is data flowing OUTfrom the computer to the outside world?

    Here a few examples of computer hardware that you will be familiar with, separated into

    inputand outputdevices.

    Input Output

    Keyboard Monitor / Screen

    Mouse Printer

    Cashless Reader / NFC Projector

    Keypad Speakers

    TaskWrite down 3 more input and 3 more output devices that might be used as

    part of a computer system.

    12

  • 8/10/2019 Computing Academy eBook

    14/214

    Using Computer Systems

    Why are Computer Systems Important?

    Think about how many computer systems you might interact with during a typical day:

    checking text messages or email in the morning; microwaving a bowl of porridge; setting a

    burglar alarm; using a swipe card to enter a building; being observed by a CCTV security

    system...........and thats all before you even arrive at work or school.

    All day, every day, computer systems are at work; here are just a few examples.

    13

  • 8/10/2019 Computing Academy eBook

    15/214

    Description Input Process Output

    Cash MachineUser inputs their pin

    numberSystem checks that the

    pin number is valid

    Options (such as checkbalance and withdraw

    cash) output to user viathe screen

    Online Cinema Booking User selects filmSystem checks

    availability

    Available seats output touser in a diagrammaticrepresentation of the

    cinema

    Contactless PaymentUser touches contactlesscard or chip to the card

    reader

    System looks up theusers account and

    checks to see whetherthey have su"cient funds

    - if so, the account ischarged

    A message is displayedto the user stating thateither the transaction

    was successful or thatthe transaction was

    declined

    Voice-activatedSmartphone

    User speaks into themicrophone (recognised

    instructions)

    The system determineswhat has been said using

    speech recognitionalgorithms

    Depending on thecommand input, thephone may dial a

    number, perform aGoogle search, speak a

    response etc.

    Here are some further examples of where computer systems can be found.

    Retail

    Ecommerce / online shopping websites, automatic stock ordering systems, logistics /

    delivery tracking

    Communication

    Email, social networks, video calling, telephone calls, text messages

    Education

    Virtual Learning Environments (VLEs), interactive learning activities, quizzes and

    educational games

    Science

    Simulations and data processing / number-crunching

    Travel

    Flight booking and tracking, mobile app bus timetables, GPS navigation, train signalling,

    aircraft guidance 14

  • 8/10/2019 Computing Academy eBook

    16/214

    Reliability

    We rely on computer systems an awful lot. Air tra"c control systems and hospital life

    support systems are just two examples of where we quite literally put our lives in the

    hands of computer systems. We therefore need to know that they are going to be reliable.

    System designers, and the companies and individuals buying computer systems talk

    about reliability using two main measures.

    Availability

    Ideally, a computer system will be available all the time, 24 hours each day, 365 days per

    year. In reality that might not be the case due to system failure and the need to temporarily

    take a system o$ine for maintenance. Availability is one measure used to judge the

    reliability of a system. Over a period of 30 days, if the system was available without issue

    for 30 days the system availability would be 100% for this period. If the system had a fault

    and as such was out of action for 1 out of the 30 days, the system availability would be

    97% for this period ([29 / 30] * 100).

    MTBF

    Another measure of reliability is the Mean Time Between Failure (MTBF) which is a figure

    provided by hardware manufacturers who test their products and generate a MTBF value

    before they are sold. The MTBF will be the average length of time, usually in hours, that a

    particular hardware component is predicted to operate for without failure.

    Testing

    Software engineers will write millions of lines of programming code, and whilst they are

    often highly skilled, even the most experienced programmers sometimes make mistakes.

    A program to control the operation of a washing machine may seem simple when

    compared with the program used to manage and track aircraft, but even the software

    controlling that washing machine will consist of thousands of lines of code.

    Software engineers need to test their code in order to catch any errors they may have

    made. Testing is a time consuming and therefore expensive process that requires testers

    15

  • 8/10/2019 Computing Academy eBook

    17/214

    to think about every possible way a system could be used; in the case of the washing

    machine this could mean testing every possible combination of buttons that a user could

    press, testing what happens if the door isnt shut when the start button is pressed, testing

    how the system recovers if the power is cut during a wash cycle etc.

    Extensive testing should take place before software is released, whether that software is

    an air tra"c control program or just a new app for a smartphone.

    Once the software engineers are happy with the software they may first release this to a

    limited group of beta testers who may find errors also known as bugs that were missed

    by the developers.

    After a piece of software is released and put to use it will need maintenance andsoftware updates. This is necessary to fix further bugs found after release or to ensure

    the software continues to function correctly if the systems around it change. When

    smartphone operating systems receive updates, app developers sometimes need to

    perform updates of their own app in order to ensure that it will continue to run correctly on

    the updated smartphone operating system.

    Failure

    System failure could have catastrophic consequences so its important for organisations to

    be prepared, and protect against or prepare for system failure. In the context of computing

    Redundancymeans spare, excess or additional; if a computer system has redundant

    storageit means that rather than just one hard drive, it has two or three.

    High profile ecommerce and social networking websites would lose millions of pounds if

    their systems failed, so they use redundancy. If one hard drive fails, a redundant hard drive

    will take over. If an entire server fails, a redundant backup server will automatically take

    over.

    In addition to using redundant hardware, organisations who rely on hardware and data for

    their very survival will have prepared a disaster recovery plan.A disaster recover plan is

    just what it sounds like - a plan of what to do in case of a disaster such as fire, theft, flood,

    power loss, terrorist attack etc. Disaster recovery plans set out which individuals need to

    16

  • 8/10/2019 Computing Academy eBook

    18/214

    do what and when in the event of a disaster. Some individuals may need to make a

    telephone call to a di!erent city or country asking them to bring a redundant server online;

    others might need to unplug backup drives and get these to a safe location.

    TaskThink about a computer system that would be used in each of the

    following categories:

    Retail, Communication, Education, Science, Travel

    For each computer system, write down the inputs, processes and outputs

    taking place.

    17

  • 8/10/2019 Computing Academy eBook

    19/214

    Standards

    Standards

    In order to reduce system failure and make systems more reliable, developers adhere to

    standards.

    Heres an example of two systems trying to work together that dont use the same set of

    standards.

    18

  • 8/10/2019 Computing Academy eBook

    20/214

    Example

    Imagine that System Ahas been designed so that code #105means yes,everything is fine. System Asends out this code to System B to let it know.

    The problem is, System Bis using a di!erent set of standards. In System B

    code #105means please send me some data. System Bnow starts

    sending lots of data to System A.

    System Awasnt expecting this data so sends code #993to System B.

    The set of standards used by System Asay that code #993means stop, but

    the set of standards used by System Bsay that code #993means can you

    send the data faster please.

    Systems need to operate using an agreed, common set of standards otherwise they justwont work very well (or at all) together.

    Proprietary Standards

    Proprietary standards are owned and controlled by companies. The .doc and .docx file

    formats are owned by Microsoft and these file formats use a particular standard way of

    saving and presenting word processed documents. Every computer which has Microsoft

    Word installed will be able to follow this standard in order to open a .doc or .docx file

    properly.

    Similarly, Pages, the word processor created by Apple uses a di!erent standard. Microsoft

    Word does not use the same standard as Apple Pages, so you cannot open Apple Pages

    documents using Microsoft Word.

    19

  • 8/10/2019 Computing Academy eBook

    21/214

  • 8/10/2019 Computing Academy eBook

    22/214

    Further Considerations

    Environmental Considerations

    Each year the computer systems we use consume millions of Gigawatt Hours (GWh) of

    energy, and millions more GWh of energy are used on air conditioning in order to ensure

    that those systems stay cool.

    The average lifespan of a computer system - whether that be a smartphone, laptop, tabletor desktop - is 3 years. These computer systems contain lots of toxic materials such as

    mercury and radioactive isotopes, all of which ends up in landfill.

    Power consumption and waste due to computer systems is a big problem for which we do

    not yet have a solution

    21

  • 8/10/2019 Computing Academy eBook

    23/214

    Ethical Considerations

    While legalities refer to what you can or cant do under law, ethics is concerned with

    fairness; what it right and wrong. Doing something that is ethically wrong does not

    necessarily mean that it is against the law.

    Should you wish to, you could setup a business o!ering to design websites for customers

    even though you dont really know how to create websites. Ethically, you should not do

    this as its wrong and you wont be able to produce good quality websites for your

    customers; yet while ethically wrong, this would not be illegal.

    Legal Considerations

    As our use of computer systems increases, so does the range of laws and legislation to

    control and govern our use of these systems. The Data Protection Act (1998) is a law in

    place to protect peoples privacy and state what can and cannot be done with data

    collected about individuals. The Computer Misuse Act (1990) concerns unauthorised

    access to and improper use of computer systems.

    Task 1Think about 3 more activities or actions involving the use of computer

    systems that could be considered ethically wrong.

    22

  • 8/10/2019 Computing Academy eBook

    24/214

    Task 2Find out more about the Data Protection Act and the Computer Misuse

    Act.

    What can and cant organisations do with data they collect under the Data

    Protection Act?

    What exactly is and isnt allowed under the Computer Misuse Act?

    23

  • 8/10/2019 Computing Academy eBook

    25/214

    Hardware

    2Hardware describes t

    physical components of

    computer syste

  • 8/10/2019 Computing Academy eBook

    26/214

    Hardware

    Hardware vs Software

    Computer systems consist of both hardwareand software working together.

    Software

    describes the sequences of instruction, code and programs that computers execute.

    While software may be stored on a CD, DVD or USB drive these devices themselves arenot software. Software cannot be physically touched.

    Hardware

    describes the physical components of a computer system anything that can be seen

    or touched which can include input, output, storage and processing devices.

    25

  • 8/10/2019 Computing Academy eBook

    27/214

    Permanent Storage

    Computers need to be able to rememberlots of di!erent things.

    Each time you login to your computer, you expect your documents, music and photos to

    be ready and waiting for you - the computer needs to remember them all.

    Each time you advance to the next level in a computer game, you expect to earn points or

    additional lives - the computer needs to be able to remember this data both during thegame, and next time you play the game.

    When using computers today, we seem to be performing lots of di!erent tasks at the

    same time: we check our emails while having a video call with family, while browsing on

    the Internet for a new pair of shoes, while streaming a new album.

    26

  • 8/10/2019 Computing Academy eBook

    28/214

    Computers use several di!erent types of memory to ensure that they dont forget all of this

    data.

    Permanent Storage / Secondary Storage

    Hard Disk Drives (HDDs) and Solid State Drives (SSDs) are used in modern computers as

    permanent, secondary or persistent storage. When you save a piece of work or copy

    photos from your digital camera to

    your computer they will be stored on

    a HDD or SSD.

    HDD

    A HDD is a stacked set of magneticplatters or plates. These platters spin

    up to 10,000 revolutions per minute

    (rpm), and mechanical arms seek

    backward and forwards across the

    spinning platter in order to read or

    write data to a particular sector of

    the disk.

    Data is stored to a HDD by

    manipulating and adjusting the

    magnetic charge into one of two

    directions. Each direction represents

    0 (o!) or 1 (on).

    HDDs are a type of secondary or permanent storage. They are persistent which means

    that the data will remain intact even when the power is turned o!.

    In 1956 when IBM invented the first HDD it cost around $65,000 and stored about 5MB.

    Today, 100 will buy you a 5TB HDD (which is 5,242,880MB).

    27

  • 8/10/2019 Computing Academy eBook

    29/214

    As well as making it very a!ordable to store large amount of data, HDDs are fairly reliable.

    Often, when HDDs fail it is either because the disk has been corrupted due to interference from

    other magnetic sources (such as speakers), or because the mechanical parts have failed.

    Advantages Disadvantages

    Large Capacity Relies on moving parts

    Faster than optical disks e.g. DVDs Disk surface can become damaged

    Persistent storage Heavy power consumption

    Easily replaced / upgraded Noisy

    Slower read / write speed than RAM

    SSD

    A SSD can be used as an alternative to a HDD.

    Rather than using spinning platters and mechanical arms there are no moving parts in

    SSDs. SSDs use microchips to store data using electricity rather than magnetism. Special

    transistors are used which can retain their 1 (on) or 0 (o!) state even when there is no

    power.

    SSDs have very fast read / write speeds as there is no need to wait for a mechanical disk

    to spin and an arm to move into position.

    As there are no moving parts SSDs use much less power than HDDs so they are often

    used in laptop computers in order to extend battery life.

    As of 2013, SSDs are still a relatively new technology and as with all new technologies,

    when they first emerge the price is extremely high. Due to the high costs involved, the size

    of a SSD in a laptop is usually only around 300GB, compared with laptops which use

    HDDs which can be over 2TB.

    28

  • 8/10/2019 Computing Academy eBook

    30/214

    Advantages Disadvantages

    Fast read / write access Small capacity

    Robust as no moving parts Very expensive

    Low power consumption Limited life (100,000 writes)

    Silent operation

    Persistent (not volatile)

    Cloud Storage

    People like to be able to access their files, music, photos and more from anywhere at any

    time. Rather than using secondary storage such as HDDs or SSDs to store these types offiles, people are increasingly turning to cloud storage.

    Cloud storage may sound very science fiction, but all this means is that rather than storing

    your data on your own HDD or SSD, you instead upload it to the Internet where it is stored

    on a HDD or SSD in another computer or server.

    In order to access your files you can now simply login to your cloud storage system from

    any computer or device as long as you have an Internet connection. At the time of writingpopular cloud storage solutions include: Google Drive, Dropbox and iCloud.

    TaskInvestigate the di!erent types of permanent storage available. What is the

    typical size and cost for a HDD or SSD in a computer today?

    29

  • 8/10/2019 Computing Academy eBook

    31/214

    30

  • 8/10/2019 Computing Academy eBook

    32/214

  • 8/10/2019 Computing Academy eBook

    33/214

    webpage you were on when you switch to your email and then back to the web browser; it

    remembers what you have written in a word processed document, even though it hasnt

    been saved yet. Think of RAM as short term memory.

    The more RAM a computer has, the better it can perform, especially when multitasking.Lets say that you open up a music player, a photo editing program, a web browser, a

    social networking website and a word processor - all of the data to make the programs

    work needs to be loaded from permanent storage into RAM.

    RAM is known as volatile memory; when you shut down your computer and turn the

    power o!, the contents of RAM is wiped clean. All of the data is lost.

    Advantages Disadvantages

    Fast read / write access Small capacity

    Robust as no moving parts Very expensive

    Low power consumption Volatile

    Silent operation

    32

  • 8/10/2019 Computing Academy eBook

    34/214

    ROM and Virtual Memory

    Read Only Memory (ROM)

    Every time you switch on your computer it performs a sequence of tasks such as checking

    that all of the hardware is present, checking that a keyboard and mouse is connected and

    checking to ensure that the HDD or SSD contains the operating system; this is known as a

    boot sequence.

    We know that RAM is volatile, so once the computer is turned o!, everything in RAM is

    wiped. Part of the boot sequence involves checking the HDD or SSD and we know that

    these storage systems are too slow, so the instructions necessary to perform the boot

    sequence cant be stored here.

    33

  • 8/10/2019 Computing Academy eBook

    35/214

  • 8/10/2019 Computing Academy eBook

    36/214

    Central Processing Unit (CPU)

    The CPU is the brain of the computer where the sorting, calculating and searching takes

    place. Although it only looks like one chip, the CPU consists of several components:

    %Arithmetic and Logic Unit (ALU)

    % Program Counter (PC)

    % Control Unit

    % Cache

    % Buses

    35

  • 8/10/2019 Computing Academy eBook

    37/214

    ALU

    The ALU conducts the arithmetical and logical

    operations such as comparing values,

    addition, subtraction, multiplication etc.

    Program Counter

    The PC keeps count of which instructions

    have been executed and which one is next.

    The PC passes this information to the control

    unit.

    Control Unit

    The control unit keeps things ticking over

    nicely within the CPU. It uses electrical signals

    to ensure that the correct instructions are

    executed at the correct time in the correct

    order.

    Cache

    Cache is another type of volatile memory that is very quick (and very expensive).Instructions and data are loaded into cache from RAM before being passed to the CPU

    Buses

    A bus is a pathway between di!erent components of the CPU. Instructions, data and

    control signals travel through buses within the CPU to the di!erent components.

    Fetch-Decode-Execute Cycle

    Programs and data need to be fetched and loaded into RAM before they can be

    executed by the CPU. Once loaded into RAM, the processor needs to decode the

    string of binary digits being fed to it and determine whether it is receiving an

    instruction such as ADD or a data value. The CPU can then executethe instructions

    and perform the necessary calculations on the data it has been given.

    36

  • 8/10/2019 Computing Academy eBook

    38/214

    Fetch

    Get location of next instruction from Program Counter (PC), Get instruction and data by

    going to specified location in register, Update (+1) to Program Counter (so the CPU knows

    the address of the next instruction it needs to fetch)

    Decode

    The CPU now identifies the

    operation code (op-code), part

    of the instruction that has

    been fetched so it knows

    which operation to perform.

    The second part of theinstruction will contain the

    data to be operated upon.

    Execute

    The instructions and the data

    are fed to the Arithmetic and

    Logic Unit (ALU) which then

    performs the calculation. The

    result is saved back to a

    register and then back to RAM

    to be output to the user.

    Executing Instructions

    Whether its playing the latest computer game, editing an image or simply browsing the

    Internet, all of those complicated tasks are broken down into a series of simplemathematical calculations to be processed by the CPU.

    The CPU runs incredibly quickly but it doesnt store data, it simply crunches numbers. We

    know that data is stored using secondary storage such as a HDD or a SSD, but these

    devices are not quick enough to keep supplying data to the CPU at the rate at which it can

    37

  • 8/10/2019 Computing Academy eBook

    39/214

    process this data. Computer Systems therefore make use of RAM, and an even quicker

    type of memory called cache.

    This constant stream of data from the HDD (or SSD) into RAM and then into Cache means

    that there will always be data ready to pass to the CPU for executing.

    As cache is so fast and so expensive, computer systems do not have very much cache.

    There are multiple levels of cache (depending on the brand and type of CPU).

    % Level 1 (L1) cache is always built into the CPU.

    % Level 2 (L2) cache is usually either built into the CPU or on the motherboard between the

    CPU and main memory (RAM)

    % Level 3 (L3) cache is usually built into the motherboard

    Each level of cache is increasingly quicker (L1 being the quickest) but with a smaller

    capacity

    38

  • 8/10/2019 Computing Academy eBook

    40/214

    Registers

    Each CPU core executes just one instruction at a time. A typical instruction for a CPU to

    execute might be:

    ADD 8, 4

    Right before these values are passed to the ALU, they are moved from L1 cache into the

    CPU registers. Registers are very fast, very small segments of memory. Registers are

    used to temporarily store the very next instruction and data to be processed. Once the

    ALU has performed a calculation, the result of that calculation is then stored back to a

    register, before moving back through memory into cache, then into RAM.

    Hit or Miss

    If everything goes to plan, the CPU will always have enough data to process. When the

    CPU can find the next instructions in cache and load these into the registers ready to

    execute this is known as a cache hit; the data and instructions are ready and the CPU

    does not have to wait around.

    If the instructions are not ready as they are still being loaded into cache from RAM (or even

    from the HDD or SSD) the CPU will have to wait, this is known as a cache miss.

    Clock Speed

    In the human body, the beating of a heart is controlled by the Sinoatrial Node (SAN); some

    individuals with heart conditions need to have a pacemaker fitted in order to replicate the

    functionality of the SAN. The SAN (or pacemaker) causes the heart to beat and at that

    moment oxygenated blood is pumped out of the heart and around the body, and

    deoxygenated blood is pumped out of the heart into the capillaries surrounding the lungs

    39

  • 8/10/2019 Computing Academy eBook

    41/214

  • 8/10/2019 Computing Academy eBook

    42/214

    Software

    3Software describes t

    sequences of instructio

    code and programs th

    computers execu

  • 8/10/2019 Computing Academy eBook

    43/214

    What Is Software?

    We know that Computer systems consist of both hardware and software working together

    and weve explored hardware (the physical components of a computer system anything

    that can be seen or touched which can include input, output, storage and processing

    devices). So what is software?

    Software describes the sequences of instruction, code and programs that computers

    execute; the computer games, smartphone apps, operating systems and applications that

    run on hardware.

    There are several types or categories of software.

    42

  • 8/10/2019 Computing Academy eBook

    44/214

    Operating Systems

    An operating system (OS) is a collection of programs that control the system hardware

    resources. The OS manages the flow of data between permanent storage (HDDs and

    SSDs), main memory (RAM) and the CPU. The OS also controls communication with

    peripherals connected to the computer system such as the keyboard and mouse.

    An OS can be found running on almost all computer systems from digital television

    recorders and smartphones to games consoles and web servers. Other software such as

    word processors and web browsers rely on the OS and could not function without it.

    43

  • 8/10/2019 Computing Academy eBook

    45/214

    SecurityPart of managing the system involves protecting users, system resources and files. There

    is a danger when passing data between permanent storage, main memory and the CPU

    that data could be lost, corrupted or overwritten - it is the job of the OS to ensure that this

    does not happen and prevent conflicts.

    One computer is not necessarily used by just one person. In schools, businesses and

    even at home, computers need to manage several user accounts and ensure that the

    correct files and access permissions are granted to the correct users.

    Graphical User Interface (GUI)

    When we use computer systems we manipulate windows, click on buttons, and scrollthrough menus.

    We use a mouse to control a cursor on the screen and navigate this cursor to the icon we

    wish to click on. This type of interface is called a Graphical User Interface (GUI). GUIs

    44

  • 8/10/2019 Computing Academy eBook

    46/214

    allow users to interact with the system using graphical icons and visual indicators; today

    this is the most common way for home users to interact with computer systems.

    The way we interact with computer systems continues to change and develop. We are

    increasingly using touch, voice and even gesture commands to control our computersystems.

    Command-Line InterfaceBefore GUIs were developed, computer users had to type in each command they wanted

    to give to the computer using a command-line interface. While today home users find

    using a GUI easier, many systems administrators, programmers and expert users still

    prefer to use the command-line as it can allow greater control and speed up certain

    processes.

    Windows

    Developed by Microsoft, the Windows series is still the most popular operating system for

    personal computers. The first version of this proprietary commercial OS was released in

    1985 and called Windows 1.0. The latest version, Windows 8, was released in 2012.

    45

  • 8/10/2019 Computing Academy eBook

    47/214

    Mac OSThe first version of Mac OS was released in 1984 and was simply known as the system.

    It was not until 1996 when the software became known as Mac OS. The latest version is

    known as OS X Mountain Lion and was released in 2012.

    LinuxAlthough not as popular as an OS for home PCs, most of the websites that we visit and

    the online services that we use are hosted on computers that run a Linux OS. As Linux is

    open source, any developer can freely access the source code and modify it as they

    wish; this has led to the development of many di!erent versions or distributions of Linux

    including Debian, Ubuntu, Fedora and Red hat.

    Linux is a popular choice for embedded systems and can be found controlling many

    modem routers, digital and satellite television recorders and smartphones. In fact, almost

    30% of smartphones in use today run a version of Linux. Did you know that Android is a

    modified version of Linux?

    Mobile Operating SystemsMobile devices are designed to be used di!erently to home

    PCs. They need to consume less power as they run on a

    battery, the screen is smaller so information needs to be

    laid out appropriately, and today, most smartphones accept

    touch or voice commands rather than input from a

    keyboard. As such, standard operating systems were not

    suitable to be used on mobile devices and developers had

    to build specialist platforms suitable for this type of device.

    Palm developed Palm OS and Windows developed

    Windows CE in 1996, Nokia launched S40 OS (Java ME) in

    1999 and Symbian brought out their OS in 2000.

    Blackberry brought out their OS in 2002 and this provided

    extremely popular with business users before Apple

    launched iOS on the first iPhone in 2007. Google released

    46

  • 8/10/2019 Computing Academy eBook

    48/214

  • 8/10/2019 Computing Academy eBook

    49/214

    Task

    Conduct some research using the Internet to find an example of acomputer system controlled by touch, voice and gesture.

    48

  • 8/10/2019 Computing Academy eBook

    50/214

    Drivers

    While the OS takes on much of the responsibility for controlling and managing peripherals

    such as the mouse, keyboard and printer, it needs a little help. There are thousands of

    manufacturers, producing thousands of di!erent products that you might wish to connect

    to your computer system; many of these peripherals may have been designed after the OS

    was released - so there is no way that an OS can possibly be prepared to communicate

    with and control peripherals without some additional help.

    Device Drivers are small programs written by the hardware designers specifically for a

    piece of hardware. When you purchase a new printer or webcam it normally comes

    packaged with the drivers, or instructions about where on the Internet you can download

    the drivers. A driver recognises signals sent from a piece of hardware and translates these

    so that the OS understands.

    49

  • 8/10/2019 Computing Academy eBook

    51/214

  • 8/10/2019 Computing Academy eBook

    52/214

    CustomSometimes, o!the shelf software is too generic and doesnt quite work in the way youd

    like it to. Some companies have very specific requirements and need software to work in a

    very specific way, look a certain way or integrate with existing computer systems in a

    certain way. If o!the shelf software does not give businesses the control they need over

    the software, they can commission a developer to build a new, custom written application.

    There is often a significant cost involved in this, and as the software needs to be designed,

    built and tested - it is not available immediately.

    Software as a Service (SaaS)Traditionally, if you wanted an application to perform a certain job you would go to a high

    street or online store and buy it. Once installed on your computer it was yours to use. Aftera period of time a new version of the software with new features might have been released

    and you could choose to go and

    buy the latest version, or

    continue to use the (slightly out

    of date) version you already

    owned.

    Increasingly, users are now

    turning to Software as a Service

    (SaaS) as an alternative. SaaS

    invo lves users access ing

    applications via the Internet

    (usually using a web browser).

    The software is not installed on

    the users computer but isinstead hosted centrally on a

    server in the cloud.

    Unlike traditional software where

    t h e u s e r p u r c h a s e s t h e

    application once, SaaS is usually sold on a subscription basis with users paying a monthly

    51

  • 8/10/2019 Computing Academy eBook

    53/214

    fee to access this on-demand software. Although some users may prefer to own

    software rather than rent it, SaaS does mean that users always have access to the latest

    version of the software and can access it from any computer with an Internet connection.

    Some SaaS is actually free; examples include Google Drive and Apple iCloud which allowusers to access word processing, spreadsheet and presentation applications over the

    Internet which are not installed on their home computers.

    SaaS does rely on a stable, reasonably fast Internet connection and as such has only

    become a possibility in recent years as higher bandwidth broadband services have

    become available.

    Proprietary vs Open SourceProprietarysoftware is developed commercially to be sold in order to make money. The

    developer owns the software and they allow customers to use it by selling them a license.

    Only the owner of the software - the intellectual property - has the right to sell it and

    modify it.

    As proprietary software is sold, customers can expect a reasonable level of service and

    support; there is usually a help website, telephone number or email address.

    Open source software is not owned by anyone. Developers write the software either

    individually or as part of a community and make it freely available. Anyone can then use

    the software as it is, or edit and the source code to make new versions of the software.

    52

  • 8/10/2019 Computing Academy eBook

    54/214

    Utilities

    We know that the operating system (supported by device drivers) take care of the

    hardware in a computer system and provide a platform on which applications can run. In

    addition to application software, computer systems often run small maintenance programs

    or utilities.

    Anti-virus software, firewall software, disk management software and backup software are

    examples of utilities. Often these programs run in the background and perform their jobs

    without us even knowing that they are there.

    53

  • 8/10/2019 Computing Academy eBook

    55/214

    Data Representation

    4Representing data with

    computer systems is done

    turning switches on and o

  • 8/10/2019 Computing Academy eBook

    56/214

    Binary

    What is Binary?

    We need to be able to store data within a computer system and transfer it from one

    computer to another, for example when sending emails, storing images, and playing

    sound.

    Electronic devices such as computers consist of thousands of tiny electronic switches.

    The basics of any electronic device means either electricity is flowing or it is not i.e. a

    switch is either on or o!. Representing data within a computer system is done by turning

    switches on and o!.

    How on earth can we represent letters, reports and essays, videos and sounds with just 1

    and 0? Thats exactly what computers do and its called Binary.

    55

  • 8/10/2019 Computing Academy eBook

    57/214

    Example

    So, data is passed through and stored in computers by turning on and o!

    lots of tiny switches.

    Switches are either ON (1) or OFF (0) therefore data in a computer can

    only be represented by two numbers...1 and 0.

    The normal number system that we use everyday and is very familiar to us has 10 di!erent

    symbols 0, 1, 2, 3, 4, 5, 6, 7, 8, 9. We use these symbols to write numbers, so 629means 6 lots of 100, 2 lots of 10 and 9 1s. In primary school we may have seen this

    written in a table:

    Hundreds (100) Tens (10) Units (1)

    6 2 9

    When learning basic maths at school, decimal tables are sometimes used like this one

    (below). If we had one unit and we multiply it by 10 we get one ten. If we multiplied one ten

    by 10 wed end up with one hundred and so on.

    Thousands Hundreds Tens Units

    56

  • 8/10/2019 Computing Academy eBook

    58/214

    The column values are 10 times the value in the previous column moving from right to left.

    This is called the base 10 system, or the denaryor decimalsystem.

    Computers do not use the decimal system. They use a system based on just two

    numbers: 1 and 0. This is called the binaryor base 2 system.

    In the same way that we multiply by 10 in the denary system to move across from right to

    left, when using the binary system, multiplying by 2 moves across to the left.

    See how we move across from right to leftwith 1, 2, 4, 8, 16, 32, 64, 128.

    128 64 32 16 8 4 2 1

    Binary Units

    When using the denary (base 10) system we assign certain numbers special names, for

    example 10 & 10 & 10 is 1000 which we call a thousand. 1 thousand multiplied by 1

    thousand is called 1 million etc.

    Binary also has some special names to refer to certain values.

    The basic unit is 0 or 1 this is a binary digitor bit.

    When talking about storing and transferring data within a computer system we talk about

    bits and bytes. Bit is short for Binary Digit and a byte contains 8 bits. A nibble is

    half of one byte (4 bits).

    57

  • 8/10/2019 Computing Academy eBook

    59/214

  • 8/10/2019 Computing Academy eBook

    60/214

    Denary to Binary

    Performing conversation from denary to binary is also really simple.

    Lets say wed like to convert the denary number 37 into binary. First well need our binary

    column headers.

    128 64 32 16 8 4 2 1

    Now, looking at our target number of 37 we can ask ourselves, do we need 128 to get to

    37?

    The answer is of course, no. 128 is too big. We can put a 0 down in the 128 column.

    128 64 32 16 8 4 2 1

    0

    We can then ask, do we need 64 to get to 37? The answer is again no as 64 is bigger than

    36. We put down another 0 in the 64 column.

    128 64 32 16 8 4 2 1

    0 0

    Next, we have 32. Can we use 32 to get to 37? Yes! 32 is smaller than our target of 37 so

    we can use it. Well put a 1 in the 32 column to show that were using it.

    128 64 32 16 8 4 2 1

    0 0 1

    We wanted 37, so far we have 32, so were still in need of 5. Can we use 16 to get 5? No:

    too big. Can we use 8 to get 5? No: too big. We can put 0 down in the 16 and the 8

    column.

    59

  • 8/10/2019 Computing Academy eBook

    61/214

  • 8/10/2019 Computing Academy eBook

    62/214

  • 8/10/2019 Computing Academy eBook

    63/214

    Task

    Here are some more binary numbers for you to convert to decimal but itsa little more tricky as you dont have the headings to show you what each

    bit represents. The first one has been done for you.

    Binary Decimal

    1 10000000 128

    2 00101001

    3 10101010

    4 1000011

    5 11111111

    TaskWork out what numbers are being represented here in decimal and write

    down the binary equivalent. The first one has been done for you.

    Decimal Binary

    1 1 00000001

    2 6

    3 24

    4 9

    5 131

    62

  • 8/10/2019 Computing Academy eBook

    64/214

  • 8/10/2019 Computing Academy eBook

    65/214

    8 4 2 1

    0 1 0 1

    + 0 1 1 1

    1. To add these two numbers, we first consider the 1 column and calculate 1 + 1 which

    equals 2. In binary 2 is written as 10. We carry the 1 to the 2 column and leave the 0

    in the 1 column.

    8 4 2 1

    0 1 0 1

    + 0 1 1 1

    1 0

    2. Moving on to the 2 column, we calculate 1 + (0 + 1), which again in binary is 10. We

    carry the 1 to the 4 column and leave the 0 in the 2 column.

    8 4 2 1

    0 1 0 1

    + 0 1 1 1

    1 0 0

    3. We now look at the 4 column and calculate 1 + (1 + 1). This equals 3 which in binary is

    written as 11. We carry 1 to the 8 column and leave 1 in the 4 column.

    8 4 2 1

    0 1 0 1

    + 0 1 1 1

    1 1 0 0

    64

  • 8/10/2019 Computing Academy eBook

    66/214

    4. Looking at the 8 column we see that there are no further 1s to add together which

    leaves us with an answer of 1100, or 1 lot of 8, 1 lot of 4, 0 lot of 2 and 0 lot of 1. 1100 is

    the binary equivalent of 12.

    8 4 2 1

    0 1 0 1

    + 0 1 1 1

    1 1 0 0

    Here is another example, this time adding together the binary numbers:

    0110101 plus 0001101.

    64 32 16 8 4 2 1

    0 1 1 0 1 0 1

    + 0 0 0 1 1 0 1

    1 0 1 + 1 = 10 (carry the 1)

    1 0 1 + (0 + 0) = 1

    1 0 1 0 1 + 1 = 10 (carry the 1)

    1 0 0 1 0 1 + (0 + 1) = 10 (carry the 1)

    1 0 0 0 1 0 1 + (1 + 0) = 10 (carry the 1)

    1 0 0 0 0 1 0 1 + (1 + 0) = 10 (carry the 1)

    1 0 0 0 0 1 0 1 + (0 + 0) = 1

    So the answer is 1000010 (the binary equivalent of 66).

    65

  • 8/10/2019 Computing Academy eBook

    67/214

  • 8/10/2019 Computing Academy eBook

    68/214

  • 8/10/2019 Computing Academy eBook

    69/214

  • 8/10/2019 Computing Academy eBook

    70/214

  • 8/10/2019 Computing Academy eBook

    71/214

    If we convert the result back to decimal form....

    128 64 32 16 8 4 2 1

    0 0 1 0 1 0 0 0

    we have 1 lot of 32 and one lot of 8 which is 40.

    Our original problem was 49 - 9 which is 40. So it worked!

    70

  • 8/10/2019 Computing Academy eBook

    72/214

  • 8/10/2019 Computing Academy eBook

    73/214

    Binary to HexadecimalThe binary number for 143 is: 10001111.

    128 64 32 16 8 4 2 1

    1 0 0 0 1 1 1 1

    This uses 8 bits or 1 byte of data. In order to covert this binary number into hex, we first

    split the 1 byte into 2 nibbles (each of 4 bits).

    8 4 2 1 8 4 2 1

    1 0 0 0 1 1 1 1

    Notice that we also change the column headers so that each nibble uses. 8, 4, 2, 1. We

    can now work out the value of each nibble.

    8 4 2 1 8 4 2 1

    1 0 0 0 1 1 1 1

    = 8 8 + 4 2 + 1 = 15

    The symbols used in hexadecimal are 0-9 and then A-F. So, any number larger than 9 will

    be represented by a letter. 15, is therefore represented by F.

    8 4 2 1 8 4 2 1

    1 0 0 0 1 1 1 1

    8 F

    10001111 in binary is 8F in hex. Here is another example.

    72

  • 8/10/2019 Computing Academy eBook

    74/214

    The binary number for 111 is: 01101111

    128 64 32 16 8 4 2 1

    0 1 1 0 1 1 1 1

    8 4 2 1 8 4 2 1

    0 1 1 0 1 1 1 1

    4 + 2 = 6 8 + 4 + 2 1 = 15 (F)

    01101111 in binary is 6F in hex

    TaskConvert the following binary numbers to hexadecimal. The first one has

    been done for you.

    Decimal Binary Working Out... Hex

    54 00110110

    0011

    3

    0110

    6 36

    195 11000011

    99 01100011

    101 01100101

    200 11001000

    73

  • 8/10/2019 Computing Academy eBook

    75/214

  • 8/10/2019 Computing Academy eBook

    76/214

    8 4 2 1 8 4 2 1

    0 0 1 1 1 0 1 0

    2 + 1 = 3 which gives is 0011. In hex, A represents 10 which we get from 8 + 2. 3A in hex

    is therefore 00111010 in binary.

    TaskConvert the following hexadecimal numbers to binary. The first one has

    been done for you.

    Hex Working Out... Binary

    9D

    9

    9

    1001

    D

    13

    1101

    10011101

    77

    F2

    A0

    13

    75

  • 8/10/2019 Computing Academy eBook

    77/214

    Hexadecimal to DenaryRather than using the column headers for denary:

    1000 100 10 1

    ...or for binary:

    128 64 32 16 8 4 2 1

    ...we use just:

    16 1

    If we then wish to convert the hex number 9F into denary we can note this down below the

    column headers.

    16 1

    9 F

    We now need to multiply each valueby the column headeras follows

    16 1

    9 F

    9 x 16 = 144 F x 1 = 15

    9 x 16 = 144, and F (which represents 15) x 1 = 15. We then add together the two values:

    144 + 15 = 159. So, 9F in hex is the equivalent of the denary number 159.

    76

  • 8/10/2019 Computing Academy eBook

    78/214

    Here are some more examples:

    16 1

    5 D

    5 x 16 = 80 D x 1 = 13

    5D in hex = 93 in denary

    16 1

    7 6

    7 x 16 = 112 6 x 1 = 6

    76 in hex = 118 in denary

    16 1

    C 3

    12 x 16 = 192 3 x 1 = 3

    C3 in hex = 195 in denary

    77

  • 8/10/2019 Computing Academy eBook

    79/214

  • 8/10/2019 Computing Academy eBook

    80/214

  • 8/10/2019 Computing Academy eBook

    81/214

  • 8/10/2019 Computing Academy eBook

    82/214

    ASCII

    In 1960 the American Standards Association developed a standard set of codes to be

    used in telegraph systems to represent the main characters used in communications; this

    set of codes is known as ASCII (American Standard Code for Information Interchange).

    ASCII allows us to represent all alphabetic upper and lower case characters, all numeric

    characters, 32 punctuation and other symbols including space and 32 reserved non-

    printable codes.

    81

  • 8/10/2019 Computing Academy eBook

    83/214

    ASCII Table

    ASCII Char ASCII Char ASCII Char ASCII Char

    0 NULL 32 65 A 97 a

    1 SOH 33 ! 66 B 98 b

    2 STX 34 67 C 99 c

    3 ETX 35 # 68 D 100 d

    4 EOT 36 $ 69 E 101 e

    5 ENQ 37 % 70 F 102 f

    6 ACK 38 & 71 G 103 g

    7 BEL 39 72 H 104 h

    8 BS 40 ( 73 I 105 i

    9 HT 41 ) 74 J 106 j

    10 LF 42 * 75 K 107 k

    11 VT 43 + 76 L 108 l

    12 FF 44 , 77 M 109 m

    13 CR 45 - 78 N 110 n

    14 SO 46 . 79 O 111 o

    15 SI 47 / 80 P 112 p

    16 DLE 48 0 81 Q 113 q

    17 DC1 49 1 82 R 114 r

    18 DC2 50 2 83 S 115 s

    19 DC3 51 3 84 T 116 t

    20 DC4 52 4 85 U 117 u

    21 NAK 53 5 86 V 118 v

    22 SYN 54 6 87 W 119 w

    23 ETB 55 7 88 X 120 x

    24 CAN 56 8 89 Y 121 y

    25 EM 57 9 90 Z 122 z

    26 SUB 58 : 91 [ 123 {

    27 ESC 59 ; 92 \ 124 |

    28 FS 60 < 93 ] 125 }

    29 GS 61 = 94 ^ 126 ~

    30 RS 62 > 95 _ 127 DEL

    31 US 63 ? 96 ` 128

    64 @

    82

  • 8/10/2019 Computing Academy eBook

    84/214

    While ASCII was useful for textual messages, it did not allow non-English language

    characters or mathematical symbols to be represented. Today we use the Unicode system

    which allows us to encode all characters. ASCII is now a subset of Unicode, so 78

    represents the letter N in ASCII and in Unicode.

    When typing the words She"eld Wednesday into a computer, the following sequence of

    ASCII codes is generated.

    S h e f f i e l d W e d n e s d a y

    83 104 101 102 102 105 101 108 100 32 87 101 100 110 101 115 100 97 121

    Remember, that computers cannot deal with decimal numbers, so these ASCII codes then

    need to be converted into binary to be processed by the CPU or stored.

    83

  • 8/10/2019 Computing Academy eBook

    85/214

    Character ASCII Binary Character ASCII Binary

    S 83 01010011 W 87 01010111

    h 104 01101000 e 101 01100101

    e 101 01100101 d 100 01100100

    f 102 01100110 n 110 01101110

    f 102 01100110 e 101 01100101

    i 105 01101001 s 115 01110011

    e 101 01100101 d 100 01100100

    l 108 01101100 a 97 01100001

    d 100 01100100 y 121 01111001

    Space 32 00100000

    TaskWrite a phrase or short sentence and convert this into ASCII codes. Pass

    your code (without the original) to a friend and ask them to convert this

    back into English.

    You could even convert the phrase or sentence into ASCII codes and then

    into binary and ask a friend to work out what the original message said.

    84

  • 8/10/2019 Computing Academy eBook

    86/214

  • 8/10/2019 Computing Academy eBook

    87/214

  • 8/10/2019 Computing Academy eBook

    88/214

    This photograph of the Sacr-Cur Basilica de Montmartre in Paris originally used 293KB

    of space to store. The colour depth of the image has been reduced below. Notice what

    happens to the image and the amount of memory used to store the image.

    1 bit colour (2 colours) [12KB] 2 bit colour (4 colours) [18KB]

    3 bit colour (8 colours) [28KB] 8 bit colour (256 colours) [95KB]

    The more colours used, the greater the colour depth, and the more space required to store

    the data.

    87

  • 8/10/2019 Computing Academy eBook

    89/214

  • 8/10/2019 Computing Academy eBook

    90/214

    If we zoom in on the 2 bit (4 colour) version of the Sacr-Cur Basilica de Montmartre

    image we can clearly see the 4 colours used.

    The computer uses 2 bits to store the four colours; each colour is assigned a binary value.

    00 01 10 11

    As images are stored as 1s and 0s, the computer needs to know how to interpret thesebinary numbers and display the image. Metadata means data about the data and is

    included with each image. The metadata specifies the colour depth (e.g. 2 colours, 4

    colours, 256 colours etc.) and the height and width of the image in pixels

    89

  • 8/10/2019 Computing Academy eBook

    91/214

  • 8/10/2019 Computing Academy eBook

    92/214

  • 8/10/2019 Computing Academy eBook

    93/214

    X (Time) Y (Frequency)

    0 25

    1 30

    2 20

    3 15

    4 30

    5 5

    6 10

    7 5

    8 25

    9 0

    10 10

    Once a sound wave has been sampled and the tone recorded as a sequence of number

    values, it is easy to convert these values into binary for processing and storage.

    If we increase the sample frequency and record the values of the curve more often the

    digital representation of the audio will sound much closer to the original analogue version

    as more tones (high and low sounds) can be recorded as illustrated in the following chart.

    92

  • 8/10/2019 Computing Academy eBook

    94/214

  • 8/10/2019 Computing Academy eBook

    95/214

    Recording 16 bit audio sampled at 44,100Hz means that the audio will play at

    1,411.2kbps; this is standard CD quality sound

    300kbps MP3s are compressed audio files with a reduced bit rate and reduced sample

    frequency. MP3s will have a reduced range of tones due to the lower sample rate, and areduced range of pressures due to the reduced bit rate.

    94

  • 8/10/2019 Computing Academy eBook

    96/214

  • 8/10/2019 Computing Academy eBook

    97/214

    What Are Networks?

    Stand-alone computers are devices that are not connected to any other computer

    system. A user can interact with a stand-alone computer and input data; the computer

    may then process the data and output information back to the user, but no data is

    exchanged with any other systems.

    While stand-alone computers were once extremely useful, computer scientists wanted to

    coordinate and pass information between computer systems in di!erent locations and so

    built networks; today we could not live without them.

    96

  • 8/10/2019 Computing Academy eBook

    98/214

  • 8/10/2019 Computing Academy eBook

    99/214

    The network was designed to allow communications between military installations around

    the the United States; data on the network did not have to travel one particular route from

    source to destination; it could instead travel via any other nodes on the network. This was

    important, as ARPANET was designed to still function even if large portions of it were

    destroyed.

    It is said that ARPANET was designed to ensure messages could be sent even if some

    areas of the country were destroyed due to nuclear war. Considering the previous map, if,

    for example, HARVARD needed to send a message to UTAH, this could go from HARVARD

    -> BBN -> MIT -> ILLINOIS -> UTAH. In the event that ILLINOIS was destroyed, however,

    the message could instead take the route: HARVARD -> BBN -> RAND -> SDC -> UTAH.

    Although originally conceived for military purposes, computer scientists quickly

    recognised non-military application for computer networks. Today, we use networks on a

    daily basis; examples include mobile phone networks, home computer networks and of

    course, the Internet.

    98

  • 8/10/2019 Computing Academy eBook

    100/214

    Advantages of Networks

    BackupBacking up data is much easier when all files are stored centrally on a

    networked file server.

    Communications

    Whether its email, video conferencing, instant messaging or file sharing -

    it wouldnt be possible without networks. The physical infrastructure

    (cables and hardware) allow us to communicate instantly with people

    around the world. Without networks communications would have to take

    place face-to-face which would be much more costly and time consuming.

    Device Sharing

    Businesses often need to print and scan documents, but not every single

    computer in the office needs a printer and a scanner. These peripherals

    can be connected to the network so that any computer on the network can

    access them.

    Distributed Systems

    When connected via a network it is possible to use several computers to

    process the same data in order to speed up the process. The Search for

    Extraterrestrial Intelligence (SETI) project distributes massive amounts of

    data collected by radio telescopes via the Internet to the computers of 3

    million volunteers for processing.

    File / Database Sharing

    Networks allow files and databases to be shared and accessed by more

    than one person in more than one location. All users access the same,up-to-date / live version of the data which makes collaboration possible.

    Security

    Networks usually have a central server which is responsible for managing

    permissions and access rights. The network administrator can allow and

    revoke access to files and resources and easily review server logs should

    a problem or security breach occur. It is much easier to investigate a

    problem when this can be done from the central server without needing to

    visit several stand alone computers.

    Software Sharing

    When several computers require the same software (such as word

    processing software and an email client), networks make it possible to

    remotely install this software from the server. It is not necessary to go to

    each computer individually to install the software, Maintaining the

    software and installing updates is also far easier over the network.

    99

  • 8/10/2019 Computing Academy eBook

    101/214

  • 8/10/2019 Computing Academy eBook

    102/214

    Network Classification

    Local Area Network (LAN)A LAN is a collection of computer systems (and peripherals such as printers) connected

    together. A LAN will link computer systems within a building and even across several

    buildings on the same site (within the same geographical region), for example, the

    computer systems within a university campus (that has several buildings) will be

    connected together using a LAN. The organisation, in this case the university, isresponsible for installing and managing the network and the network infrastructure

    (including all of the cabling).

    Wide Area Network (WAN)While a LAN is a collection of computer systems connected together on a single site, a

    wide area network (WAN) is a collection of computer systems connected using additional,

    101

  • 8/10/2019 Computing Academy eBook

    103/214

  • 8/10/2019 Computing Academy eBook

    104/214

    Network Infrastructure

    In order to build computer networks, we need infrastructure including servers, clients,

    network interfaces and cables.

    ServersServers are powerful computers that serve smaller client computers on the network. They

    provide and manage services which may include printing (print servers), access to files (file

    servers), websites (web servers) etc. One server may provide services to thousands of

    client computers.

    ClientsThe computers most of us use on a daily basis are clients. These are less powerful than

    servers and rely on servers to provide certain services. If, for example, you wanted to print

    103

  • 8/10/2019 Computing Academy eBook

    105/214

    a document to a networked printer, your computer (client) would send the request to a

    print server; the print server would be receiving lots of requests from other clients too and

    would need to manage these in a print queue. When you wish to view a webpage, the web

    browser application on your computer (client) would connect to the web server and

    request a webpage; the web server would be receiving lots of requests from other clients

    too and would need to manage these.

    Network Adapter / Network Interface CardIn order to be able to connect to a network, your computer must have a network

    interface card (NIC) or adapter. A NIC is a special piece of hardware built into most

    modern portable computer systems and can be a wired NIC or a wirelessNIC. NICs can

    be purchased and added to desktop computer systems if they do not already have one.

    HubsIf you have several computer systems that youd like to connect to a network, you can

    connect them all to a hub. When a packet of data arrives into a hub it is sent out to all

    connected clients.

    104

  • 8/10/2019 Computing Academy eBook

    106/214

    SwitchesOften, you dont want to send data to every client on a network. A switch is an intelligent

    hub that can filter the data it receives and only send it on to the intended recipient(s).

    Switches manage the flow of packets of data sent across networks and ensure that data

    gets to the right place.

    ModemsA modulator-demodulator (Modem) is used to convert the digital information used by

    computer systems into analog signals that can be transmitted across the telephone

    network.

    RoutersRouters are used when connecting together more than one network; they ensure that

    network tra"c is transmitted and received properly from one network to the next. Routers

    may be used when connecting together two local area networks (LAN), a LAN to a wide

    area network (WAN), or a LAN to the Internet.

    IP Addresses

    In order to successfully send a message from one computer to another, we need to knowwhere to send it. When computers connect to a network they are assigned an Internet

    Protocol (IP) address; this is a unique address which is di!erent to every other address

    on the network.

    IP addresses consist of 4 groups of decimal numbers such as: 74.125.224.72

    Each decimal number represents a binary byte and computer systems will communicate

    using binary - we however, write IP addresses in decimal form as its easier for us tounderstand.

    The IP address: 74.125.224.72would be transmitted and read by computer systems as:

    01001010 01111101 11100000 01001000

    105

  • 8/10/2019 Computing Academy eBook

    107/214

    IP addresses can be static, so that a computer will always have the same address, or

    dynamic, so that a computer may be allocated a di!erent address each time it connects

    to the network.

    MAC AddressesUnique Media Access Control (MAC)addresses are allocated to every Network Interface

    Card (NIC) by the manufacturer. Every network interface has a di!erent MAC address, so a

    laptop with a wired network connection and a wireless network connection will have 2

    di!erent MAC addresses.

    MAC addresses consist of six pairs of hexadecimal numbers such as: C1:B3:57:12:C1:F2

    BandwidthBandwidth describes how much data can be transmitted through a medium - which could

    be wired or wireless - at one time. If a network is being used by several users at the same

    time - all of whom are transmitting or receiving data - the network may slow down as there

    is not su"cient bandwidth.

    Bandwidth is measured in bits per second (bps).

    106

  • 8/10/2019 Computing Academy eBook

    108/214

    Network Types

    Peer-to-peerIn a peer-to-peer network there is no central control or administration; all computers

    connected to the network are equal. Files, software, email and printers are managed by

    each user individually on their own computer.

    While a peer-to-peer network is easy to configure (you just need to connect each

    computer to a hub), they do have limited use because there is no central control so each

    user is responsible for installing their own software updates, managing their own security,

    performing their own backups etc.

    107

  • 8/10/2019 Computing Academy eBook

    109/214

  • 8/10/2019 Computing Academy eBook

    110/214

  • 8/10/2019 Computing Academy eBook

    111/214

    along to the next node. If one node is busy, or o$ine, the packet can be routed via a

    di!erent node.

    Packets that make up the same file, may travel to their destination via di!erent routes and

    may arrive at their destination in any order. The Transmission Control Protocol (TCP) isresponsible for ensuring that all expected packets have been received and that they are

    then reassembled in the correct order.

    110

  • 8/10/2019 Computing Academy eBook

    112/214

    Network Topologies

    There are several ways of configuring a computer network, each with benefits and

    drawbacks. An organisation looking to setup a network will need to consider costs and

    performance when choosing which topology (configuration) to use.

    111

  • 8/10/2019 Computing Academy eBook

    113/214

    BusBus networks feature a central backbone cable to which all computer nodes including

    servers and printers are connected.

    When any computer

    on the network needs

    to pass data to another

    computer, the packet

    of data is sent down

    t h e b u s i n b o t h

    directions to every

    computer node on thenetwork unt i l the

    intended recipient is

    found. If more than

    one node attempts to

    send data down the bus at the same time collisions occur and as such bus networks do

    not cope well will lots of tra"c; they are only suitable for domestic home use, or for small

    organisations with few computer nodes.

    A bus network only features one main cable and and as such is relatively inexpensive to

    setup.

    RingRing networks are setup in a circular configuration and

    data travels only one way around the ring passing

    from one computer to the next with each computeracting as a repeater.

    Every node in a ring network is critical; if one of the

    computers is broken, it cannot pass on the data to the

    next and the network will fail.

    112

  • 8/10/2019 Computing Academy eBook

    114/214

    StarEvery node on a star network is connected to a central

    server or switch; this is the most common network

    infrastructure. Star networks take much longer to

    setup and configure and and more expensive than the

    alternatives as it is necessary to run a cable from every

    computer back to the central server (which might be

    quite far away). Despite these drawbacks, the

    performance of star networks is much greater than the

    alternatives and if any node breaks, it does not a!ect

    any other computer on the network. It is also very

    simple to add additional nodes to the network withoutdisrupting existing nodes.

    113

  • 8/10/2019 Computing Academy eBook

    115/214

  • 8/10/2019 Computing Academy eBook

    116/214

  • 8/10/2019 Computing Academy eBook

    117/214

    HTTPHypertext Transfer Protocol (HTTP) is the standard protocol used for transmitting

    webpages (built using Hypertext Markup Language - HTML) over the Internet. Although

    modern web browsers do this for us if we forget, when visiting any website, the domain

    name is also preceded by the http:// prefix to let the browser know that this protocol

    needs to be used.

    FTPViewing websites is handled using HTTP, but in order to copy those website files to the

    web server (so that they become live on the Internet), we need to use the File Transfer

    Protocol (FTP).

    116

  • 8/10/2019 Computing Academy eBook

    118/214

    The Internet

    The Internet is a network of networks. The Internet consists of private LANs connected by

    making use of infrastructure owned and managed by third parties such as the telephone

    network and fibre optic cables; the Internet is therefore a very large WAN.

    Key PointThe Internet and the World Wide Web (WWW) are not the same.

    The Internet is the infrastructure of cables and routers that connect

    computer systems. The World Wide Web is a collection of webpages and

    resources hosted (stored) on the Internet.

    117

  • 8/10/2019 Computing Academy eBook

    119/214

  • 8/10/2019 Computing Academy eBook

    120/214

  • 8/10/2019 Computing Academy eBook

    121/214

    Router

    Routers are used to connect one network to another. When we connect to the Internet, we

    are essentially connecting our home network to another network (the Internet), so it is

    necessary to use a router. Routers ensure that packets of data leaving one network arecorrectly passed to another network so that they reach the intended destination. It is

    common today to buy a single box that is both the modem and router in one. This box

    also often acts as a wireless access point too which allows our computers to access the

    Internet wirelessly.

    Hypertext Markup Language (HTML)HTML is the standard adopted for the creation and interpretation of webpages. Even the

    most complex modern webpages make use of HTML.

    HTML is a text based language that uses tags to define the content of webpages. Tags

    work in pairs, so it is necessary to have an opening and a closing tag. To create a large

    heading, for example, we would write:

    This text is our heading

    Notice that we have used the opening tag and the closing tag . Some of the

    most commonly used tags include:

    ... Contains details about the webpage, such as the author of the page and the title.

    ... The title will appear at the top of the web browser when viewing this page.

    ... The content appearing between these tags forms the main page content.

    ...

    Paragraphs are defined using these tags. Each paragraph will begin on a new line.

    ... Heading tags define a title or heading. is the largest heading tag.

    This tag inserts an image and tells the web browser the location of the image file.

    ... This tag defines a hyperlink.

    See some of these tags in action in the following webpage written in HTML.

    120

  • 8/10/2019 Computing Academy eBook

    122/214

    Sheffield Wednesday Football Club

    Welcome to the Unofficial Sheffield Wednesday Football Club

    Website

    A history of the club

    Sheffield Wednesday Football Club is a football club based in

    Sheffield, South Yorkshire, England. They are one of the oldest

    professional clubs in the world and the third oldest in the English

    league.

    The Wednesday, as they were named until 1929, were founding

    members of The Football Alliance in 1889, and its first champions

    that inaugural season. The Wednesday joined The Football League

    three years later when the leagues merged. Sheffield Wednesday were

    also one of the founding members of The Premier League in 1992.

    For more information about Sheffield Wednesday visitthis link

    121

    http://www.swfc.co.uk/http://www.swfc.co.uk/http://www.swfc.co.uk/http://www.swfc.co.uk/
  • 8/10/2019 Computing Academy eBook

    123/214

  • 8/10/2019 Computing Academy eBook

    124/214

    The following CSS code is responsible for transforming the original webpage into the

    styled version.

    h1{ font-family: sans-serif; font-size: x-large; color: blue; text-align: center;}

    h3{ font-family: sans-serif; font-size: large; color: purple;}

    p{ font-family: sans-serif; font-size: medium; color: black;}

    a{ text-decoration: none;}

    123

  • 8/10/2019 Computing Academy eBook

    125/214

    CompressionEverything we do on the Internet involves uploading data from our computers, or

    downloading data to our computers. When listening to music using an online streaming

    service or downloading a video file a significant amount of data needs to be downloaded.

    Faster Internet connectivity means that we do not now need to wait as long for data to

    upload and download, but compressing data so that it takes up less space can also

    speed up this process.

    Lossy Compression

    Removing some of the data from a file can reduce the file size and this makes transfer

    over a network faster. Removing

    data, means removing detail so its

    important not to remove too much

    detail otherwise the quality of the

    file being compressed will become

    unsatisfactory.

    W e sa w i n t h e D a t a

    Representation chapter of this

    book that reducing the quality

    (compressing) a photograph from

    24 bit (16,777,216 colours) to 8 bit

    (256 colours) means that the image takes up just 95KB of space rather than the original

    293KB of space. Although a lot of detail has been lost, it is not noticeable, as illustrated in

    this 8 bit image of the Sacr-Cur Basilica de Montmartre in Paris.

    124

  • 8/10/2019 Computing Academy eBook

    126/214

    Lossless Compression

    Encoding data can allow us to reduce the file size, without losing any data or quality.

    Peter Piper is a nursery rhyme and well known tongue twister:

    Peter Piper picked a peck of pickled peppers. A peck of pickled peppers Peter Piper

    picked. If Peter Piper picked a peck of pickled peppers, Where's the peck of pickled

    peppers Peter Piper picked?

    Currently this text consists of 34 words. In order to compress this section of text, we could

    encode each word with a number.

    peter 1

    piper 2

    picked 3

    a 4

    peck 5

    of 6

    pickled 7

    peppers 8

    if 9

    wheres 10

    the 11

    Now, rather than 34 words, we only need 11 numbers to represent the original text as

    some of the words are repeated.

    1 2 3 4 5 6 7 8. 4 5 6 7 8 1 2 3. 9 1 2 3 4 5 6 7 8, 10 11 5 6 7 8 1 2 3?

    We dont need to store the same word more than once and this allows us to save space.

    125

  • 8/10/2019 Computing Academy eBook

    127/214

  • 8/10/2019 Computing Academy eBook

    128/214

  • 8/10/2019 Computing Academy eBook

    129/214

  • 8/10/2019 Computing Academy eBook

    130/214

    Thinking About Data

    What is a Database25, She"eld and Volkswagen are pieces of data, but on their own lack meaning and

    organisation. Does 25 represent age? house number? miles? We need to organise this

    data so that we can understand it; then it can become useful.

    Key PointA database is a persistent store of related data that is organised in such a

    way as to make it useful.

    129

  • 8/10/2019 Computing Academy eBook

    131/214

    Databases are not temporary deposits of information they are persistent or permanent

    collections; as such they are stored in computer systems on persistent or permanent

    storage (HDDs or SSDs) rather than volatile memory. Databases contain related data; all

    the information about one person or one thing, for example, a company might have an

    employees database which contains all the related data about employees such as name,

    age, address etc.

    TaskFor each of the organisations listed below, list the data that they would

    need to collect, store, organise and search through.

    $ the police

    $ utility companies

    $ hospitals

    $ supermarkets

    $ banks

    A hospital deals with thousands of patients each day and its important that they have lots

    of information about each person they treat in order to provide the best possible care.

    Here is some information a hospital may collect about a patient.

    Asthma 100813 020688

    325434

    Chandos Steven

    Hardman Earp

    Does all this make sense? Can you understand what this data means?

    130

  • 8/10/2019 Computing Academy eBook

    132/214

  • 8/10/2019 Computing Academy eBook

    133/214

  • 8/10/2019 Computing Academy eBook

    134/214

    Database Management Systems

    Organisations use Database Management Systems (DBMSs) to store, organise, add, edit,

    delete and search through records. A DBMS is a piece of software that allows us to create

    and work with databases. Just like a word processor allows us to create letters, a DBMS

    allows us to create databases. DBMSs also manage:

    %Automatic Backups

    % Concurrency Control

    % Data Integrity

    % Data Redundancy

    133

  • 8/10/2019 Computing Academy eBook

    135/214

    Automatic BackupsMany DBMSs allow you to schedule automatic backups. Consider the implications to a

    hospital, popular social networking website, or bank of losing all of their data. It could cost

    these organisations millions of pounds and even endanger lives. Its therefore critical that

    organisations backup their data.

    Concurrency ControlWhile a simple database might only need to be accessed by one person at once, some

    databases need to be accessed concurrently by multiple users. At the time of writing the

    most popular social networking website in the world has over 526 million active users

    each day. This website, like many others, is driven by databases, and with 526 million

    active users each day, the chances are that more than one person will be accessing theirdatabases at the same time.

    DBMSs need to manage and control concurrency to avoid conflicts. Consider a ticket

    sales website allocating seats and taking payment for sporting fixtures; many users may

    be viewing and selecting seats at the same time. What is to stop two people choosing and

    paying for the same seats at the same time? Who would the seats belong to?

    134

  • 8/10/2019 Computing Academy eBook

    136/214

  • 8/10/2019 Computing Academy eBook

    137/214

    When entering data into a computer system to be stored in a DBMS validation checks can

    be performed on the data to assure the integrity of the data.

    Validation Check Description

    Format

    Date of Birth is usually entered as DD / MM / YYYY.

    Entering 01 / CB / QM34 would cause the format

    validation check to fail as only numbers were

    expected.

    Length

    UK telephone numbers are no longer than 11 digits

    long. Entering 12 or more digits for a telephone

    number field would cause a length check to fail.

    Lookup

    When entering a car registration, for example, a

    lookup check might be performed to check the

    registration against a list to ensure that the

    registration actually exists.

    Presence

    This check looks to see if each field has been

    completed. If a telephone number or email address

    field has been left blank, the presence check will fail.

    Range

    A range check ensures the data entered is within a

    valid range. A valid range for age might be 1-110.

    Somebody inputting their age as 130 is likely to be

    entering invalid data.

    Type

    A telephone number will have up to 12 digits and no

    letters. Entering letters in a telephone number field

    will cause the type check to fail.

    Verification is another method of ensuring data integrity and is often used along with

    validation. Typing in the same piece of data twice (such as when confirming a password) is

    an example of verification - its there to make sure you dont accidentally press the wrong

    key.

    Data RedundancyWithin organisations there are often several departments: in a hospital for example, there

    are wards specialising in the heart, the brain, fractures and bones etc.

    If a patient visited several wards in a hospital and each ward created a new database

    record for the patient data would be duplicated. Even if the patient only even visited one

    136

  • 8/10/2019 Computing Academy eBook

    138/214

    ward, but attended several times, multiple records for that patient would be created as

    illustrated below where David Jones has attended several times on di!erent dates.

    Having redundant (duplicated) data is a problem. Should the patient change their name,

    move house or get a new telephone number, each department would then need to update

    every single occurrence of the patients details in their records; if some departm