Data Representation, Transmission, and Hardware Fundamentals, Lecture notes of Computer science

A concise overview of fundamental concepts in computer science, focusing on data representation, data transmission, and hardware components. It covers topics such as binary, denary, and hexadecimal number systems, overflow errors, logical shifts, and methods for converting text, images, and sound into binary format. The document also discusses file compression techniques, including lossy and lossless compression, and explores data transmission methods like serial and parallel transmission, along with error detection methods such as parity checks, checksums, and arq. Additionally, it touches on hardware components like the cpu, microprocessor, and embedded systems, explaining the fetch-decode-execute cycle and factors affecting cpu performance. Finally, it briefly mentions sensors in automated systems, providing a foundational understanding of how data is captured and processed in computer systems. Useful for high school students studying computer science.

Typology: Lecture notes

2024/2025

Available from 08/03/2025

FATTOUH
FATTOUH 🇺🇸

4.3

(3)

766 documents

1 / 46

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Takes less space than binary
Easier to read and write
Easier to debug
Used in: MAC addresses, IPv6, HTML color codes, assembly language, error
codes
Denary: Base 10 system (0-9)
Easy for humans to read
Less range than hexadecimal
Overflow Error
Occurs when a number larger than a register can store is generated
Example: Value greater than 255 in an 8-bit register
Computer has a predefined limit for storage; overflow is when a value outside this limit is
generated
Logical Shifts
Can be left or right
Left or right most ones are lost and places are filled with 0s
Most or least significant bits are lost
Each left shift means multiply by 2
Each right shift means divide by 2
Converting Text to Binary
Done using a character set (ASCII or Unicode)
Each character has a unique binary value
ASCII represents up to 8-bit binary numbers
Unicode is a newer version with greater range (16-bit)
Unicode requires more bits per character
Converting Images to Binary
Image is made of pixels
Each pixel stores one colour
Image has a set number of pixels wide by pixels high
Each colour has a unique binary value/colour code
The colour/binary value of each pixel is stored in sequence
File contains metadata to identify how the file should be displayed
Metadata can include colour depth/resolution
Image resolution: The dimensions of an image (pixels wide × pixels high)
Colour depth: Number of bits used to represent each colour
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c
pf2d
pf2e

Partial preview of the text

Download Data Representation, Transmission, and Hardware Fundamentals and more Lecture notes Computer science in PDF only on Docsity!

○ Takes less space than binary ○ Easier to read and write ○ Easier to debug ○ Used in: MAC addresses, IPv6, HTML color codes, assembly language, error codes ● Denary : Base 10 system (0-9) ○ Easy for humans to read ○ Less range than hexadecimal

Overflow Error

● Occurs when a number larger than a register can store is generated ● Example: Value greater than 255 in an 8-bit register ● Computer has a predefined limit for storage; overflow is when a value outside this limit is generated

Logical Shifts

● Can be left or right ● Left or right most ones are lost and places are filled with 0s ● Most or least significant bits are lost ● Each left shift means multiply by 2 ● Each right shift means divide by 2

Converting Text to Binary

● Done using a character set (ASCII or Unicode) ● Each character has a unique binary value ● ASCII represents up to 8-bit binary numbers ● Unicode is a newer version with greater range (16-bit) ● Unicode requires more bits per character

Converting Images to Binary

● Image is made of pixels ● Each pixel stores one colour ● Image has a set number of pixels wide by pixels high ● Each colour has a unique binary value/colour code ● The colour/binary value of each pixel is stored in sequence ● File contains metadata to identify how the file should be displayed ● Metadata can include colour depth/resolution ● Image resolution : The dimensions of an image (pixels wide × pixels high) ● Colour depth : Number of bits used to represent each colour

● File size increases with higher resolution and colour depth

Converting Sound to Binary

● Sound sampling is done to record sound waves at set time intervals ● Sample rate: Number of samples taken per second ● Sample resolution: Number of bits per sample (defines amplitude variations) ● Determines how quiet/loud sounds can be recorded (e.g., 16-bit) ● Loudness and pitch depend on sample resolution

File Compression

Benefits of Compression

● Reduces storage/memory space ● Sending/receiving email accounts may have restricted file size for attachments ● Reduces time taken to transmit/upload/download ● Reduces bandwidth needed ● Reduces data usage (for mobile clients)

Lossy Compression

● Permanently removes data deemed unnecessary ● Suitable for images and sound ● For images: removes colors humans can't distinguish, reduces color depth and resolution ● For sound: removes sounds humans can't hear, reduces sample resolution and rate ● Not suitable for text files as it will damage/corrupt the file ● Quality of images will be reduced

Lossless Compression

● Uses compression algorithms without permanently removing data ● Common method: RLE (Run Length Encoding) ● Identifies repeating patterns/words/characters/phrases ● Indexes patterns with their number of occurrences and position ● Suitable for text files

2. Data Transmission

Packets

● Small units of data ● Structure:

Error Detection Methods

Parity Check

● Parity can be set to odd or even ● Sender and receiver agree on parity to use ● Data is split into bytes/blocks of 7 bytes ● Sender counts the number of 1s/0s in each group/byte ● Each group/byte is assigned a parity bit to match the parity (odd/even) ● Receiving device recounts the number of 1s/0s in each group/byte ● Compares to parity used; if it does not match, an error is reported ● (In block check) the location of errors can be identified at the intersection ● Limitation: If two bits are corrupted, parity check might not detect the error

Checksum

● Value is calculated from the data using an algorithm ● Value is transmitted with the data ● Value is recalculated by receiver using the same algorithm ● If checksum values are different, there is an error

Echo Check

● Involves comparison of data ● Sending device sends the data ● Receiving device retransmits the data back to sender ● Sending device compares the returned data to what it sent ● If same data, no error; else, error ● Slow method and errors can occur during retransmission

Automatic Repeat Request (ARQ)

● Uses acknowledgment and timeout ● Sender starts a timer when data is transmitted ● Receiver uses an error checking method ● If no error detected, a positive acknowledgment is returned ● If error detected, negative acknowledgment is returned ● If sender gets no acknowledgment within the set time, it resends the data

Data Entry Error Detection

Check Digit

● Used to check for errors in data entry ● A check digit value is calculated from data using an algorithm (e.g., ISBN-13) ● Number is stored with data

● When data is entered, value is recalculated ● If same, then it's correct; if not, error in entry ● A type of validation

Encryption

● Done to make data secure ● Data before encryption is plain text ● Encryption key is the algorithm used ● Cipher text is the name after encryption

Symmetric Encryption

● Shared key used to encrypt and decrypt ● Both the sender and receiver know the key ● Used at small scale ● Less secure (easier for hackers to intercept both key and text)

Asymmetric Encryption

● Different keys: public key and private key ● Public key to encrypt the data and private key to decrypt ● Anyone can know the public key but only those intended know the private key ● Two different keys make it more secure ● Used at larger scale

3. Hardware

Input and Output Devices

Input Devices

● Keyboard ● Mouse ● Scanner ● Touch screen ● Microphone ● Camera/webcam

Output Devices

● Monitor/screen ● Printer ● Speakers ● Projector

● Program Counter has the address of next instruction stored (a location in RAM) ● PC sends this address to MAR using address bus ● MAR sends this address to RAM using address bus ● RAM sends the data at that address to MDR using data bus ● MDR sends that data to CIR using data bus in control unit

Decode Stage

● Control Unit decodes using instruction set ● Instruction set: A list of machine code commands that can be processed by the CPU

Execute Stage

● If decoded data needs mathematical processing, it is sent to ALU ● ALU performs arithmetic processes ● Accumulator stores interim data ● CU tells all components to perform their function using the control bus

Factors Affecting CPU Performance

Cores

● A single core contains all components to do one FDE cycle ● One core means one FDE at a time ● Multiple cores enable faster processing and multitasking ● Increased performance as instructions can be processed simultaneously

Clock Speed

● Clock speed determines number of FDE cycles per second ● 1 Hz = 1 FDE per second ● Usually measured in GHz (billions of instructions per second) ● Overclocking can increase speed

Cache

● Data storage in CPU that stores frequently used data/instructions ● Speeds up processing by avoiding repeated memory fetches ● Purpose: To speed up access as it's faster to access than RAM

Sensors in Automated Systems

● Capture different types of data to be processed by the system ● Convert analog data from environment to digital for processing ● Types include: ○ Acoustic: Measures sound

○ Accelerometer: Measures acceleration forces ○ Flow: Measures fluid flow ○ Gas: Measures gas presence and concentration ○ Humidity: Measures moisture levels ○ Infrared: Measures infrared radiation, can show distance ○ Level: Measures fluid levels ○ Light: Measures environmental light ○ Magnetic Field: Measures magnetic fields ○ Moisture: Measures moisture levels

Primary Storage

RAM (Random Access Memory)

● Directly accessible by CPU ● Volatile storage (loses data when power is off) ● Stores data/instructions currently in use ● Contents constantly change ● Can be increased easily ● Used in the FDE cycle ● Stores: ○ Currently running data ○ Currently running instructions ○ Currently running parts of OS

ROM (Read-Only Memory)

● Directly accessible by CPU ● Non-volatile storage (retains data when power is off) ● Stores startup instructions : ○ BIOS ○ Bootstrap/bootloader ○ Firmware ● Contents are fixed and do not change (unless reprogrammed) ● Difficult to alter ● Stores data/instructions that should not change

Cache

● Stores frequently used instructions/data ● Volatile storage (temporary data) ● Faster access than RAM

Secondary Storage

○ Laser is shone at the disk ○ An arm/head moves the laser across the surface ○ Laser burns pits onto the surface ○ Laser reads the pits and lands on the surface ○ Reflected light is captured by a sensor ● Examples: Blu-ray, DVD, CD

Virtual Memory

● Extension of RAM using hard drive space ● Created when RAM is full ● System sends less urgently needed data to virtual memory as "pages" ● Pages are returned to RAM when needed ● Purpose: To run programs when there is insufficient RAM

Cloud Storage

● Collection of servers that store data in remote locations ● Accessed using internet connection ● Benefits: ○ Data accessible from any location (employees can work from anywhere) ○ Hardware owned/maintained by third party (company not responsible) ○ Storage can be easily increased/decreased ○ No need to house hardware (saves space) ○ Automatic backups ● Disadvantages: ○ Internet connection needed/must be stable ○ Employees could be pressured to work outside hours ○ May be less secure ○ Extra fees

Networking Components

NIC (Network Interface Card)

● Component necessary for computer to access a network ● Each NIC given a MAC address during manufacturing

MAC Address (Media Access Control)

● First part is manufacturer ID ● Second part is serial number ● Each part has 3 pairs of numbers (6 pairs of 2 digits total) ● Numbers between 00 and FF ● Separated by colons (:)

● 6 bytes long (48 bits) ● Represented in hexadecimal ● Physical address that uniquely identifies a device ● Doesn't change

IP Address (Internet Protocol)

● Allocated by router ● Functions: ○ Uniquely identifies a device on a network ○ Identifies global address on the internet ○ May not be unique ○ Can change ○ Uses 32 or 128 bits ○ Can be static or dynamic

Static IP

● IP address that does not change each time a device connects to a network

Dynamic IP

● IP address that changes each time a device connects to a network

IPv

● Older version ● 4 groups of numbers (12 numbers total) ● Separated by full stops (.) ● Values 0-255 in each group ● 4 bytes long (32 bits) ● Represented in denary ● Fewer combinations possible

IPv

● Newer version ● 8 groups of numbers (32 numbers total) ● Separated by colons (:) ● Values 0-FFFF in each group ● 16 bytes long (128 bits) ● Consecutive groups of 0000 can be replaced with :: ● Represented in hexadecimal ● More combinations possible

Router

Managing Files

● Creates, moves, copies, pastes, deletes, names, renames, sorts files

Managing Peripherals and Drivers

● Installs drivers and manages data flow between computer and peripherals ● Drivers translate data between computer and peripherals

Managing Memory

● Controls data movement in hardware like RAM ● Ensures processes have enough memory ● Prevents two processes from accessing the same memory location ● Enables multitasking

Managing Multitasking

● Allows multiple simultaneous tasks using interrupts

Managing Interrupts

● Decides which interrupts to handle and when ● Uses interrupt queues based on priority

Other Functions

● Provides platform for running applications ● Manages user accounts

Interrupts

Types of Interrupts

Software Interrupts

● Division by zero ● Data from memory ● Output required ● Two processes accessing same data ● Request for input ● Null value

Hardware Interrupts

● Key press/click ● Mouse movement

● Mouse button click ● Hardware errors (e.g., printer out of paper) ● Hardware failure ● New hardware connected ● Paper jam in printer ● Printer out of paper

Interrupt Handling Process

● When FDE finishes or before next FDE, processor checks interrupt queue ● Checks if interrupt has higher priority than current task ● If so, stores current process in stack and fetches the interrupt ● Identifies interrupt source ● Calls relevant Interrupt Service Routine (ISR) ● When finished, returns to previous process or handles next high-priority interrupt ● If not, executes another FDE cycle

Programming Languages

High-Level Languages

● Closer to English, less like machine language ● Machine-independent (portable) ● Easy to debug ● One statement can represent many low-level statements

Low-Level Languages

● Uses mnemonics ● Closer to machine language (binary or assembly) ● Not portable (only runs on specific machine) ● Allows direct hardware manipulation ● Occupies less memory ● Used in embedded systems ● Provides full control ● Does not need conversion

Types of Low-Level Languages

● Machine Code: Binary code that computers directly understand ● Assembly Language: Uses mnemonics; requires assembler to translate to machine code

Translators

Compiler

5. The Internet and Its Uses

Internet vs. World Wide Web

● Internet is infrastructure; WWW is collection of websites ● Website is collection of web pages ● URL is text-based address of a web page (contains protocol, domain name, web page)

Web Communication

HTTP/HTTPS

● HTTP: Protocol for transmitting web pages and related data ● HTTPS: Secure version of HTTP ○ Combines HTTP with SSL/TLS ○ Encrypts data for transmission ○ Uses digital certificates for authentication

DNS (Domain Name Server)

● Contains website names and corresponding IP addresses

Process of Retrieving Web Pages

  1. User enters URL in browser
  2. Browser sends URL to DNS to find IP address
  3. If not found in one DNS, request forwarded to others
  4. Once IP address is found, browser requests web page using HTTP
  5. Web server sends data (HTML, CSS, scripts)
  6. Browser renders and displays web page

HTTPS Connection Process

  1. Web browser sends request to web server for digital certificate
  2. Web server sends certificate to browser
  3. Browser checks certificate authenticity
  4. If authentic, secure connection created
  5. Data sent is encrypted
  6. If not authentic, connection rejected
  7. Uses protocol such as SSL/TLS

Web Browsers

SOFTWARE that allows users to view web pages and renders HTML ● Other functions: storing bookmarks, history, cookies, multitasking

Cookies

TEXT FILES that store user preferences ● Stored by browser, sent between web server and browser ● Uses: ○ Track browsing habits ○ Store personal details ○ Tailor web pages to user's preferences ○ Store shopping cart items ○ Customize advertisements

Types of Cookies

● Session cookies: Stored in memory/RAM, deleted when browser closes ● Persistent cookies: Stored on hard drive, remain until deleted or expired

Digital Currency

● Exists only electronically and is decentralized ● Cryptocurrency: Digital currency that is encrypted ● Blockchain: Digital ledger with time-stamped records that cannot be altered

Computer Security Threats

Brute Force Attack

● Trial and error to guess a passwordCombinations repeatedly entered until correct password found ● Can be manual or automated ● Common combinations tried first ● Aims: ○ Steal/view/access data ○ Delete data ○ Change data ○ Lock accounts/encrypt data ○ Damage business reputation ● Solutions: ○ Strong passwords ○ Limited login attempts ○ Biometric authentication ○ Two-factor authentication

Data Interception

● Data packets intercepted and examined (using packet sniffers)

Malware Types

Virus

● Downloads to hard drive ● Replicates itself ● Corrupts data or uses resources ● Slows or crashes system

Worm

● Replicates itself ● Exploits vulnerabilities ● Clogs bandwidth ● Slows network

Spyware

● Records user actions ● Example: Keylogger ● Sends data to hackers ● Used to steal personal information

Trojan Horse

● Disguised as legitimate software ● Contains hidden malware ● Releases malware when downloaded

Adware

● Creates pop-ups and banner ads ● Often unwanted and intrusive

Ransomware

● Locks and encrypts data ● Demands payment for decryption

Effects of Malware

● Data may be deleted/changed ● Website may be deleted/changed ● Server may crash when filled with data

Malware Solutions

● Anti-virus software ● Anti-malware programs ● Firewall protection ● Cautious downloading ● Regular data backups

Online Threats

Pharming

● Malicious software redirects to fake websites ● Purpose: Obtain PERSONAL details ● User believes they're on legitimate site ● Solutions: ○ Anti-malware ○ Visual verification ○ Download only from trusted sources

Phishing

● Genuine-looking "bait" emails ● Contains disguised links to fake sites ● Prevention: ○ Verify email legitimacy ○ Check URL ○ Verify HTTPS ○ Avoid opening random emails

Social Engineering

● Psychological manipulation to obtain confidential data ● Purposes: ○ Data theft ○ Criminal activity ○ Hacking ○ Identity theft ○ Fraud ● Prevention: ○ Access levels ○ Awareness training

Access Levels

● Limited access to specific data ● Different permission levels for different users