Learn with LSGP

CS Core Subjects

Operating Systems, Databases, Computer Networks, Compiler Design, and Theory of Computation — explained visually, built deeply, by Learn with LSGP.

Operating Systems
DBMS
Computer Networks
Compiler Design
Theory of Computation

🎯

1. Why Core Subjects Matter

Every abstraction in modern software is built on top of a core CS subject. When your React app slows to a crawl, you debug it with knowledge of how browsers handle the JavaScript event loop — Operating Systems. When your SQL query takes 30 seconds, you fix it with knowledge of B-tree indexes — DBMS. When a packet drops during a video call, you understand why using knowledge of TCP congestion control — Computer Networks. Core subjects are not academic exercises. They are the conceptual infrastructure beneath every tool and framework you will ever use.

In India, core subjects are also the primary focus of GATE CS, university examinations, and technical interviews at product companies. A student who deeply understands OS scheduling, relational algebra, and finite automata can reason through unfamiliar problems from first principles — the most prized skill in any engineering interview. Learn with LSGP treats these five subjects as the foundation of everything else in the CS curriculum.

Interview Relevance

OS, DBMS, and Networks appear in every SDE interview at top product companies. TOC and compiler concepts appear at Google, Microsoft, and systems roles.

GATE Weightage

Together, these five subjects carry 50–60 marks out of 100 in GATE CS. Mastering them alone can secure a strong rank.

Real Engineering

Production debugging, database optimisation, network tuning, and compiler toolchains all require applied core CS knowledge.

First Principles

Core subjects teach you to reason from first principles — the skill that distinguishes senior engineers from juniors regardless of experience level.


⚙️

2. Operating Systems

An Operating System (OS) is the master program that manages all hardware and software resources on a computer. It acts as the middleman between your applications and the bare hardware — so when you write open("file.txt") in Python, it is the OS that actually talks to the disk controller. Understanding how an OS works transforms you from a developer who uses abstractions to an engineer who understands what lies beneath them.

🎬 Process State Diagram (Animated)

Process Lifecycle — State Transitions
🆕 New
admitted
→
📋 Ready
in queue
⇄
▶ Running
on CPU
→
✅ Terminated
exit
⏳ Waiting
I/O or event
Running → Waiting (I/O request)  |  Waiting → Ready (I/O complete)  |  Running → Ready (preemption)

CPU Scheduling — Gantt Chart (Animated)

The OS scheduler decides which process gets the CPU at any moment. Below is a Round Robin schedule (time quantum = 2) for four processes: P1(burst=4), P2(burst=3), P3(burst=5), P4(burst=2).

Round Robin Scheduling — Quantum = 2ms
P1
P2
P3
P4
P1
P2
P3
P3
P1 (4ms)
P2 (3ms)
P3 (5ms)
P4 (2ms)

Key OS Topics

Process Management

PCB structure, context switching, process vs thread, user threads vs kernel threads, fork() and exec().

Scheduling

FCFS, SJF, SRTF, Round Robin, Priority scheduling. Calculate waiting time, turnaround time, CPU utilisation.

Synchronisation

Race conditions, critical sections, semaphores, mutexes, monitors. Producer-consumer, readers-writers, dining philosophers.

Deadlock

Four conditions (mutual exclusion, hold & wait, no preemption, circular wait). Banker's algorithm. Detection & recovery.

Memory

Paging, segmentation, page tables, TLB, virtual memory, demand paging, page replacement (FIFO, LRU, Optimal).

File Systems

Inode structure, allocation methods (contiguous, linked, indexed), disk scheduling (SCAN, C-SCAN, SSTF).

📺 Recommended Video — Process Synchronisation

Process Synchronisation explained — Neso Academy (highly recommended for GATE OS)
💡 Learn with LSGP OS Strategy Solve GATE PYQs on OS numericals daily — scheduling Gantt charts, banker's algorithm runs, and page-fault counting with LRU/FIFO/Optimal. These questions have predictable patterns. 20 solved problems per algorithm will make them automatic.

🗄️

3. Database Management Systems (DBMS)

A Database Management System is software that manages organised collections of data, providing interfaces for storing, retrieving, and manipulating it reliably. Every application that stores data — banking apps, social networks, government portals, EdTech platforms like Learn with LSGP — uses a database. Understanding DBMS teaches you not just how to write SQL, but why relational databases are designed the way they are: to eliminate redundancy, maintain consistency, and support concurrent access at scale.

📊 ER Diagram — Student Enrolment Database

Student student_id (PK) name, email enrolled_date Enrols Course course_id (PK) title, duration level M N progress (%) M:N relationship resolved via Enrolment table with composite PK

Normalisation — 1NF to BCNF

Normal FormRuleViolation Example
1NFAll attributes are atomic; no repeating groupsStoring "Math, Science" in one cell
2NF1NF + no partial dependency on composite PKStudentName → StudentID in a table keyed (StudentID, CourseID)
3NF2NF + no transitive dependencyZipCode → City when PK is StudentID
BCNFEvery determinant is a candidate key (stricter than 3NF)Non-key attribute determining part of a candidate key

SQL — The Language of Relational Data

sql — common GATE-level query patterns
-- Find students enrolled in more than 2 courses
SELECT s.name, COUNT(e.course_id) AS total
FROM students s
JOIN enrolments e ON s.id = e.student_id
GROUP BY s.id, s.name
HAVING COUNT(e.course_id) > 2;

-- Find courses with no enrolments (left join pattern)
SELECT c.title
FROM courses c
LEFT JOIN enrolments e ON c.id = e.course_id
WHERE e.course_id IS NULL;

-- Relational algebra: π(name)(σ(level='beginner')(courses))
-- Same as: SELECT name FROM courses WHERE level = 'beginner';

📺 Recommended Video — Normalisation

Database Normalisation (1NF, 2NF, 3NF, BCNF) — Neso Academy
💡 Learn with LSGP DBMS Focus GATE DBMS questions concentrate heavily on functional dependency closure, finding candidate keys, checking normalisation, and transaction serializability. These are mechanical skills — practise them with PYQs until each type takes under 3 minutes.

🌐

4. Computer Networks

Computer Networks is the study of how data moves between computers — from the physical signals on a wire to the protocols that ensure your video call does not turn into garbled noise. Every piece of software you write that communicates with another machine, an API, a database, or the internet — uses the protocols and principles you study here. Understanding networks makes you a better backend developer, a better systems engineer, and a much more effective debugger of production issues.

🎬 OSI Model — Interactive Layer Stack

Hover over each layer to highlight it and see which protocols operate there.

7
Application
Data exchange between apps
HTTP, FTP, SMTP, DNS
6
Presentation
Encoding, encryption, compression
SSL/TLS, JPEG, ASCII
5
Session
Connection management
NetBIOS, RPC
4
Transport
End-to-end delivery, flow control
TCP, UDP
3
Network
Logical addressing, routing
IP, ICMP, OSPF
2
Data Link
Framing, MAC addressing, error detection
Ethernet, ARP, CRC
1
Physical
Bits on the wire
Wi-Fi, Fibre, Coax

TCP vs UDP

FeatureTCPUDP
ConnectionConnection-oriented (3-way handshake)Connectionless
ReliabilityGuaranteed delivery, ordering, retransmissionBest-effort, no guarantee
SpeedSlower (overhead for reliability)Faster (no overhead)
Use caseHTTP, email, file transfer, SSHDNS, video streaming, gaming, VoIP
Header size20–60 bytes8 bytes
Flow controlYes (sliding window)No

📺 Recommended Video — Subnetting

IP Subnetting from scratch — Practical Networking (clear, visual, essential for GATE)
💡 Learn with LSGP Networks Tip Subnetting and CIDR calculations are mandatory. You must be able to find the network address, broadcast address, and valid host range for any given IP/prefix in under 90 seconds. Sliding window protocol efficiency formulas (Go-Back-N vs Selective Repeat) and CRC error detection are the other consistently high-scoring topics.

🛠️

5. Compiler Design

A compiler translates source code written in a high-level language (like C or Java) into machine code that the CPU can execute. The process is not a single step — it is a pipeline of six distinct phases, each transforming the program into a progressively lower-level representation. Understanding compilers reveals what is happening when you write int x = a + b * 2; — how the compiler parses it, checks types, optimises it, and ultimately generates the machine instructions that run on your CPU.

📊 Compilation Pipeline — Flowchart

📄 Source Code
C / Java / Python
↓
🔤 Lexical Analysis
Source → Tokens (regex / DFA)
↓
🌳 Syntax Analysis
Tokens → Parse Tree (CFG / LL / LR)
↓
🔍 Semantic Analysis
Type checking, scope resolution
↓
📝 Intermediate Code
Three-address code / TAC
↓
⚡ Optimisation
Constant folding, loop unrolling, CSE
↓
💾 Code Generation
Machine code / assembly

Parsing — Top-Down vs Bottom-Up

LL(1) — Top-Down

Parses left-to-right, leftmost derivation. Uses First and Follow sets to build a predictive parsing table. No left recursion allowed. Used in recursive descent parsers.

LR — Bottom-Up

More powerful than LL. SLR(1) → LALR(1) → CLR(1) in increasing power. Uses shift-reduce parsing. LALR(1) is the most widely used — it's what yacc/bison generates.

📺 Recommended Video — LL(1) Parsing

LL(1) Parsing Table Construction — First & Follow Sets explained clearly

🤖

6. Theory of Computation

Theory of Computation (TOC) answers the most fundamental question in computer science: what can a computer compute, and what are its fundamental limits? This is not about the speed of your laptop or the size of your RAM — it is about what is theoretically computable at all, regardless of resources. TOC is the most abstract of the core subjects, but also the most intellectually beautiful. Its results — like the undecidability of the Halting Problem — are among the deepest theorems in all of mathematics.

📊 DFA — Accepts strings ending in '01'

q₀ q₁ q₂ start 0 1 1 0 0 1 Accepts: 01, 001, 101, 1001 ... Rejects: 10, 00, 1

The Chomsky Hierarchy

Regular DFA / NFA / RegEx Context-Free CFG / PDA Context-Sensitive LBA Recursively Enumerable Turing Machine
Every inner class is a strict subset of the outer one

Decidability — What Computers Cannot Do

ProblemDecidable?Why
Does DFA M accept string w?✅ YesSimulate M on w — always terminates
Is regular language L empty?✅ YesCheck if any state is reachable from start
Does CFG G generate any string?✅ YesCheck if start symbol can derive terminal strings
Halting Problem: Does TM M halt on input w?❌ NoProof by diagonalisation (Turing 1936)
Post Correspondence Problem❌ NoReduction from Halting Problem
Is TM M's language empty?❌ NoReduction from Halting Problem

📺 Recommended Video — Finite Automata

Introduction to Finite Automata — Neso Academy (excellent for building DFA intuition)
💡 Learn with LSGP TOC Advice TOC rewards systematic thinking over memorisation. Learn to construct DFAs and NFAs from scratch from a language description. Practise CFG design until you can produce grammars for common languages (a^n b^n, palindromes, balanced brackets) in 2 minutes. The pumping lemma proofs follow a template — practise it on 15 languages to internalise the structure.

📚

7. Study Strategy for Core Subjects

Core CS subjects are best studied in a specific order that builds on conceptual dependencies. Learn with LSGP recommends the sequence below for students targeting GATE, university examinations, or technical interviews simultaneously.

Recommended Study Sequence

Week 1–3 — Discrete Math & Digital Logic
Foundation for TOC, COA, and algorithm analysis. Complete first to remove bottlenecks later.
↓
Week 4–6 — Operating Systems
Heaviest weightage in GATE. Process management → scheduling → synchronisation → memory → file systems.
↓
Week 7–9 — DBMS
ER model → relational algebra → SQL → normalisation → transactions. Build a small database project.
↓
Week 10–12 — Computer Networks
Top-down through OSI layers. Subnetting daily. Sliding window protocols and CRC calculations.
↓
Week 13–14 — Theory of Computation
Regular languages → CFLs → Turing machines → decidability. Pumping lemma proofs with templates.
↓
Week 15–16 — Compiler Design
Lexical analysis → parsing (First/Follow/LL/LR) → semantic analysis → code generation. Relies on TOC.

Study Methods That Actually Work

Teach It Back

After studying a topic, close the book and explain it aloud as if teaching a peer. Gaps in your explanation reveal gaps in understanding.

Draw Before You Read

Before reading about OS paging or network encapsulation, try to draw the diagram from memory. The mismatch between your sketch and reality is where learning happens.

PYQ-First

After finishing each sub-topic, immediately solve GATE PYQs on it. Do not wait until the whole subject is done. Feedback should be immediate.

Error Log

Every wrong answer goes into a log with the correct concept and approach. Review the log every Sunday. This is how patterns get internalised.

Visual Notes

Draw process state diagrams, OSI stacks, compilation flowcharts, and ER diagrams by hand. Hand-drawn is better than reading — it forces active engagement.

Spaced Repetition

Revisit completed topics weekly using flashcards or quick formula reviews. Memory decays — scheduled review keeps it sharp without full re-study.

🚀 Learn with LSGP Practice Module Learn with LSGP's CS Core practice module includes topic-wise MCQ quizzes, animated concept explainers, timed GATE-pattern mock sections, and worked PYQ solutions for all five subjects. Use it alongside this guide to turn reading into retained knowledge. The diagrams and animations on this page are part of the same visual learning philosophy behind everything Learn with LSGP builds — because the best way to understand how a process transitions between states is to see it move.

← Back to Learn with LSGP