Bits of Bytes and HODDERS Book has been used throughout for
images and all the content. 👽 Notes by Sakula
Topics which will be covered-
- logical binary shift on a positive 8-bit
binary integer and understand the effect this has
on the positive binary integer
- two’s complement to represent positive and
negative 8-bit binary integers
- Addition of binary
Addition of binary- (with 2 digits)
With 3 digits-
With the addition there sometimes is an error when you add and that
can be while adding 8-bit binary you might end up with a 9-bit number.
This type of error is known as an overflow error. (The maximum denary
value of an 8-bit binary number is 255).Hence the generation of 9th
bit value shows an error.
Example-
A generation of 9th bit shows the error.
Logical binary shifts-
Computers can carry out a logical shift on a sequence of binary
numbers. The logical shift means moving the binary number to the left
or to the right. Each shift left is equivalent to multiplying the
binary number by 2 and each shift right is equivalent to dividing the
binary number by 2.
However, we can only perform specific number of shifts for a number
and eventually it will contain only zeros after a while.For example-
if we shift 01110000 five places left, in an 8-bit register we would
end up with 00000000.112x32=0?
This would result in generation of an error message.
Example on how to do this-
Two’s complement (binary number)
-to allow the possibility of representing negative integers we make
use of two’s complement. There is a minor change in heading-
In two’s complement the left-most bit is changed to negative value.
Examples on how to do this makes it easier to know.
Question- Convert a)38 b)125 to 8-bit binary numbers using the two’s
complement format.
There are 2 ways to approach this. The second method is easier.
*Note that a two's complement number with a 1-value in the -128
column must represent a negative binary number
Practice few more questions and this will be easy af. List of
questions- Covert -79.Conevert -69.
Topics to be covered-
Character sets, representation of sound, representation of bit map
images and data compression stuff.
What to know list-
Understand how and why a computer represents
text and the use of character sets, including
American standard code for information
interchange (ASCII) and Unicode
Understand how and why a computer represents
sound, including the effects of the sample rate
and sample resolution
3) Candidates should be able to:
Understand how and why a computer represents
an image, including the effects of the resolution
and colour depth
Calculate the file size of an image file and a
sound file,
4) Candidates should be able to:
Understand the purpose of and need for data
compression
Understand how files are compressed using lossy
and lossless compression methods-
•Lossless compression reduces the file size
without permanent loss of data, e.g. run length
encoding (RLE)
• Lossy compression reduces the file size by
permanently removing data, e.g. reducing
resolution or colour depth, reducing the sample rate
or resolution
ASCII codes.
Character sets-are a list of recognized characters that can be
represented and used by a computer. In a character set each character
is represented by a denary number, Binary number and Hexadecimal
number.
Each character on your keyboard is represented by a binary number,
this means that when, for example you press the "H" key, the binary
number 01001000 is sent to the CPU. The CPU will then check the ASCII
table to see which character this is before outputting it in the
desired location.
Originally ASCII used only 7 bits to represent each character, this
allowed for 128 different characters to be represented. This quickly
became too little so an extra bit was added. ASCII now uses 8 bits to
represent each character.
1 is actually being treated as a string and not an integer.This can
cause an issue in programming if data types are not correctly stated.
Unicode
Being able to represent only 256 characters is fine for the English
language, however, as we know there are many languages in the world
that use different letters e.g. Russian, Chinese...
Unicode uses 16 bits to represent each character, this allows for up
to 65,536 different characters to be represented... more than enough
for every language and some special characters. ☺
Advantages of unicode-
Unicode can support the characters from any language in the world
where ASCII can only support the Basic English language. The character
set of ASCII was about 128 characters, and the Unicode supports over
1,000,000 characters. The Unicode encoding standard supports up to 4
bytes for each of the characters.
Bitmap images
Bitmap files are images that are made up from a number of tiny square
pixels.A Pixel is known as the smallest identifiable part of an image.
Each pixel can only be one single colour at a time,each pixel can
determine what colour to display as it is represented by a binary
value that corresponds to a colour.
Resolution is the concentration of pixels that are within a specific
area i.e. an image. The greater the number of pixels within a specific
area, the higher the image quality.
Representation of an image
Bitmap images have each pixel represented with a binary number and
this binary number will correspond to a colour. For simple black and
white images like this only 1 bit is require to represent each pixel.
This is because 1 bit offers 2 different states 1 or 0.
As the image only has 2 colours, black and white, 1 bit is enough to
offer 2 different representations.
Increasing the number of colours
To increase the detail of an image, you may find it necessary to add
colour. It is possible to add many colours to an image, however, to do
so you must increase the number of bits that represent each pixel.
NUMBER OF COLOURS - NUMBER OF BITS
Each time you increase the number of colours in an image you will need
to increase the number of bits being used to represent each pixel.
Effect on file size
Increasing the number of pixels
It is important to note that if you increase the resolution of an
image it will increase its quality, however it will also increase the
file size as there will be more pixels each represented by bits (data)
Increasing the number of colours
It is also important to note that increasing the number of colors will
improve the quality of the image, however it will also increase the
file size as each pixel will now be represented by more bits (data)
Calculating file size-
Formula- image resolution (in pixels) x colour depth (in bits) 8 bit =
1 byte
For sound it is- sample rate (in Hz) x sample resolution (in bits) x
length of sample (in seconds)
Representation of sound-
The sounds that we hear and that can travel through the real world
come in the form of analogue waves, analogue waves are continuous.
Analogue sound signals are continuous where as digital signals are
discrete
Sound Sampling
The process of converting an analogue signal into a digital one is
known as sampling. Sampling involves taking a sample of the analogue
signal at set intervals:
In the image above you can see the red line which represents the
analogue sound wave. The black line represents the digital signal and
the sampling process.
Each time the black line meets the analogue wave, a sample is taken.
This sample is essentially a binary representation of a sound note.
The Y Axis represents the bit depth. In this case there are 16
different possible notes (0 - 16), to represent 16 different states
you need 4 bits. This means that each sample is 4 bits.
The X axis represents the sample frequency, samples are always taken
at a consistent, set frequency.
Sampling rate- is the number of sound samples taken per second. This
is measured in hertz (Hz).
IMPROVING SOUND FILE QUALITY
Increasing the Bit Depth
In the above example. the bit depth is only 4 thus allowing for only
16 different sounds to be represented.
To achieve this we can increase the bit depth. Increasing the bit
depth will increase the accuracy of which the analogue wave can be
sampled.
Increasing the bit depth will increase the sound quality, but it will
also increase the file size as each sample will be represented by more
bits.
Increasing the Sample Frequency
Another way to improve the quality of the sound file is to increase
the sample frequency. The more frequently that you sample the
analogue wave, the less parts of the wave will be left out thus
increasing the quality.
Increasing the sample frequency will increase the sound quality, but
it will also increase the file size as there will now be more samples,
each to be represented by the bits that make the sample.
Data Compression
There are 2 types of compression-
Lossy- to work it must permanently remove data from the image
It will then try to reconstruct the image without the missing data.
This will result in a file size that is smaller, however, the quality
will be much lower. Compression algorithm used.
Lossless- Lossless compression does not remove any data from the file
instead it uses algorithms to spot patterns of similarly coloured
pixels. It then stores the pattern as an instruction so that the image
can be reconstructed to its original quality.
One popular lossless compression method is RLE (Run Length Encoding)
Run length encoding involves counting the number of pixels of similar
colour and stating how many of each are needed.
Example-
-> If we use this duck image as an example we can see that it has 4
colours therefor has a bit depth of 2.
If Green is 00 the first line would look like this:
00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00,00
With RLE the algorithm would count that there are 17 Green pixels and
simply represent this like below:
10001 - 00 (This means 17 x Green)
Run-length encoding (RLE)
» it reduces the size of a string of adjacent, identical data (e.g.
repeated colours in an image)
» a repeating string is encoded into two values:
- the first value represents the number of identical data items (e.g.
characters) in the run
- the second value represents the code of the data item (such as ASCII
code if it is a keyboard character)
» RLE is only effective where there is a long run of repeated
units/bits
For example if we use it on text-
Consider the following text string: 'aaaaabbbbccddddd'. Assuming each
character requires l byte then this string needs 16 bytes. We consider
it to be ASCII.
First parameter shows that how many times it is being repeated.The
second parameter shows the ASCII code for the value. Now the data is
only 8 bytes.
For data like 'cdcdcdcdcd' the RLE is not very effective so we use a
flag. A flag data shows that there is repetition.
Consider this example-
The coded version contains 18 values and would require 18 bytes of
storage. Introducing a flag (255 in this case) produces:
Compressing sound- With sound the compression algorithm works using
the scientific idea that humans cannot hear all parts of a sound wave.
(Human hear range 8Hz to 22Hz)
Works by taking out the samples of a sound wave that were outside of
the normal human hearing range. This in theory should not reduce
quality too much, but will decrease the file size. Know as Perceptual
Music Shaping and it is the method used for MP3 files
Topics to be covered-
Candidates should be able to:
(a) Understand that data is broken down into
packets to be transmitted
(b) Describe the structure of a packet
(c) Describe the process of packet switching
(d) Understand the universal serial bus (USB)
interface and explain how it is used to transmit
data
Candidates should be able to:
Understand how data is encrypted using
Symmetric and asymmetric encryption
Router- a device that enables data packets to be moved between
different networks, for example to join a LAN to a WAN
Packets- (Data sent over long distances is usually broken up into data
packets)
Before a file is sent across the internet it must be split up into a
series of packets. Packets are essentially smaller chunks of the
larger file that will be transmitted individually.
This data has now been split up into 291 packets which means we can
now create 291 different packets for transmission. However, we can’t
just send the raw packet. There needs to be additional information
with it too or else it will be arranged in any order. Hence, each
packet has 3 things -Header, Payload then Trailer. This will make the
packet to get correctly rebuilt.
The Header
The header contains information that allows the packet to reach the
correct destination and for the whole file to be correctly rebuilt
once all packets have been received. The key pieces of information
included in the header are:
● IP address of the recipient
● IP address of the sender
● Number of Packets being sent
● Packet sequence number (E.g. 5 /291)
The Payload
The payload is the section of the packet that holds the actual data
from the file segment that is being transmitted. The diagram below
shows the example for the packet transmitting section 213 of the
example beach image:
The trailer is also sometimes referred to as the footer. It simply
identifies the end of the packet.
PACKET SWITCHING
What is packet switching?
● Packet switching is the breaking down of large files into smaller
pieces (Packets).
● Each packet is then sent to the recipient separately rather than
together. Each packet can travel to its destination taking an
entirely different route.
● Upon receiving all of the packets, the recipient will use the
data contained in each packets header to check that all packets
have been received and rebuild the file in the correct order.
● If any packets are missing, a request will be sent back the
sender asking for the missing packet(s) to be resent.
● Each stage in the route contains a router.
● At each stage in the transmission, there are nodes that contain a
router. Each router will determine which route the packet needs
to take, in order to reach its destination.
What happens?
» each packet will follow its own path (route)
» routers will determine the route of each packet
» routing selection depends on the number of packets waiting to
be processed at each node
» the shortest possible path available is always selected - this
may not always be the shortest path that could be taken, since
certain parts of the route may be too busy or not suitable
» unfortunately, packets can reach the destination in a different
order to that in which they were sent.
Universal Serial Bus (USB)
The USB is now the most commonly used input/output port with modern
computers. This universal implementation makes for the very convenient
and easy interchangeability of peripheral devices.
Just how good is it?
Automatic detection - When a USB device is plugged in it is
automatically detected by the computer.
Automatic recognition and setup- When a USB device is plugged in, the
computer will automatically determine what type of device it is and it
will load the correct driver software.
Setup Assistance - If an unusual or new type of device is plugged in
and the correct device driver is not already available on the computer
system, the USB protocol will inform the user that new device software
is needed.
Another drawback to be considered- even the latest version 3 (V3)
and version 4 (V4) USB-C systems have a data transfer rate which is
slow compared to, for example, Ethernet connections
USB C is a new type of USB.It comes with backward compatible.It is
much smaller and thinner than older USB connectors, offers 100 watt
(20 volt) power connectivity, which means full-sized devices can now
be charged and it can carry data at 10 gigabits per second (10 Gbps);
this means it can now support 4K video delivery.
Encryption-
The scrambling of data so that it is no longer in an understandable
format.
There are 2 types-
Symmetric- One basic example of symmetric encryption is the Ceasar
shift cipher.
How it works:
1. First obtain the message that you wish to encrypt, in this
example our plain text is - "Bits of bytes"
2. The next step is to choose a key, the key is a number between one
and 26 (Number of letters in the alphabet)
3. To encrypt you simply shift each letter of the plain text forward
in the alphabet in correspondence to what number the key is
4. To decrypt, you shift the letters of the cipher text backwards
through the alphabet in correspondence to what number the key is.
Even after being a good method to protect data hackers can still skew
your data as you will send your encryption key with the data hence
they can use it and decrypt data easily.So here comes the second type
of encryption called Asymmetric Encryption.
Asymmetric Encryption-
The two keys involved in the process are both produced by the party
that wishes to securely receive data. These keys are:
The Public Key
This key is used by the sender to encrypt data before sending it to
the receiving party. The key is produced by the receiver and it can
be made available publicly for anyone that wishes to send data to the
receiving party. This key does not need to be kept secret as it can
only be used to encrypt data. It is impossible to decrypt data using
the public key.
The Private Key
The private key be kept securely by the person that wishes to receive
data securely. This is the key that can decrypt any data that
encrypted using the public key.
Chapter 3.exe from next page.
Topics to be covered-
Candidates should be able to:
a) Understand what is meant by a core, cache and
clock in a CPU and explain how they can affect
the performance of a CPU
b) Understand the purpose and use of an instruction
set for a CPU
c) Describe the purpose and characteristics of an
embedded system and identify devices in which
they are commonly used
Candidates should be able to:
a) Describe what is meant by virtual memory, how
it is created and used and why it is necessary
b) Understand what is meant by cloud storage
c) Explain the advantages and disadvantages of
storing data on the cloud in comparison to
storing it locally
d)Understand that a computer needs a network
interface card (NIC) to access a network
3(a) Understand what is meant by and the
purpose of an internet protocol (IP) address
(b) Understand that there are different types of
IP address
(c)Describe the role of a router in a network
Core,cache and Internal Clock
There are a lot of factors which effect the performance of a CPU.
There are 5 things which effect the performance:
1)System Clock-The clock defines the clock cycle run the computer
operations. By increasing clock speed the processing speed of the PC
also increased. Hence this means now your pc can carry out more task
in less time. 3.5GHz is a good clock speed. (means you pc carries out
3.5 billion cycles a second)
2) The width of address and data bus can also affect performance.
3) Overclocking-This means increasing your clock speed by accessing
your BIOS (Basic Input/output System) and altering their settings.
This however can cause some problems such as:
(i) Execution of instruction outside design limits. The computer would
frequently crash!
(ii) Overclocking can lead to overheating.
4)Use of cache memory-
● Cache is located in CPU
● Cache stores frequently used instructions
● CPU check cache then goes to RAM when reading memory
● Larger the size of cache memory better the performance.
5) The use of different number of cores as each core can handle a
different data thread simultaneously, allowing for a much quicker
transfer of data at any given time.
Embedded Systems
Embedded Systems is a combination of hardware and software which is
designed to carry specific task.
They can be based on-
Microcontroller-A microcontroller is an example of a single board
computer (SBC) and is manufactured as an integrated circuit (IC). It
can be programmed to perform different processing functions.
Microprocessor-integrated circuit which only has a CPU on chip (no ram
rom)
Systems on chips(SoC)- may contain microcontroller as one of its
components (always almost CPU)
Examples of embedded systems include:
● central heating systems
● engine management systems in vehicles
● domestic appliances, dishwashers and TVs
● digital watches
● electronic calculators
● GPS systems
● fitness trackers
Embedded systems can have advantages over general purpose computers in
that:
● Their limited number of functions means they are cheaper to
design and build.
● They tend to require less power. Some devices run from
batteries.
● They do not need much processing power. They can be built using
cheaper, less powerful processors.
Embedded Systems disadvantages-
● it can be difficult to upgrade some devices to take advantage of
new technology
● troubleshooting faults in the device becomes a specialist task
● the internet is also open to hackers, viruses, etc
● can lead to an increase in the ’throw away’ society if devices
are discarded just because they have become out-of-date
-> These are not programmable by user they are already programmed
by the manufacturer. It can be possible to update the software
though. This can be done by connecting them to your PC.
Data Storage
Solid State storage (SSD)
● Latency was issue in HDD.So SSD doesn’t have any moving
parts.
● It works by controlling movement of electrons by NAND or NOR
chips.
● The data is stored as 0s and 1s in millions of tiny
transistors
● This effectively produces a non-volatile rewritable memory.
Floating gate and control gate transistors
● This uses CMOS (complementary metal oxide semi-conductor) and
NAND.
● Flash memories make use of a matrix: at each intersection on the
matrix there is floating gate and control gate.
● A dielectric coating separates the two transistors which allows
the floating gate transistor to retain its charge.
● The floating gate has value 1 when charged and value 0 when
uncharged.
● A voltage is applied to the control gate and electrons move but
get stuck in floating gate
● By this you have control over the bits value stored
Benefits of SSD
● they are more reliable (no moving parts to go wrong)
● they are considerably lighter (which makes them suitable for
laptops)
● they don't have to 'get up to speed' before they work properly
● they have a lower power consumption
● they run much cooler than HDDs (both these points again make them
very suitable for laptop computers)
● because of no moving parts, they are very thin
● Data access is considerably faster than HDD.
virtualmemory.exe on the next page
Virtual memory uses both hardware and software to enable a
computer to compensate for physical memory shortages, temporarily
transferring data from random access memory (RAM) to disk
storage.
RAM = physical memory and virtual memory = RAM + swap space on
the HDD or SSD.
So to execute program in this data is loaded from HDD or SSD
whenever required.
Virtual memory gives the illusion of unlimited program being
present this can be true as even though RAM is full data can be
moved from HDD and SSD.
In OS paging is used by memory management to store and retrieve
data from HDD/SSD and copy it into RAM
A page is a fixed length consecutive block of data utilized in
virtual memory systems.
Virtual memory works by allowing data blocks to be moved from HDD
to RAM.
Benefits-
● » programs can be larger than physical memory and still be
executed
● > there is no need to waste memory with data that isn't
being used (e.g. during error handling)
● it reduces the need to buy and install more expensive RAM
memory (although as mentioned earlier there are limits to
the value of doing this).
Using HDD for virtual memory cause problem such as disk thrashing. As
main memory fills data needs to be swapped frequently leading to very
high rate of reading and writing movement(this is known as disk
thrashing).
More time is eventually spent moving data out of memory and processing
it this will reduce PC performance and will come a point where
everything will come to halt as the system gets busy ‘moving’ the
data.This is known as thrash point.
Can also lead to failure of HDD
Install RAM to avoid this or use SSD for virtual memory.
CLOUD STORAGE
Cloud Storage i
s a method of data storage where data is stored on remote
servers.
Data Redunduncy- Storing the same data on more than one server in
case of maintenance and repair to let the people access it
anytime.
3 common systems
Pulic cloud-storage environment where customer and cloud storage
provider are different companies
Private cloud-Private cloud provides a high level of security and
privacy to data through firewalls and internal hosting.For data which
is sensitive.
Hybrid Cloud-Combination of both.Some data is sensitive and the less
sensitive can be accessed by public cloud.
Instead of storing data in HDD or SSD we store it in ‘cloud’.
Potential data loss when using cloud
There is a risk that important data could be stolen and deleted from
cloud storage as there is always another loop hole in system.
Some risks-
● The XEN security threat which forced many cloud operators ro
reboot all cloud server.Problem cause by XEN hyoervisor
● Hackers can gain access to your account and sell your photos
personal sensitive information
● Cloud service provider lost data during back up routine.
Network Interface Card
A NIC is needed to allow a device to connect to a network.It contains
MAC Adress out in it during manufacturing.
WNIC (wireless) does the same job but allows wireless connectivity by
having antenna itself.
Types of MAC Address
UAA-Universally Administered MAC Address
LAA-Locally Administered MAC Address
UAA is the most common and it’s set at the manufacturing time in the
factory. Rare for user to want to change it.
The address can be changed but will cause problems if not unique.
There are a few reasons why the MAC address needs to be changed
using LAA:
» certain software used on mainframe systems need all the MAC
addresses of devices to fall into a strict format
» necessary to bypass a MAC address filter on a router or a firewall;
only MAC addresses with a certain format are allowed through,
» to get past certain types of network restrictions it may be
necessary to emulate unrestricted MAC addresses
There are 2 types of IP address IPv4 and IPv6
● IPv4 is based on 32 bits and the address is written as four
groups of eight bits
● 32 bits used in IPv4 which reduced number of router being used at
once
● To solve the problem we have IPv6 which has 128 bits in eight
groups and uses HEX code
● allows the internet to grow in terms of the number of hosts and
potential increase in the amount of data traffic
● Advantages over IPv4 are ➖
● removes the risk of IP address collisions
● » has built-in authentication checks
● » allows for more efficient packet routes
There are 2 types of IP address.Staic and Dynamic
Static ram is usually assigned to you by your ISP and can;t be changed
even if you log onto any other device.
There are usually assigned to -
● An online database
● Remote server hosting website
● A File transfer protocol server
Dynamic Ip addresses are assigned by the ISP each time a device logs
onto the internet.This is done using DHCP (Dynamic Host configuration
protocol).A device with this changes IP address with every login.
Routers
● Routers enable data packets to be routed between different
networks, for example, to join a LAN to a WAN.
● It takes data transmitted in one format and changes it to the
format network could understand.
● Usually has internet cable in it which allows PC and other
devices to connect to LAN.
❖ Router's main function is to transmit internet and transmission
protocols between two networks
● also allow private networks to be connected together.
Broadband one sits behind the firewall which protects computers on a
network.
How things happens?
● Router inspects any data packet sent to it through the network
connected to it.Since every computer is connect on the same
network has the same part of IP Address.
● Router is able to send the data packet to appropriate switch then
the data will be sent to the correct device using MAC Address.
● If MAC Address doesn’t match any device connected to switch the
data is then forwarded and passed on until an appropriate device
is found.
Routers can be connected through wires and wirelessly.
INSTRUCTION SET
In a CPU, the instruction set refers to the different types of
operations that a CPU is capable of performing.
Instruction sets are referring to the low level machine code
instructions that a CPU is built to handle.
Low level operations are split into an opcode and an operand.
Opcode - Represents the machine instruction i.e. what it has to do -
ADD, LOAD, STORE or SUBTRACT
Operand - This is either the value to be operated on OR the address
that holds the value to be operated on.
Each CPU only has a limited number of opcodes available to them and
the available opcodes is what is referred to as the instruction set.
● As the instructions are hard coded with transistors it is
obviously not possible to add more with a software update
Registers
Registers are small amounts of high-speed memory contained within the
CPU. They are used by the processor to store small amounts of data
that are needed during processing, such as:
the address of the next instruction to be executed
the current instruction being decoded
the results of calculations
BUS
A bus is a high-speed internal connection. Buses are used to send
control signals and data between the processor and other components.
Three types of bus are used:
Address bus - carries memory addresses from the processor to other
components such as primary memory and input/output devices.
Data bus - carries the actual data between the processor and other
components.
Control bus - carries control signals from the processor to other
components. The control bus also carries the clock's pulses.
Cache
Cache is a small amount of high-speed random access memory (RAM) built
directly within the processor. It is used to temporarily hold data and
instructions that the processor is likely to reuse. This allows for
faster processing as the processor does not have to wait for the data
and instructions to be fetched from the RAM.
Stored Program Concept;
It uses a CPU which can directly access the memory. The computer memory
can store data as well as instructions. These instructions could be
fetched, decoded and then executed in a sequential order.
- Data stored on circular disks called platters which are divided into tracks
and sectors - Spindle rotates the platters under the read/write heads -
Read/write heads access and add data to the platters using electromagnets -
Slower than SSD because of longer access time - Usually larger storage than
SSD - Less expensive than SSD