Computer Hardware Components
Memory
● Definition: Memory stores data and instructions that the CPU accesses during processing.
● Types:
○ Primary Memory:
■ RAM (Random Access Memory): Volatile memory used for temporary storage while a
program runs.
■ ROM (Read-Only Memory): Non-volatile memory for storing boot-up instructions.
○ Secondary Memory: Persistent storage devices like hard drives, SSDs.
○ Cache: High-speed memory located closer to the CPU for frequently used data.
○ Registers: Small storage areas in the CPU for immediate data processing.
Processor (CPU)
● Definition: The Central Processing Unit executes instructions from programs.
● Components:
○ ALU (Arithmetic Logic Unit): Performs arithmetic and logic operations.
○ Control Unit: Directs data flow and manages execution of instructions.
○ Registers: Hold intermediate results and data temporarily.
I/O Devices
● Definition: Devices used to interact with the computer.
● Examples:
○ Input Devices: Keyboard, mouse, scanner.
○ Output Devices: Monitor, printer, speakers.
○ Input/Output Devices: Touchscreen, USB drives.
Storage
● Primary Storage: Includes RAM and ROM, used for quick data access.
● Secondary Storage: Long-term storage, such as HDDs and SSDs.
● Tertiary Storage: Backup storage, such as optical discs and magnetic tapes.
Operating System (OS)
● Definition: Software that manages hardware, software resources, and provides services to programs.
● Functions:
○ Process management.
○ Memory management.
○ File system handling.
○ Device management.
○ Security and user interface.
Software Development Concepts
Assembler
● Converts assembly language code (low-level) into machine language (binary).
Compiler
● Translates entire high-level code (e.g., C, C++) into machine code before execution.
Interpreter
● Converts high-level code to machine code line by line, executing as it translates.
Loader
● Loads machine code into memory for execution after it is compiled.
Linker
● Combines object files (.obj) into a single executable (.exe).
Algorithm Representation
Algorithm
● Definition: A step-by-step procedure for solving a problem.
Example:
plaintext
Copy code
Algorithm to find the sum of two numbers:
1. Start
2. Input two numbers: A and B
3. Compute sum: Sum = A + B
4. Display Sum
5. Stop
Flowchart
● Definition: A diagrammatic representation of an algorithm using symbols.
Example:
css
Copy code
Start → Input A, B → Process (A + B) → Output Result → End
Pseudocode
● Definition: A textual representation of an algorithm in plain language.
Example:
plaintext
Copy code
BEGIN
READ A, B
SUM = A + B
PRINT SUM
END
From Algorithms to Programs
● Translate the algorithm or pseudocode into a programming language to create the source code.
Source Code
● The human-readable code written in a programming language (e.g., C, Python).
Compilation Process of a C Program
1. Source Code (.c): The code you write in a text editor.
2. Preprocessing: The preprocessor handles directives like #include and #define.
3. Compilation: Translates the preprocessed code into assembly language (.asm file).
4. Assembly: Converts assembly language into machine code, resulting in an object file (.obj).
5. Linking: Combines object files and libraries into an executable (.exe).
Number Systems
1. Binary (Base 2):
○ Uses digits 0 and 1.
○ Example: 10112=11101011_2 = 11_{10}10112=1110.
2. Octal (Base 8):
○ Uses digits 0 to 7.
○ Example: 178=151017_8 = 15_{10}178=1510.
3. Decimal (Base 10):
○ Uses digits 0 to 9.
○ Example: 151015_{10}1510.
4. Hexadecimal (Base 16):
○ Uses digits 0-9 and letters A-F.
○ Example: A116=16110A1_{16} = 161_{10}A116=16110.