0 Introduction to OS&A.md
Document Details
Uploaded by ExtraordinaryMountRushmore4433
Tags
Full Transcript
[[Left out content slides]] **Lecture- Intro to number systems** - [[Binary]] - [[Octal]] - [[Hexadecimal]] - [[Denary]] - [[Two's Complement]] **Lecture - Data Representation and Digital Logic** - [[Character set]] - [[Colours]], [[images]], [[videos]], [[audios]], [[graphics]] - [[...
[[Left out content slides]] **Lecture- Intro to number systems** - [[Binary]] - [[Octal]] - [[Hexadecimal]] - [[Denary]] - [[Two's Complement]] **Lecture - Data Representation and Digital Logic** - [[Character set]] - [[Colours]], [[images]], [[videos]], [[audios]], [[graphics]] - [[instruction sets]] - [[File format and extension]] - [[metadata]] - [[Encoding Base64 & 32]] - [[Endianness]] - [[compression]] - [[Encryption]], [[AES (Advanced Encryption Standard)]], [[RSA (Rivest, Shamir, & Adleman)]] - [[Data types]] - [[Encoding]] - [[SQLi (Structured Query Language Injection)]], [[XSS (cross-site scripting)]], [[Buffer overflow]] **Lecture - Digital Logics and Boolean Functions** - [[Boolean Arithmetic and logic]] - [[Logic Gates]] - [[Flip flops]], [[latches]] - [[full-adder]], [[half-adder]], [[4-bit adder]] - [[4-bit subtractor]] - [[Comparators]] - [[Karnaugh map]] - [[registers]] - [[MUX (Multiplexer)]] - [[ALU (Arithmetic Logic Unit)]] - [[Bus]] - [[DRAM (Dynamic RAM)]] - [[SRAM (Static RAM)]] **Lecture - Memory System and Storage** - [[memory]] - [[Internal memory]] - [[External Memory]] - [[Primary memory]] - [[Secondary memory]] - [[Memory Hierarchy]] - [[I,O System]] - [[Microprocessor]] **Cyber-attack surface examples:** [[Hardware]] : [[DDoS (distributed denial of service attack)]], [[Buffer overflow]], [[HW rootkit]] [[Microcode]] : [[Spectre]] [[Meltdown]], [[Microcode backdoors]] [[Firmware]] : [[Chernobyl]], [[BIOS & UEFI malware]] [[OS (operating system)]]: [[Trojan]], [[Ransomware]] **[[Computer architecture]]:** The design of the abstraction layers that allow us to implement information processing applications efficiently using available manufacturing technologies, consists of several layers with standardized interfaces Application - **A combination of algorithms used to help the user complete a task**: word processors, web-browser applications, music/video encoding **Algorithms** - **A set of instructions used to complete a specific task:** Sorting, Searching, (De)Compression, (De/En)coding, JPEG, Dijkstra, AES Programming Language - **Representation of algorithms in high-level code that can be converted into low-level code**: C, C++, Java, Python Operating System - **Manages computing resources & provides a common interface between the user & programs:** Windows, Linux, macOS, Android, iOS, ChromeOS Instruction Set Architecture - **Machine language (Intermediary between hardware and software (converts physical signals into digital signals)):** [[x86]], [[ARM]], [[MIPS]], [[RISC-V]] Microarchitecture - **caches, buses, registers (Register-Transfer), pipelining, SPL(High-level combination of hardware elements):** Core, Pentium, Atom Logic Gates - **floor plan, wires & signal distribution(mid-level combination of hardware elements:):** [[Latch]], [[XOR]], signal Circuits - **Electricity effects(low-level combination of hardware elements built from fundamental physics effects):** [[Transistor]]s, [[Voltage]], [[Current]] Physics - **Low level physics effects:** [[semiconductor]], [[Electron]], [[Diffusion]] Yellow = Software Orange = HW/SW interface red = Hardware **[[OS Classification & Categorization]]:** **[[C's primitive data types]]:** Primitive datatype: The fundamental datatypes which all other datatypes are built upon **[[Boolean algebra]]:** Utilises True (1) & False (0), & logic operators (conjunction(AND), disjunction(OR), negation(NOT)) **[[Logic Gates]]:** - AND ∧ & - NAND - OR + ∨ - NOR ⊽ - XOR ⊻ ⊕ - XNOR ⊙ - NOT ¬ ! - \' ![[Pasted image 20240920172837.png|500x600]] **[[Machine Arithmetic]]:** Addition (done by [[half-adder]]/[[full-adder]]) Subtraction (done by adding using 2's complement) Multiplication (done by repeated addition) Division (done by repeated subtraction (repeatedly adding 2's complement )) **Addition is the most efficient arithmetic task for hardware** **[[Floating Point IEEE 754 Standard]]:** The universal standard for representing floating point numbers S = Sign | 0 = +ive , 1 = -ive E = Exponent | Determines how the mantissa is scaled (2^E), dot is then shifted Left/Right Exponent amount of times (or the number can be converted into denary and multiplied by the denary value of the exponent e.g. 2^E = 2^3 = 8, thus mantissa multiplied by 8 = final number value) M = Mantissa | Stores the significant digits of the number bias (B) = a number added to the actual exponent to ensure positive and negative exponents can be stored Eactual value = Estored value - Bias Need for normalisation (The same number can be represented in infinitely many ways if normalisation isn't used (leads to confusion)) In normalised form: - The decimal point is always after the MSB - The MSB is always the sign - The mantissa is led by 1. Value = (-1)^S x M x 2E - **Single precision** **(32-bit)** | 1 bit (S) | 8 bits (E) | 23 bits (M) | B = add 127 in binary (all bits1 MSB 0) - Used in applications that need memory limited / low precision decimals - To represent 2^2, the exponent stored is 0+127=127 (in binary: `01111111`). - To represent 2^-2, the exponent stored is −2+127=125(in binary: `01111101`). - To represent 2^3, the exponent stored is 3+127=130 (in binary: `10000010`). exponents binary value -127 is the value of the exponent There's always an implicit leading 1 on the mantissa thus you must add 1 as the new MSB (-1)^S * 2^(E - B) * 1.M (-1)^0 * 2^(127 - 127) * 1.11000000000000000000000 = 1 x 2^0 x1.75 = 1.75 - **Double Precision** **(64-bit)** | 1 bit (S) | 11 bits (E) | 52 bits (M)| B = add 1023 in binary (all bits1 except MSB 0) - Used in applications that need high range & precision decimals - exponents binary value -1023 is the value of the exponent - Theres always an implicit leading 1 on the mantissa thus you must add 1 as the new MSB - **Extended precision** **(80-bit)** | 1 bit (S) |15 bits (E) | 64 bits (M)| B = add 16838 in binary (all bits1 MSB 0) - Used in applications that need very high range & precision decimals - exponents binary value -16383 is the value of the exponent - There is leading 1 is EXPLICITLY stored (can be seen) **Floating point difficulties:** - 32 bit can only go to 8 decimal digits of precision - rounding errors - many decimal fractions cannot be represented exactly in binary - leads to inaccuracies - Implementation (Requires special hardware to implement (FPU-Float Point Unit) or needs to be [[emulated]] in software (slower & more processing power)) ![[Pasted image 20240920194300.png]] **[[Overflow]]:** Occurs when the result of a numerical operation is too large to be represented in the allocated memory space. **[[underflow]]:** Occurs when the result of a numerical operation is too small to be represented in the allocated memory space. **[[Sign & magnitude]]:** MSB indicates sign (1 = -ive,0 = +ive) For 8 bits (+128 to -128 is the range) Problems: - 2 values for 0 (+0 & -0) - Has complex rules for addition or subtraction (more logic gates & circuitry & voltage needed) **[[Digital logic]]:** The use of 1s & 0s to perform operations and make decisions - **Binary representation:** - Uses binary to perform operations & make decisions using logic gates, circuits & signals (electric/electromagnetic/magnetic). - **Foundational for computing:** - Every computational operation relies on digital logic (Microprocessors, memory & other hardware components rely on digital logic) - **Reliability & precision:** - Less affected by noise or degradation compared to [[analogue systems]] systems as the system only needs to distinguish between true 1 & false 0 therfefore the results are precise and reproduceable - **Simple design:** - Simplifies the design of circuits so that more complex functions can be constructed (multiplexers, decoders and arithmetic units) - Modular designs are easy to create (where small building blocks (logic gates) can be combined to build complex systems) - **Automation and control:** - Control systems are often built using digital logic to enable the automation of tasks: sensors are used for input & processing is done by the digital logic using logic gates and comparators to determine the output. - **Error detection & correction (networking):** - [[parity]] checks & [[CRC (Cyclical Redundancy Check)]] - **Programmable systems:** - Digital logic is fundamental to programmable devices such as [[FPGA (Field Programmable Gate Array)]]s, which can be used to implement logic circuits for specific applications - **Highly Scalable:** - Can be used in both small simple (e.g. microcontrollers) & large complex devices (e.g. processors in servers) **[[De Morgan's Theorem]]:** NOT AB NOT A OR NOT B ![[Pasted image 20240921130327.png]] **[[half-adder]]:** 2 inputs (A, B), 2 outputs (S, Cout) Performs basic binary addition without factoring a Cin ![[Pasted image 20240921132041.png]] **[[full-adder]]:** 3 inputs(A, B, Cin), 2 Outputs (S,Cout) Performs binary addition while factoring a Cin ![[Pasted image 20240921132226.png]] [[Temporal Locality]] [[Spatial Locality]] [[RAM (Random Access Memory)]] [[SRAM (Static RAM)]] [[DRAM (Dynamic RAM)]] [[DDR SDRAM (Double Data Rate Synchronous Dynamic RAM)]] [[SDRAM (Synchronous Dynamic RAM)]] [[RAM performance factors]] [[Main memory]] [[Hit ratio]] [[cache]] [[HDD (Hard Disk drive)]] [[SSD (Solid State Drive)]] - [[Flash memory]]