How Computer Works in the
Context of Programming
Hardware and Software
• • Hardware: Includes CPU, memory,
input/output devices.
• • Software: Instructions written in
programming languages.
The CPU: The Brain of the
Computer
• • Central Processing Unit (CPU) executes
instructions.
• • Consists of Control Unit (CU) and Arithmetic
Logic Unit (ALU).
Fetch-Decode-Execute Cycle
(Instruction Cycle)
• 1. Fetch: Retrieve instruction from memory.
• 2. Decode: Interpret the instruction.
• 3. Execute: Perform the instruction.
• 4. Store: Write back result to memory.
Memory and Storage
• • RAM: Temporary storage for running
programs.
• • Storage (Hard Drives/SSDs): Permanent data
storage.
Programming Languages
• • High-Level Languages: Python, Java, C++ are
easier for humans to understand.
• • Low-Level Languages: Assembly is closer to
machine code.
Compilers and Interpreters
• • Compiler: Converts high-level code to
machine code before execution (e.g., C, C++).
• • Interpreter: Executes code line-by-line (e.g.,
Python).
Operating System (OS)
• • OS manages hardware, memory, and
processes.
• • Acts as an intermediary between software
and hardware.
Input/Output (I/O) Operations
• • Programs interact with external devices for
input/output.
• • Programming languages provide APIs for
handling these operations.
How Code Runs: A Simple Example
• 1. Write the code (e.g., C program).
• 2. Compile into machine code.
• 3. OS loads program into memory and CPU
executes instructions.
Efficiency and Performance
• • Efficient code uses memory, CPU, and I/O
operations effectively.
• • Optimization helps improve performance.
Programmer’s vs Computer’s
Perception
• • Programmer sees the program as a set of
commands (syntax).
• • Computer processes them as binary
sequences.

How_Computer_Works_in_the_Context_of_Programming.pptx

  • 1.
    How Computer Worksin the Context of Programming
  • 2.
    Hardware and Software •• Hardware: Includes CPU, memory, input/output devices. • • Software: Instructions written in programming languages.
  • 3.
    The CPU: TheBrain of the Computer • • Central Processing Unit (CPU) executes instructions. • • Consists of Control Unit (CU) and Arithmetic Logic Unit (ALU).
  • 4.
    Fetch-Decode-Execute Cycle (Instruction Cycle) •1. Fetch: Retrieve instruction from memory. • 2. Decode: Interpret the instruction. • 3. Execute: Perform the instruction. • 4. Store: Write back result to memory.
  • 5.
    Memory and Storage •• RAM: Temporary storage for running programs. • • Storage (Hard Drives/SSDs): Permanent data storage.
  • 6.
    Programming Languages • •High-Level Languages: Python, Java, C++ are easier for humans to understand. • • Low-Level Languages: Assembly is closer to machine code.
  • 7.
    Compilers and Interpreters •• Compiler: Converts high-level code to machine code before execution (e.g., C, C++). • • Interpreter: Executes code line-by-line (e.g., Python).
  • 8.
    Operating System (OS) •• OS manages hardware, memory, and processes. • • Acts as an intermediary between software and hardware.
  • 9.
    Input/Output (I/O) Operations •• Programs interact with external devices for input/output. • • Programming languages provide APIs for handling these operations.
  • 10.
    How Code Runs:A Simple Example • 1. Write the code (e.g., C program). • 2. Compile into machine code. • 3. OS loads program into memory and CPU executes instructions.
  • 11.
    Efficiency and Performance •• Efficient code uses memory, CPU, and I/O operations effectively. • • Optimization helps improve performance.
  • 12.
    Programmer’s vs Computer’s Perception •• Programmer sees the program as a set of commands (syntax). • • Computer processes them as binary sequences.