1.2 Memory & Storage - Hilbre High School Humanities College

52
1.2 Memory & Storage

Transcript of 1.2 Memory & Storage - Hilbre High School Humanities College

1.2 Memory & Storage

1.2 Memory & Storage

Virtual tour of the inside of a computer

Click here to return to the homepage

CPU

BIOS

RAM

ROM

Note, it is difficult to accurately identify the ROM and BIOS on a motherboard. Any small chip that cannot be identified is a likely possibility. Other small chips are controllers.

Southbridge connects the ROM, BIOS other I/O devices such as the hard disk, and USB ports to the CPU.

Northbridge connects high speed components such as the GPU & RAM.

On-board graphics chip (GPU).

Expansion slots.

1.2 Memory & Storage

The CPU

Name

Central processing unit

Purpose

To fetch and execute instructions.

Components

Arithmetic logic unit: performs calculations and logic.

Control unit: decodes instructions and sends signals to control how data moves around the CPU.

Cache: fast access memory for frequently used instructions and data.

Registers: small fast memory used to help fetch and execute instructions.

Factors affecting the speed

Number of cores: independent processing units.

Clock speed: The number of cycles per second.

Cache: Temporary storage of instructions and data.

1.2 Memory & Storage

RAM

Name

Random access memory.

Purpose

A temporary store of instructions and data in use by the CPU for currently executing programs. Programs and data are loaded from the hard disk/solid state storage to RAM for processing.

Volatile

The contents is lost when the power is turned off.

Read/Write

This memory can be read and written to.

1.2 Memory & Storage

ROM

Name

Read only memory

Purpose

Holds the first instructions to execute when the computer is first turned on. Also known as the ‘bootstrap’.

Non-Volatile

The contents remains when the power is turned off.

Read only

This memory is read only, and cannot be written to.

More examples in computer systems

Other types of ROM include memory cartridges, such as those used on portable games consoles.

Embedded systems will contain all the program instructions in ROM.

1.2 Memory & Storage

Virtual memory

Virtual memory is: Using part of the hard disk as if it is memory.

Virtual memory is needed because: The amount of physical RAM may not be large enough to hold all the open programs and data in use.

The problem with using virtual memory is that: Instructions can only be executed from the cache and RAM. Therefore they must be transferred back from virtual memory before they can be used. This makes the computer slower if it has to continually transfer instructions to the RAM from the virtual memory.

1.2 Memory & Storage

0Gb

4Gb

Operating System

Word processor app

Spreadsheet app

Presentation app

Graphics app

Video editing app

Example of virtual memory in use Hard disk

Stored programs on diskVirtual memory on disk

RAM

If the user decides to open a graphics application to edit an image for the presentation too, the problem is that:

The graphics app will not fit into the available memory.

Scenario: A user of a desktop PC has the operating system and presentation software open.

Operating System

Presentation app

1.2 Memory & Storage

0Gb

4Gb

Example of virtual memory in use Hard disk

Stored programs on diskVirtual memory on disk

RAM

Explanation of the use of virtual memory in this scenario:

As it is not currently being used, the presentation app can be moved to virtual memory to make space in the RAM for the graphics app in use.

Scenario: A user of a desktop PC has the operating system, presentation and a graphics application open. The user is not currently working on the open presentation, just editing a photograph to include on a slide later.

Operating System

Word processor app

Spreadsheet app

Presentation app

Graphics app

Video editing app

Operating SystemPresentation app

Graphics app

1.2 Memory & Storage

0Gb

4Gb

Example of virtual memory in use Hard disk

Stored programs on diskVirtual memory on disk

RAM

Explanation of the use of virtual memory in this scenario:

The graphics app can be put into virtual memory and the presentation app restored back into the RAM.

Scenario: The user switches back to the presentation software without closing the graphics application.

Operating System

Word processor app

Spreadsheet app

Presentation app

Graphics app

Video editing app

Operating System

Presentation app

Graphics app

1.2 Memory & Storage

4Gb

8Gb

Why more RAM increases the speed of a computer Hard disk

Stored programs on diskVirtual memory on disk

RAM

Scenario: The user doubles the amount of RAM in the computer to 8Gb, turns on the computer, opens the presentation app and the graphics app to continue working on the presentation.

Operating System

Word processor app

Spreadsheet app

Presentation app

Graphics app

Video editing app

Doubling the size of the RAM makes the computer faster because:

Less virtual memory has to be used because more programs can remain in the RAM. This results in less transfer of instructions and data so the CPU can spend more time executing.0Gb

Operating System

Presentation app

Graphics app

1.2 Memory & Storage

Flash memory

Name

Basic input/output system (BIOS)

Purpose

Holds initial settings for the computer used by the first instructions in the ROM.

Non-Volatile

The contents remains when the power is turned off.

Read/Write

This memory can be read from and written to.

1.2 Memory & Storage

1.2 Memory & Storage

The need for secondary storage

ROM can’t be used to save files because: it is read only.

Therefore secondary storage is needed because: it is read/write and non-volatile. Can be used for the long term storage of changeable data.

RAM can’t be used to save files because: it is volatile.

Secondary storage can be: Magnetic

Data is stored using magnetism.

Solid State

Data is stored using semiconductor chips.

Optical

Data can be stored using ‘pits and lands’.

Types of secondary storage

RAM, ROM, registers and cache are referred to as primary storage. The operating system, programs and data are held in secondary storage when not in use.The term tertiary storage is used to describe backups and archives of large amounts of data.

1.2 Memory & Storage

Examples of secondary storage

HARD DISK

Image

Type Magnetic

Uses Internal storage for PC/laptop.Holds operating system and program files.

Characteristics Moving drive head which has to move to each part of a data file. Hard disks perform better if they are defragmented.

Reliability andDurability

8 Damaged by impacts.

Portability 7Can be portable, but are larger and heavier.

Capacity 10 Very high: 2-8Tb.

Cost 7 Cheap.

Data access speed 7 Fast.

FLASH MEMORY CARD

Image

Type Solid State

Uses Storing image files on a digital camera.

Characteristics No moving parts.No need to defragment.Lower power devicesNo noise.

Reliability andDurability

8Limited number of times to read/write

Portability 10Compact and lightweight.

Capacity 6 8Mb-256Gb.

Cost 4 Expensive.

Data access speed 8 Fast.

1.2 Memory & Storage

Examples of secondary storage

CD-R

Image

Type Optical

Uses Storing music.Backup of files.

Characteristics Read/write uses a laser.Write once and read only.

Reliability andDurability

8 Can be scratched.

Portability 9Thin and easy to distribute.

Capacity 2 Low: 640Mb.

Cost 9 Cheap.

Data access speed 4 Slow.

SOLID STATE DRIVE

Image

Type Solid State

Uses Replacement for hard disk in a laptop or desktop PC.

Characteristics Faster to load operating system. Access to programs and files is much quicker.No noise.

Reliability andDurability

9Limited number of read/writes.

Portability 7Intended to replace HDD.

Capacity 8 ½Gb-4Tb

Cost 3 Expensive.

Data access speed 10 Very fast.

1.2 Memory & Storage

Examples of secondary storage

Blu-Ray™

Image

Type Optical

Uses Storing films.Distributing console games.

Characteristics Read/write uses a laser.Write once and read only.

Reliability andDurability

8 Can be scratched.

Portability 9Thin and easy to distribute.

Capacity 2 25Gb-128Gb.

Cost 8 Cheap.

Data access speed 5 Slow.

DAT TAPE

Image

Type Magnetic

Uses Long term archive of data.

Characteristics Can only be read and written sequentially, beginning to end.

Reliability andDurability

9 Usually very reliable.

Portability 8

Portable although not usually required to be. Tapes can be stored off-site.

Capacity 7 600Gb

Cost 7 Cheap.

Data access speed 2 Slow.

1.2 Memory & Storage

Cloud storage

Cloud storage means: Storing programs and data on remote hard drives, accessed over the internet when needed.

The advantages of cloud storage include: 1. Space is not taken up on local drives meaning more space is available overall.2. Files can be accessed anywhere, from any device connected to the internet.3. Backup and version history of files is usually kept automatically.4. Collaboration on files is easy.5. High quality images can be kept on remote servers, with lower quality images available on

low storage devices.

The disadvantages of cloud storage include: 1. Monthly/annual cost.2. Potential security risks.3. Relying on a third party to look after your data.4. Incompatibility between storage and applications.

1.2 Memory & Storage

Suitability of devices

Alicia is using a helmet mounted camera to record footage whilst snowboarding. Suggest two reasons why a flash memory card is a good choice for secondary storage in this scenario, and two reasons why a hard disk would be unsuitable.

Flash memory is resistant to impacts when Alicia falls off the snowboard.Flash memory is compact and lightweight.Hard disks are easily damaged with impacts. They are also larger and heavier than flash cards.

Gregg is considering whether to download games for his games console from an online store, or whether to purchase the physical disks instead.Give reasons why he may choose one option or another.

The hard disk capacity of the games console will be limited. Only a few games will be able to be downloaded before running out of space. More games can be owned in disk version.It is less hassle to swap between games if they are installed rather than swapping disks.It may be better to reserve the limited storage on the games console for updates and patches to the games which would need to be installed.The console may have the capability of playing remotely from other consoles, if purchased from the online store.The online store or physical disk may be cheaper than the alternative.Potentially more data could be stored online than on a disk. This has the potential to make an online version better in the future.Gregg might like to physically own the disks.

1.2 Memory & Storage

Suitability of devices

Matt wants to keep a backup of his photos, and is considering using DVD-R disks. Give two advantages and two disadvantages of this method.

Low cost, and durable.Slow to write data to. Capacity is limited and therefore only a limited number of photos can be stored.

Sarah is a student who needs access to her school files at home and school. She currently emails the documents she is working on home, and keeps a copy of all her school work on the school servers. She then emails the files back into school and downloads the attachments to the school server when she is back in school. Suggest better alternatives for Sarah to work with her files, and reasons why she might not choose this option.

A portable hard disk would allow Sarah to store and transfer a lot more files. She could take this with her, but would need to remember to take her drive to school. If she lost it in school, she would lose her work.

A memory stick would be a cheaper alternative to a portable hard disk, but it would store less files. It is also easier to lose because it is smaller.

Storing her work using cloud services would mean she could access her files anywhere with an internet connection. It would also take an automatic backup. She would not need to remember to take a device to school. However, it is likely to be the most expensive option unless she has a small number of files and can benefit from a free subscription. It also requires the school filtering to allow access to the cloud service which could be a problem.

1.2 Memory & Storage

Suitability of devices

Scott is getting a new computer. He has three options for secondary storage. He could choose:

a 6Tb hard disk drivea 2Tb solid state drivea hybrid 500Gb solid state with a 4Tb hard disk

For each option give reasons why Scott may choose that option instead of the alternatives.

A 6Tb hard disk (HDD) will give Scott the maximum storage. He should choose this option if he has a significant demand for lots of large files, e.g. large video archive, or if the cost is too much for the solid state drive (SSD).

A 2Tb SSD will give Scott the fastest access to programs and data. He should choose this if he has average requirements for storing programs and data, and can afford it. He could increase his capacity again later with an additional HDD if necessary.

Scott should choose the hybrid if he wants fast boot-up time for the operating system, which could sit on the SSD. The other programs and data can then reside on the HDD. This is a good compromise if he can afford it.

1.2 Memory & Storage

Calculating the data capacity requirements

Typical examples of file sizes: File type Approximate size

1 page word processed file with no images 0.1Mb (100Kb)

Postcard sized photograph 6Mb

3 minute MP3 music file 6Mb

1 minute compressed video file 50Mb

Standard definition feature film 4000Mb (4Gb)

High definition feature film 8000-15000Mb (8-15Gb)

Typical examples:

A 100 page book with 30 postcard sized photos: (100 x 0.1) + (30 x 6) = 190Mb

Photo album with 230 postcard sized photos and 40 half minute video clips: (230 x 6) + (40 x 25) = 2,380Mb (2.3Gb)

A portable music player capable of holding 3000x3 minute songs and ¼ postcard sized track thumbnail images: (3000 x 6) + (3000 x 1.5) = 21,001.5 Mb (21Gb)

1.2 Memory & Storage

1.2 Memory & Storage

You can store a few paragraphs of text in a single kilobyte. In the 1980s, a 5.25 inch floppy disk would store 160-360 kilobytes of data.

Bit, nibble, byte, kilobyte & megabyte

Bit: 0 Binary digit. Boolean values: False or True.

Nibble: 0 4 bits. Half a byte. An encoded number for an LCD display.1 0 1

Byte: 0 8 bits. A single character.1 0 0 0 0 0 1

Kilobyte: 1024 bytes which can be approximated to 103 or 1000 bytes. The symbol for a kilobyte is

A

KB

Megabyte: 1024 kilobytes which can be approximated to 106 bytes The symbol for a megabyte is MB

You can store a in a single megabyte. In the 1990s, a 3.5 inch floppy disk would store 1.44 megabytes of data.

1.2 Memory & Storage

1024 megabytesGigabyte:

Gigabyte, terabyte & petabyte

which can be approximated to 109 bytes. The symbol for a gigabyte is GB

You can store 12 hours of music in a single gigabyte. In the 1990s, a MiniDisc would store 1 gigabyte of data.

Terabyte: 1024 gigabytes which can be approximated to 1012 bytes. The symbol for a terabyte is TB

You can store 1 million novels in a single terabyte. In 2018 hard disks in computers have terabytes of data capacity.

Petabyte: 1024 terabytes which can be approximated to 1015 bytes. The symbol for a petabyte is PB

You can store 100 years of television in a single petabyte. The amount of data Google processes in an hour can be measured in petabytes.

1.2 Memory & Storage

Units of data storage

Unit conversions:

Bytes KB MB GB

6567 6.567 0.006567 0.000006567

130 0.13 0.00013 0.00000013

10700000 10700 10.7 0.0107

2300000 2300 2.3 0.0023

5000000 5000 5 0.005

1400000000 1400000 1400 1.4

50000000 50000 50 0.05

200000000 200000 200 0.2

Sophie has 1500 high resolution 5Mb photographs.What size memory card in GB will she need as a minimum to store these images?

7.5

A portable video player stores films in a compressed format on flash memory. Each film is 4.7GB.How many films can a 32GB player store?

6

A dashboard camera records video at 120MB per second. How much storage is required in gigabytes for 30 seconds of footage?

3.6

1.2 Memory & Storage

Units of data storage

15.4PB video uploaded to YouTube

in 2012.

15400 TB=

The human brain stores 2,500,000GB

of data.

2.5 PB=

IBM’s Watson supercomputer

16TB RAM.

0.016 PB=

Large Hadron Collider produces 0.47GB data per

second.

470 MB=

0.004MB of RAM in Apple’s first computer in

1976.

4 KB=

All the DNA in a human body cell is 1.5GB.

1500 MB=

1.2 Memory & Storage

1.2 Memory & Storage

How to convert positive denary whole numbers (0-255) into 8 bit binary numbers and vice versa

1.2 Memory & Storage

Adding two 8 bit binary integers and overflow errors.

Overflow errors can occur when adding binary numbers because: there are not enough bits to hold the answer and a carry remains that cannot be stored.

1.2 Memory & Storage

Binary shifts

A left shift performs a: multiplication.

A right shift performs a: division.

Number 5

becomes 10

Number 12

becomes 6

1.2 Memory & Storage

Converting from binary to hexadecimal equivalents and vice versa.

Denary Binary Hex

0 0000 0

1 0001 1

2 0010 2

3 0011 3

4 0100 4

5 0101 5

6 0110 6

7 0111 7

8 1000 8

9 1001 9

10 1010 A

11 1011 B

12 1100 C

13 1101 D

14 1110 E

15 1111 F

1.2 Memory & Storage

Converting positive denary whole numbers (0-255) into 2 digit hexadecimal numbers and vice versa

1. Take each hexadecimal digit and write out a 4 bit equivalent.2. Using a number line across all the bits, convert the number to

denary.

How to convert from denary to hexadecimal:

1. Convert the denary number to binary.2. Take each nibble and convert that 4 digit binary to hexadecimal.

How to convert from hexadecimal to denary:

1.2 Memory & Storage

Number conversions

Hex

adec

imal

3F

1.2 Memory & Storage

Check digits

A check digit is a calculation on data to create a number included with the data for error checking.

The final digit of a Universal Product Code is a check digit computed as follows:

1. Add the digits in the odd-numbered positions (first, third, fifth, etc.) together and multiply by three.2. Add the digits (up to but not including the check digit) in the even-numbered positions (second, fourth, sixth, etc.) to the result.3. Take the remainder of the result (modulus) divided by 10) and if not 0, subtract this from 10 to derive the check digit.

When the UPC code for a box of tissues is read, the computer either accepts or rejects the code before looking up the description and price in a database.The reason the computer performs this calculation before looking for the product in the database is:

A bar code reader reads 036000241457 from the box of tissues. The calculation the computer performs is:

1. Add the odd number digits: 0+6+0+2+1+5 = 14.2. Multiply the result by 3: 14 × 3 = 42.3. Add the even number digits: 3+0+0+4+4 = 11.4. Add the two results together: 42 + 11 = 53.5. To calculate the check digit, take the remainder of 53/10 = 36. Subtract from 10. Therefore, the check digit value is 7.

The product code was read successfully.

to eliminate the need to search the database for a product that would not exist.

1.2 Memory & Storage

Check digits

#Function to check an ISBN number of a book - returns True if valid and False if invaliddef ISBN(code):

weight = 10total = 0

#Each digit in code is multiplied by the weightfor counter in range(0,9):

#Add the product of the digit and weight to totaltotal = total + int(code[counter])*weightweight = weight - 1

#Check digit is modulus 11check_digit = 11-(total % 11)print(check_digit)

if check_digit == 10:check_digit = "X"

else:check_digit = str(check_digit)

#Extract and cast last digit from the codelast_digit = code[9:]

#Output result of check digit algorithmif check_digit == last_digit:

return Trueelse:

return False

book_number = input("Enter ISBN:")print (ISBN(book_number))

1.2 Memory & Storage

1.2 Memory & Storage

Computers store and process all data in binary. Therefore all data including text, images and sounds must be represented with just 0’s and 1’s.

How my first name is stored in binary using the 8 bit Extended ASCII character set:

Characters and character sets

Letter Binary

D 0 1 0 0 0 1 0 0

A 0 1 0 0 0 0 0 1

V 0 1 0 1 0 1 1 0

E 0 1 0 0 0 1 0 1

My binary bracelet:

1.2 Memory & Storage

Characters and character sets

A character set is: A defined list of characters recognised by the computer hardware and software. Each character is represented by a number.

ASCII is a 7 bit character set. This means you can represent 128

characters in that set because there are 27 permutations of 7 bits.

Extended ASCII is an 8 bit character set. This means you can represent 256

characters in that set because there are 28 permutations of 8 bits.

Standard ASCII character set. Characters 32-127: Extended ASCII character set. Characters 128-255:

1.2 Memory & Storage

Unicode was introduced because the other character sets did not have enough bits to store characters for other languages, historic scripts and emojis.

Characters and character sets

😀11110000 10011111 10011000 10000000

💩11110000 10011111 10010010 10101001

💀11110000 10011111 10010010 10000000

👶11110000 10011111 10010001 10110110

🌂11110000 10011111 10001100 10000010

😡11110000 10011111 10011000 10100001

1.2 Memory & Storage

1.2 Memory & Storage

Bitmap images

Meta data includes: Width of the image in pixels.Height of the image in pixels.Colour depth.Colour palette.

1 bit image:

The file size can be calculated as:

Width x height x colour depth+ 10% for metadata.

The file size for this image is:

17 x 14 x 1 = 238+ 10% meta-data = 262 bits.

In this image each pixel is stored in: 1 bit.

1.2 Memory & Storage

The file size for this image is: 17 x 14 x 2 = 476

+ 10% meta-data = 524 bits

Bitmap images

2 bit image:

In this image each pixel is stored in: 2 bits.

The colour palette meta-data is:

00 Black01 Blue10 Green11 White

1.2 Memory & Storage

The impact on file size of colour depth:

The more bits per pixel, the larger the file size, but the greater the number of colours that can be stored.

Bitmap images

3 bit image:

In this image each pixel is stored in: 3 bits.

The impact on file size of resolution:

The greater the resolution (number of pixels), the larger the file size, but the greater the quality.

1.2 Memory & Storage

1.2 Memory & Storage

How sound can be sampled and stored in digital form

Sampling interval

Binary for the sound could be: 010 011 001 010 011 010 011 010 001 100 011 010 011

000

001

010

011

100

101

39 bits.

1.2 Memory & Storage

Sampling interval

The effect of doubling the bit rate on the quality of the sound and file size

Binary for the sound could be: 0100 0101 0001 0100 0101 0011 0110 0100 0011 1001 0111 0100 0110

0000

0010

0100

0110

1000

1010

0001

0011

0101

0111

1001

52 bits.

The quality has: Increased because the digital value is closer to the original wave.

1.2 Memory & Storage

The effect of doubling the sample rate and bit rate on the quality of the sound and file size

Sampling interval

Binary for the sound could be:0100 0101 0101 0100 0001 0010 0100 0101 0101 0100 0011 0100 0110 0101 0100 0011 0011 0110 1001 1000 0111 0101 0100 0100 0110

0000

0010

0100

0110

1000

1010

0001

0011

0101

0111

1001

100 bits.

The quality has: Increased because the digital value is closer to the original wave.

1.2 Memory & Storage

1.2 Memory & Storage

2

Lossy compression loses some of the data when the file is compressed. This reduces the quality, but significantly reduces file size.With JPEG encoding below you can see that increasingly larger regions of the picture are drawn with the same colour as the compression increases.

Lossy compression

80% quality: 20KB

4

40% quality: 16KB

3

60% quality: 18KB

5

20% quality: 14KB

6

2% quality: 14KB

100% quality: 30KB

1.2 Memory & Storage

Lossless compression

000

001

010

011

111

An example of run-length lossless compression:

Colour palette:

111 0010 000 1100 111 0011 000 0010 111 0010111 0001 000 0001 001 1100 000 0011 001 0001 000 0001 111 0010

Assuming the first 3 bits are the colour and the next 4 bits are the number of pixels of that colour:The first two lines of the image encoded in binary are:

Uncompressed total bits: 126 With lossless compression total bits: 84

You don’t need to know about specific

compression algorithms for exams. This exercise is just so you understand how

it could work.

1.2 Memory & Storage

Lossless compression

000

001

010

011

111

111 0010 000 1100 111 0011 000 0011 111 0010111 0001 000 0001 001 1100 000 0011 001 0001 000 0001 111 0010111 0010 000 0001 001 0011 000 0001 010 0001 001 1010 000 0001 111 0010111 0011 000 0001 001 0010 000 0001 010 0010 001 1001 000 0001 111 0010111 0100 000 0001 001 0001 000 0001 010 0001 001 1010 000 001 111 0001111 0011 000 0001 001 1000 111 0011 001 0100 000 0001 111 0001111 0010 000 0001 001 1000 111 0101 001 0011 000 0001 111 0001111 0001 000 0001 001 1001 111 0100 000 0001 001 0001 111 0001 000 0001 111 0010000 0110 001 0101 111 0100 000 0001 001 0001 111 0001 000 0001 111 0010111 0100 000 0001 001 0111 111 0011 000 0001 111 0001 000 0011 111 0001111 0011 000 0001 001 0101 010 0011 111 0100 010 0010 000 0001 111 0010111 0010 000 0001 001 0110 010 1001 000 0001 111 0010111 0001 000 1001 010 0111 000 0001 111 0011111 1000 000 0001 010 0001 000 1000 111 0011

= 692 bits compressed. 882 bits uncompressed. 22% compression.

Assuming 3 bits for colour and 4 bits for number of pixels:

1.2 Memory & Storage

Units of data storage

Case study:

Elizabeth is looking to upgrade her phone. She is choosing between model A and model B.

Model A Model B

Storage capacity 64GB 256GB

Camera 8 mega-pixel, 24bit colour 12 mega-pixel, 24 bit colour

Video1080p (2 mega-pixel)

at 24 fps, 30 fps, or 60 fps4K HD (8 mega-pixel)

at 24 fps, 30 fps, or 60 fps

Maximum number of photographs that could be stored on the phone:

8,000,000 bit resolution.x 24 bit = 192,000,000 bits.Divide by 8 for bytes =24,000,000 bytes or 24MBPer photograph.32,000 (32GB) divided by 24 =1,333 uncompressed photos.x 2 due to 50% compression =2,666 photos.

12,000,000 bit resolution.X 24 bit = 288.000.000 bits.Divide by 8 for bytes =36,000,000 bytes or 36MBPer photograph.224,000 (224GB) divided by 36 =6,222 uncompressed photos.x 2 due to 50% compression =12,444 photos.

Consider that 32GB of data storage will be used for apps. Assume 50% compression.