Computer Science Comprehensive Notes
Computer Science Comprehensive Notes
Notes
1. System Software & Application Software
System Software
System software is the backbone of the computer. It is the set of programs that manages and
controls the computer hardware and provides a platform for application software to run. It acts
as an interface between the hardware, the user, and the application software.
1. Operating Systems (OS): The core software that manages resources (Windows,
macOS, Linux).
2. Utility Software: Maintenance tools (Antivirus, Disk Defragmenter).
3. Device Drivers: Translators that allow the OS to talk to hardware.
4. Firmware: Permanent software programmed into read-only memory (BIOS).
Application Software
Application software is designed to help users perform specific, productive tasks. If System
Software is the "musician," Application Software is the "sheet music" being played.
1. General Purpose: Software capable of performing many different tasks (e.g., Word
Processors, Spreadsheets).
2. Special Purpose: Software designed for a single, specific task (e.g., Payroll systems,
Hotel booking systems).
3. Customized (Bespoke): Software tailor-made for a specific organization’s unique needs
(e.g., a missile guidance system for the military).
Malware
Malware (Malicious Software) is designed to damage, disrupt, or gain unauthorized access to a
computer.
● Viruses: Attach to clean files and replicate when the file is opened.
● Worms: Self-replicating programs that spread across networks without human action.
● Trojans: Disguised as legitimate software to trick users into installing them.
● Ransomware: Encrypts user data and demands payment for the decryption key.
Anti-Virus Software
Software designed to detect, prevent, and remove malware. It works in two main ways:
Disk Maintenance
● Disk Defragmenter:
○ The Problem: Over time, files get split up (fragmented) and saved in gaps all over
the hard drive.
○ The Solution: Defragmentation reorganizes these scattered parts so files are
stored in contiguous (side-by-side) blocks.
○ Benefit: Increases read/write speed because the read head doesn't have to move
as much.
○ Note: SSDs do not need defragmentation (it damages them).
● Disk Cleanup (The "Opposite"): While defrag organizes data, Disk Cleanup removes
unnecessary files (temporary internet files, trash, old updates) to free up storage space.
Back-Up Utilities
Backup software creates copies of important files to restore in case of data loss.
Screensavers
Historically, screensavers were a technical necessity. On old CRT (Cathode Ray Tube) and
early Plasma monitors, if an image stayed still for too long, the phosphors would physically burn
into the glass, leaving a permanent "ghost image" (known as burn-in).
● The Function: A screensaver is a program that fills the screen with moving images or
patterns when the computer is idle.
● Modern Use: Today’s LCD and LED monitors don't really suffer from burn-in.
Screensavers are now used for:
○ Security: Automatically locking the workstation so a password is required to
return.
○ Power Management: Though technically, "turning the screen off" is better for
power, screensavers can signal the PC to enter a low-power state.
○ Background Tasks: Some screensavers run virus scans or distributed
computing tasks (like searching for signals in space) while the user is away.
I. Memory Management
This is one of the most complex tasks of the OS. It manages the computer's primary memory
(RAM).
● Allocation: The OS decides exactly which block of RAM is assigned to which program.
When you open "Chrome," the OS finds free space and assigns it.
● Protection: It ensures that one program cannot access the memory of another program.
(e.g., A game cannot accidentally overwrite the memory used by your Word document).
● Virtual Memory: When RAM is full, the OS moves inactive data to the hard drive
(paging) to free up RAM for active tasks. This trick makes the computer feel like it has
more RAM than it actually does.
● Deallocation: When you close a program, the OS marks that memory space as "free"
so it can be used again.
● User Authentication: Verifies who is using the computer (Passwords, Biometrics like
Fingerprint/FaceID).
● Access Rights: Checks if the logged-in user has permission to open a specific file.
(e.g., A "Guest" user cannot open "Admin" folders).
● Encryption: Many modern OSs encrypt data on the disk so that if the hard drive is
stolen, the data cannot be read without the password.
● Firewall Services: Monitors incoming and outgoing network traffic to block unauthorized
access.
● Device Drivers: The OS uses drivers to translate commands into signals the hardware
understands.
● I/O Control: It manages inputs (Keyboard, Mouse) and outputs (Monitor, Printer).
● Interrupt Handling: The OS catches signals from hardware (like a mouse click) and
tells the CPU to process them immediately.
● How it works: You type a specific command (e.g., dir or ls), and the computer
executes it immediately.
● Advantages: It is text-based and much faster for experts who know the commands; it
also uses very little RAM/processing power.
● Disadvantages: It has a steep learning curve; you must memorize commands and
syntax, and one typo can cause an error.
● WIMP: This is the standard framework for a GUI, standing for Windows, Icons, Menus,
and Pointers.
○ Windows: Areas of the screen dedicated to different programs.
○ Icons: Small pictures representing files or apps.
○ Menus: Lists of options or commands.
○ Pointer: An on-screen symbol (arrow) that moves with your mouse to select
items.
● Advantages: Extremely intuitive and beginner-friendly; no need to memorize
commands.
● Disadvantages: Uses significantly more system resources (RAM/CPU) to render the
graphics.
3. Post-WIMP Interfaces
We are now moving beyond the mouse and keyboard. Post-WIMP refers to interfaces that use
more "natural" human actions.
1. Power On & BIOS/Firmware: When electricity hits the motherboard, the CPU looks at a
specific address in the ROM (specifically an EEPROM chip) to find the BIOS (Basic
Input Output System). BIOS is a type of firmware—permanent software programmed
into hardware.
2. POST (Power-On Self-Test): The BIOS runs a diagnostic test to ensure hardware like
RAM, the keyboard, and disk drives are connected and functioning.
3. CMOS Check: The BIOS consults the CMOS chip, which is powered by a small battery
to store system configuration settings (like the date, time, and boot order) even when the
PC is off.
4. The Bootstrap Loader: This is a small program within the BIOS. Its sole job is to locate
the Operating System on the hard drive (or SSD) and load the kernel into the RAM.
5. OS Takes Control: Once the kernel is in RAM, the OS takes over, initializes device
drivers, and presents the login screen.
6. Interrupts
What is an Interrupt?
An interrupt is a signal sent to the CPU telling it to stop its current task and attend to a more
urgent task.
How Interrupts Help Multitasking: Interrupts are the mechanism that allows the OS to switch
tasks efficiently. The system timer sends an interrupt every few milliseconds, forcing the CPU to
pause Program A and switch to Program B.
Comparison:
Translators
Software that converts source code into machine code.
1. Assembler:
○ Translates Assembly $\rightarrow$ Machine Code.
2. Compiler:
○ Translates the High-Level source code $\rightarrow$ Machine Code all at once.
○ Creates an executable file (.exe).
○ Pros: Fast execution (don't need to translate again), code is hidden from user.
○ Cons: Harder to debug (lists all errors at the end).
3. Interpreter:
○ Translates High-Level code $\rightarrow$ Machine Code line-by-line while
running.
○ Pros: Great for debugging (stops immediately at error), easy to test small parts.
○ Cons: Slower execution (translates every time you run it).
Code Editor
This is the specialized "Word Processor" for programmers. Unlike a standard text editor (like
Notepad), a Code Editor is "language-aware."
● Runtime Environment: This is a "sandbox" provided by the IDE that allows you to run
your program to see if it works without having to exit the IDE or install extra software.
● Debugger: This is the most powerful tool for a programmer. It allows you to:
○ Breakpoints: Tell the program to "freeze" at a specific line so you can see
what’s happening.
○ Variable Watch: Look inside the computer's "brain" to see exactly what value a
variable holds at that exact moment.
○ Stepping: Move through the code one single line at a time to find exactly where
it logic goes wrong.
Error Diagnostics
When your code fails, the IDE doesn't just say "it's broken." It provides a diagnostic report.
● Syntax Errors: It identifies "grammar" mistakes in the code (e.g., a missing colon).
● Logical/Runtime Errors: It points out why a program crashed (e.g., trying to divide by
zero).
● Underlining: Most modern IDEs use "wavy red lines" (like a spell-checker) to show
errors before you even try to run the code.
Auto-Documenter
In professional coding, you must explain what your code does (Comments). An Auto-
Documenter scans your code, looks for your comments, and automatically generates a
professional PDF or Website "Manual" for your software. It saves weeks of manual writing.
PrettyPrinting
This is the "makeup" for your code. If your code is messy (no spaces, bad indentation),
PrettyPrinting automatically reformats it.
● Indentation: It ensures all if statements and loops are tucked in properly so the
structure is visually clear.
● Spacing: It adds standard spacing around operators (e.g., changing x=5+y to x = 5 +
y).
Report Window
Types of System Software: The primary type is the Operating System (OS), followed by
Utility Programs (for maintenance), Library Programs (shared code), and Translators
(Compilers, Interpreters, Assemblers).
Application Software is "user-centric." These are programs designed to allow the end-user to
perform specific tasks, such as writing a report, editing a photo, or browsing the internet. It
interacts with the System Software to access the hardware.
● Anti-Virus Software: Scans files for "signatures" of known viruses and deletes or
isolates them.
● Heuristic Checking: A modern technique where the software looks for suspicious
behavior (e.g., a file trying to rewrite the BIOS) rather than just a known signature. This
catches new, unknown viruses.
● Quarantine: Moving a suspicious file to a secure, hidden area of the disk so it cannot
run or infect other files.
● False Positive/Negative: A False Positive is when a safe file is flagged as a virus. A
False Negative is when a real virus goes undetected.
Disk Defragmenter: On Hard Disk Drives (HDDs), files become "fragmented" (scattered across
different physical sectors). This utility rearranges the blocks of data so that files are stored in
contiguous sectors, reducing the movement of the read/write head and speeding up the system.
● Disk Formatting: (The "opposite" logic). This prepares a disk for use by creating a file
system but wipes all existing data.
Back-Up Software: Creates copies of data so it can be restored if the original is lost.
Screensavers: Originally used to prevent "phosphor burn-in" on CRT monitors. In modern CS,
they are mostly used for security (locking the session) or aesthetic energy-saving.
3. Device Drivers & Descriptors
Device Drivers: Every piece of hardware (printer, GPU, mouse) needs a driver. It is a piece of
system software that acts as a translator between the OS and the hardware. Because the OS
doesn't know the specific internal commands of every printer ever made, the driver provides
those specific instructions.
User Interfaces:
● HCI (Human-Computer Interaction): The broad study of how humans talk to machines.
● CLI (Command Line Interface): Users type text commands. It uses very little memory
and is fast for experts but hard for beginners to learn.
● GUI (Graphical User Interface): Uses visual elements.
○ WIMP: Windows, Icons, Menus, Pointers. Standard for desktops.
○ Post-WIMP: Interfaces for touchscreens/VR, using haptics, swiping, and
pinching instead of a mouse.
1. Memory Management: Assigns data to specific RAM addresses and prevents programs
from overwriting each other.
2. Security Management: Handles logins, passwords, and file permissions.
3. Hardware/Peripheral Management: Uses drivers to talk to devices and manages
Buffers (temporary storage areas that allow slow devices like printers to keep up with
fast CPUs).
4. File Management: Creates the folder structure and manages the naming, moving, and
deleting of files.
5. Multitasking: A CPU with one core can technically only do one thing at a time.
However, the OS switches between tasks so quickly (millions of times per second) that it
creates the illusion of simultaneous execution.
6. User Account Management: Manages different users. The Administrator has
"elevated privileges" to change system settings that a standard user cannot.
5. Starting up the Computer (The Boot Process)
1. Power On: The CPU sends a signal to the BIOS (Basic Input/Output System) stored on
the ROM (specifically an EEPROM chip).
2. POST: The BIOS runs a Power-On Self-Test to check hardware.
3. CMOS: The BIOS checks the CMOS Chip for settings (like boot order and system time).
4. Bootstrap Loader: The BIOS runs a small program called the Bootstrap Loader,
which locates the OS on the hard drive.
5. Firmware: This is the permanent software (like BIOS) programmed into a hardware
device.
6. Load to RAM: The OS is moved from the storage drive into RAM, and the computer is
ready.
How it works:
1. An interrupt is caused (e.g., printer is out of paper, or a "Divide by Zero" error in code).
2. The CPU finishes its current Fetch-Execute cycle.
3. It checks the Interrupt Priority.
4. If it needs to be serviced, the CPU saves its current state (the contents of the Program
Counter and other registers are pushed to a "Stack").
5. The CPU loads the ISR (Interrupt Service Routine), which is a specific program that
handles that specific interrupt.
6. Once finished, the CPU "pops" the saved values back into the registers and resumes
exactly where it left off. How it helps Multitasking: Interrupts allow the CPU to stop a
task to handle a more urgent one, or to switch between programs efficiently.
Translators:
It converts the entire program to executable object code if the entire program is Error-free Code.
However, if there are errors in the program the compiler highlights them at the end of the execution
of the entire program, and then the errors must be removed for successful compilation of source
code.
It converts the source program to object code (combination of binary numbers) which can be stored
and we can run it each time we need to execute the program. Therefore, it eliminates recompilation.
At the same time, due to the generation of the intermediate file, it takes up a lot of memory as
compared to other language processors. Compilation as a whole process is done in the following
phases - lexical analyzer, semantic analyzer, syntax analyzer, intermediate code generator, code
optimizer, symbol table, and error handling.
Advantages of Compiler
● It produces an executable file that can run without the need for source code.
● It is relatively faster than other language processors.
● Using a compiler is more secure because the actual source program can be hidden which
makes it private and secure.
● The machine code of the executable file is native to the machine which makes the compiler
well optimized.
Disadvantages of Compiler
● Debugging (removing errors) is relatively tough.
● It requires a lot of memory for producing an Object File.
● The source code needs to be recompiled every time there is a change in the code.
● After the removal of errors in our code, it needs to be recompiled.
It was the first interface through which communication between machines and humans became
possible.
Assembler works in two different phases over the given input-first phase and second phase.
Advantages of Assembler
● It is a very fast translating system software.
● It is as efficient as the machine language.
● Developing assemblers for translating is easier as compared to compiler and interpreter.
● Assemblers are used in computer forensics, brute force hacking, etc. where it is important to
determine exactly what is going on.
Disadvantages of Assembler
● Lower-level machine language is difficult to understand and code.
● It changes with the architecture of machines.
● It is difficult to debug.
● We have to write different assembly codes for 8-bit, 16-bit, 32-bit, and 64-bit machines which
is a tedious task and difficult to maintain.
It converts source programs written in High-Level Programming language into machine code line by
line, which means it executes one single line at a time into machine language.
If there is an error in the program the interpreter terminates its translation process and proceeds for
execution only when the error is removed. This process continues till the interpreter reaches the end
of the program.
In the case of an interpreter, each line is converted and executed simultaneously. As a result, it
requires less memory space as compared to the compiler.
Advantages of Interpreter
● It is easy to find and debug errors from the code/source program.
● As there is no Intermediate object Code, there is less memory consumption.
● Interpreters give execution control to programmers as they can see their code running line
by line.
● It can be easily used between different platforms.
● An interpreter is good for fast debugging.
Disadvantages of Interpreter
● It takes time to convert and execute the instructions line by line.
● It is not good for large programs.
● It is less secure for privacy because we need to share the actual program.
● To run the code on another machine, it is required that the interpreter be installed on the
machine.
Compiler converts
program written in a The assembler converts
Definition high-level language assembly code into
to machine-level machine code.
language.
Debugging is easy in
Debugging is tough as
Debugging the case of the
compared to the compiler.
compiler.
Examples of compilers
Examples of assemblers are
Examples are Clang, GCC,
GNU, GAS, etc.
javac, etc.
Compiler vs Interpreter
Interpreter
Criteria Compiler
It translates a High-Level It translates a High-Level language
Translation language into machine into machine code line by line.
code at once.
Requirement
of A translator Program is
A translator Program is not
Translato required each time for
required for execution.
r execution.
Program
Object File It creates and stores an object It does not create an object
Creation file. program.
● Compilers translate and execute the code faster than assemblers and interpreters.
● The compiler converts the code into an Object file which can be used whenever we need to
execute the program, therefore it eliminates the need to re-compile.
● All the errors are found and displayed together at the end.
Summing Up
All three of the language processors are used to convert programming languages into equivalent
machine code. Compilers and interpreters convert High-Level languages whereas an Assembler is
used to convert Low-Level language.
Find out the difference between high-level and low-level programming languages here.
Nowadays, most of the languages like Java and C++ are converted using a compiler whereas
Python uses an interpreter. The use of an assembler is very rare and it is mostly only used by
computer experts and hackers.