0% found this document useful (0 votes)
4 views44 pages

Week 1

The document provides an overview of computer systems and programming concepts, focusing on the components of a computer, including hardware, firmware, and software. It explains the roles of the CPU, memory, and operating systems, as well as the differences between high-level and low-level programming languages. Additionally, it discusses the importance of language translators like compilers and interpreters in enabling communication between programmers and machines.

Uploaded by

satvika.ag
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views44 pages

Week 1

The document provides an overview of computer systems and programming concepts, focusing on the components of a computer, including hardware, firmware, and software. It explains the roles of the CPU, memory, and operating systems, as well as the differences between high-level and low-level programming languages. Additionally, it discusses the importance of language translators like compilers and interpreters in enabling communication between programmers and machines.

Uploaded by

satvika.ag
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

CS1202 and CS1203

Programming and Data Structures (Python)

Introduction
Computer System and Components

Ashish Anand
Department of CSE, IIT Guwahati
Overview
• Introduce fundamental concepts of computing and programming
• Recap of main components of a computer system
• What Programming Means
• How algorithms and flowcharts are used to design computational
solutions
Learning Objectives
• Recall the main components of a computer system
• Differentiate between hardware, firmware and software
• Understand the purpose of operating systems
• Understand what programming is and identify different programming
paradigms
• Define algorithms and draw basic flowcharts
Why About Computers and Its components?
• Though not essential for learning programming

• Helps in understanding
• how programs get executed,
• effects of program’s instructions on the computer and its components
What is a Computer?
What is a Computer?
• An electronic device that processes data to produce useful
information.
• It follows the Input-Process-Output cycle
• Input: devices such as keyboard/mouse
• Process: performing calculations/logical operations
• Output: displaying via monitor/printer
• Storage: storing data on hard disks or SSDs
Components of a Computer System
• Hardware
• Visible physical elements of computers
• Tangible parts like CPU, RAM, etc

• Firmware: Software embedded into hardware devices (e.g. BIOS)

• Software:
• Instructions that control the hardware and make it perform specific tasks.
Two main types are:
• System Software (Operating Systems, Compilers)
• Application Software (Word processors, browsers)
Hardware: Central Processing Unit (CPU)
● Brain of the computer: Fetches instructions, process data, and controls
all operations of the computer
○ Executes all program instructions
○ Performs arithmetic and logical operations
○ Controls data flow between memory and devices
○ Determines overall system performance

👉 Every Program – including python codes – runs as a sequence of


instructions executed by the CPU
Major Components of a CPU
● Three main functional units
○ Arithmetic Logic Unit (ALU)
○ Control Unit (CU)
○ Registers

● ALU
○ Performs all arithmetic operations
– Addition, Subtraction,
Multiplication, Division
○ Performs logical operations – AND,
OR, NOT, comparisons (<, >, =)

👉 Every calculation in Python eventually becomes ALU operations.


Source: [Link]
CPU Component: Control Unit
● Directs and coordinates all activities of the CPU
● Decides
○ Which instruction to execute
○ Which data should be fetched or stored
○ Which unit should perform which operation

👉 The Control Unit does not compute, it controls. Kind of act like a supervisor.
CPU Component: Registers
● Small, ultra-fast memory locations inside the CPU
● Purpose: Store
○ Instructions being executed
○ Intermediate results
○ Memory addresses
● Common Registers
○ Program counter (PC): address of next instruction
○ Instruction Register (IR): current instruction
○ Memory Address Register (MAR): stores the memory address being executed
○ Memory Data Register (MDR): contains data read from or to be written to the
memory
○ General purpose Registers (GPR): used for various purposes, such as storing
data during calculations
CPU Working: Fetch-Decode-Execute Cycle
● Every instruction follows this cycle
● Step 1: Fetch
○ Instruction from main memory (RAM)
○ Address stored in Program Counter
● Step 2: Decode
○ Control unit decodes instruction:
■ What operation?
■ Which data?
■ Which registers?
● Step 3: Execute
○ ALU performs computation
○ Results stored in register or memory

👉 This cycle repeats billions of times per second.


CPU and Programming
● Statement: x = a + b
● Internally
○ Python interpreter converts code to lower-level instructions
○ Instructions loaded into memory
○ CPU:
■ Fetches instruction
■ ALU adds values
■ Generate and Stores results
■ Produce Outputs
Firmware
What does Firmware Do?
• Initialize hardware
• Checks if hardware components are working
• Sets up CPU, Memory, peripheral devices
• Boot the OS
• Locates OS on disk
• Loads it into memory
• Hands over control to OS
• Provides low-level control
• Directly controls device-specific actions
• Printer firmware controls paper movement
• Router firmware manages network packets
Common Examples of Firmware
• BIOS (Basic Input/Output System), UEFI (Unified Extensible Firmware
Interface)
• Embedded Device Firmware (Printers, Routers, Drones etc.)
• Peripheral Firmware (Keyboard, Mouse etc.)
Software
Software is a set of programs and related data that tells the computer
what to do and how to do it.

In other words,

Software is a collection of instructions that directs a computer to


perform specific tasks.
Why do we need Software?
● Without Software
● CPU does not know what to execute
● Memory cannot be meaningfully used
● Software
○ Runs on top of the operating system
○ Controls hardware
○ Enables communication between user and machine
○ Solves user problems
○ Provides user interface
Broad Classification of Software
● System Software
○ System software is designed to operate, control, and maintain the computer system
itself
○ Operating System (OS) is core of system software

● Application Software – Browsers, Editors


● Application software is designed to solve user-specific problems
● These are the programs users directly interact with
● Examples: Word processors, Browsers, University ERP, MATLAB, GAMES
● Programming and Development Software
● Tools to create software
● Editors, Compilers/Interpreters, Debuggers
What is an OS?
● An Operating System (OS) is system software that:
○ acts as an interface between user and hardware
○ manages all hardware and software resources

● Examples
○ Windows
○ Linux
○ macOS
○ Android
○ iOS

👉 The OS is the boss program of the computer.


Major Functions of OS
● Process Management
○ Runs multiple programs at once
○ Schedule CPU time
○ Handles multitasking
○ Example: Browser + Music + Python program

● Memory Management
○ Allocates RAM to programs
○ Frees memory after program ends
○ Manages virtual memory
Major Functions of OS
● File System Management
○ Creates, deletes, organizes files
○ Controls access permissions
○ Manage folders/directories

● Device Management
○ Communicates with devices like keyboards, disks, printers
○ Uses device drivers

● Security and User Management


○ User accounts and Authentication
○ Access Control
Core Functions of Operating System
Hardware vs Firmware vs Software: Comparative
Summary

Feature Hardware Firmware Software


Physical Yes No No
Stored in Physical components ROM / Flash Disk / SSD
User-modifiable No Rarely Yes
Runs at startup No Yes No
Examples CPU, RAM BIOS, Router firmware Python, MS Word
Recap
Arrange Software, Firmware, Programming, Hardware in bottom-up
perspective

Are firmware specific kind of hardware?

What are major components of CPU?


Assignment 1
• Submit a report on Computer System taking the bottom up
perspective and describing major components or important aspects
of each of them.
• Will Announce on Course Teams as well
• Due Date: January 18, 2026 5 PM
• Disclaimer: You can use all different resources for information but it
has to be fully written in your own words.
Other important components
Memory
• Memory stores data and instructions
• It allows the CPU to access program quickly
• Every program must be loaded into Memory before execution
• Memory is key part of the Input -> Process -> Output cycle
• Examples:
• RAM, ROM, Cache, Hard Disk, SSD
Units of Memory: Bits and Bytes
• Smallest unit of data is bit
• A bit can store either 0 or 1
• 8 bits = 1 byte
• A byte is the basic unit of storage

👉 Computers understand only 0s and 1s. Everything — text, images, videos — is


stored using bits and as a series of bytes
Larger Memory Units
• Memory measurement units
• 1 Byte (B) = 8 bits
• 1 Kilobyte (KB) = 1024 bytes
• 1 Megabyte (MB) = 1024 KB
• 1 Gigabyte (GB) = 1024 MB
• 1 Terabyte (TB) = 1024 GB
Types of Computer Memory
• Primary Memory
• RAM (volatile, temporary)
• ROM (non-volatile, permanent)
• Cache (very fast, small)
• Secondary Memory
• Hard Disk, SSD, Pen Drive
• Used for long-term storage

👉 The CPU cannot execute a program directly from disk — it must be in primary
memory

Where is Register? Aren’t they also memory?


Feature Registers Primary Memory (RAM)
Location Inside CPU Outside CPU
Size Very small Large
Speed Fastest Slower than registers
Programmer-visible No Indirectly yes
Used to store programs No Yes

“Primary memory stores programs.


👉
Registers store pieces of programs while they are being executed.”
From Computer Components to Programs
• Hardware provides physical capability
• Firmware initializes and controls hardware
• Software tells the computer what to do
• Programs are written to solve problems

How does a computer understand a program?


Programming Languages
• Languages have evolved through several generations
• Machine Language: binary instructions directly understood by hardware
• Assembly Language: symbolic representation of machine code
• High-level Language: easier to read and write
Features High Level Language Low Level Language

Hardware Knowledge Not required Required

Ease of Learning Easy to understand and learn Difficult to understand and learn

Performance Slow performance Faster than high level language

Examples C, C++, Python Machine Language, Assembly


Language
Translation Required Not required

Execution Slow Fast

Modification Easy Difficult

Hardware level proximity Not very supportive Supportive

Memory Usage More Less


Language Gap
• Programs written in high-level languages
• Computer understand only machine language (0s and 1s)
• There is a language gap between humans and machine

👉 Python code looks simple to us, but meaningless to the CPU


👉 Programs must be translated before execution
Language Translators
• System software that converts programs into machine language
• Enable communication between programmer and hardware

• Types of Translators
• Assembler
• Compiler
• Interpreter
Two Ways to Translate Programs
• Translate the entire program at once
• Translate line by line

• Two approaches lead to


• Compilers
• Interpreters
Compiler vs Interpreter – Basic Idea
• Compiler
• Translates the entire program at once
• Generates machine code before execution
• Execution happens after successful compilation

• Interpreter
• Translates and executes one line at a time
• No separate machine code file
• Translation and execution happen together
Compiler vs Interpreter

Compiler Interpreter • Compiler-based Execution


Translates whole • Source Code → Compiler →
Translates line by line
program
Machine Code → Exécution
Errors shown after
Errors shown line by line
compilation
Faster execution Slower execution • Interpreter-based Execution
Produces executable file No executable file • Source Code → Interpreter →
Example: Python, Execution (line by line)
Example: C, C++
JavaScript

👉 Compiler separates translation and execution


👉 Interpreter combines both
Advantages and Limitations of Compilers
• Advantages
• Faster execution
• Efficient use of hardware
• Suitable for large, performance – critical systems

• Limitations
• Longer development time
• Errors detected late
• Platform-dependent executables
Advantages and Limitations of Interpreters
• Advantages
• Easy debugging
• Platform Independence
• No separate compilation step
• Good for learning and scripting

• Limitations
• Slower execution
• Requires interpreter to run
• Less efficient for heavy computation
Why Python uses an Interpreter
• Easy to learn and use
• Immediate feedback on errors
• No compilation step needed
• Ideal for rapid development and experimentation

You might also like