Skip to main content
Systems Programming

Introduction to Systems Programming

Published: 2026-08-20
Level: postgraduate
Audience: Postgraduate students in Systems Programming

This lecture opens the Systems Programming course as its foundation stone. It maps the six interlinked modules, explains how evaluation ties to lab work, revisits what a computer really does at the hardware and software boundary, introduces the translator chain that turns human text into running processes, surveys Unix and Linux history and strengths, establishes the file as the universal abstraction, demystifies the shell and commands, walks through the live cloud lab and SSH bastion workflow, and finally puts your hands on the first commands with verification rituals you will reuse all semester.

Every later lecture — file system internals, VI, filters, shell scripting, system calls, assembler/linker/loader — builds on the mental model you form here, so treat this preamble as the index you will keep returning to.

1.1 Course Roadmap — Six Interlinked Modules, Objectives and Learning Outcomes

1.1.1 Foundational Position of the Course

This course acts as a very basic, foundational course for any other course on the system side. Network programming, cloud computing and edge computing all assume comfort with the underlying system. The ability to run commands, combine them into scripts and understand how system applications actually work under the hood is the common base. The focus is on what goes on inside the system rather than on surface-level use. By the end, you can work on a Linux system with confidence and you can combine multiple tasks into one automated workflow.

Hook — why start here? Imagine you are asked to deploy a web service on a fresh virtual machine tomorrow. You can write application code, but the machine asks you to create users, set permissions, inspect logs with filters, automate restarts, and trace a failing system call — all before your code ever runs. Without systems fluency, you are blocked at the door. This course gives you the keys.

Intuition + Analogy — foundation of a building. Think of systems programming as the foundation and plumbing of a building, written as an analogy. The network, cloud, and edge courses are the upper floors — beautiful, but they collapse without a level foundation. Foundation (the six modules) maps to load-bearing walls, plumbing maps to pipes that carry data, wiring maps to the control that keeps circuits from shorting. Where the analogy breaks: unlike a static foundation, systems knowledge is active — you will keep remodeling it as kernels, tools, and hardware evolve.

The professor framed the goal in one plain line: by the end you will do two things comfortably — work on a Linux system without hesitation, and combine multiple tasks into one automated workflow. That second ability is exactly what industry calls automation, and it is the thread that ties all six modules together.

Visual intuition: picture a horizontal spine with six blocks left to right, each block feeding the next. Block 1 (basics and organization) shows a filing cabinet; Block 2 (inode internals) zooms into a single drawer mechanism; Block 3 (VI/filters) shows scissors and pipes joining cabinet contents; Block 4 (shell scripting) shows a factory assembly line combining previous tools; Block 5 (system calls/processes) shows a C program knocking on a kernel door; Block 6 (assembler/linker/loader) shows that door opening into RAM execution. The takeaway: you move from what you see (files) to how it works inside (inodes, processes, loaders).

Recap + Bridge: The course is deliberately systems-first, surface-second — understand what goes on inside before automating it. With that promise clear, the next section details the six stations of that journey in order, so you can see how each hands off to the next.

1.1.2 The Six Modules in Order

There are six modules that are linked to one another and each plays an important role:

Module 1 — Linux basics and the file system. How directories and files are placed, the overall file system as a whole, and the various basic Unix commands for files and directories. This gives insight into organization and into the different command families that exist.

Module 2 — Internals of the Unix file system. How the i-node is actually done in Unix, how information is stored and how a file is accessed. This explains what the file system does when you create a file or a directory.

Module 3 — The VI editor, files, directories and filters. The VI editor, the different commands, the modes it works in, plus commands for files and directories and the different filters that can be employed.

Module 4 — Shell scripting. The most important module among all. Shell scripting combines many commands together with programming constructs to form a unique activity or a specific task. Your assignment is mostly on shell scripting. This module brings together commands and constructs such as for loops, while loops and if statements to build scripts that group multiple tasks into one.

Module 5 — System calls and processes. What a system call is, what its purpose is, how to create a process, what a process is, how it looks different from any other process, and how system calls work when used from a simple C program. The examples are kept very simple — often a single file with a few system calls — so attention stays on what goes on inside the program rather than on elaborate C construction. No need to create multiple functions or complex program structure for these demonstrations.

Module 6 — Assembler, linker and loader. Why these three different system software programs are important, how an assembler works on code, how linkers and loaders are built, what different steps are involved in building them, and how they work in practice. Assemblers are often combined with interpreters and with compilers. You do not need to become an assembly language programmer to understand this, but you do need to understand how an assembler translates assembly language. Linkers and loaders on the other hand have direct impact on execution because they interact with the brain of the system — the operating system — to change a program from state program to state process.

Formalizing the flow — what each module teaches you to do:

  • Module 1 — Observe and organize. You learn where things live (, , , ) and how to move them (, , , ). Output: you can navigate and inventory any Unix system.
  • Module 2 — Explain the mechanism. You learn the inode — the system's internal record that stores metadata and block pointers — so ls -i and stat stop being magic. Output: you can predict what mkdir and creat do on disk.
  • Module 3 — Edit and transform streams. You learn VI modes (command vs insert) and filters (like , , ) that select, substitute, and report on byte streams. Output: you can reshape text without manual editing.
  • Module 4 — Automate. You learn to compose Modules 1–3 with loops and conditionals into a script that is a repeatable task. Output: one script replaces a thousand hand-typed commands.
  • Module 5 — Cross the kernel boundary. You learn system calls (e.g., , , ) as the controlled doorway from user program to kernel service. Output: you can create and observe processes from a tiny C program.
  • Module 6 — Reach execution. You learn how assembler (mnemonic → opcode), linker (resolve symbols across object files), and loader (place image in memory, hand control to OS) together promote a file from program (bytes on disk) to process (bytes executing in RAM).

Worked Example — Thousand users from a text file (the motivating automation)

Setup: You are a system admin. A file users.txt holds one line per new employee — fields include username, initial password, group, home path, and login shell. Doing this by hand would mean running a thousand times and clicking through prompts.

Script sketch (kept deliberately simple, as in lecture):

# users.txt:  alice:pass123:1001:1001:developers:/home/alice:/bin/bash  (one per line)
while IFS=: read -r user pass uid gid grp home shell; do
    echo "Creating \$user ..."
    sudo adduser --uid "\$uid" --gid "\$gid" --home "\$home" --shell "\$shell" "\$user"
    echo "\$user:\$pass" | sudo chpasswd
    sudo usermod -aG "\$grp" "\$user"
done < users.txt

Trace for one line (alice): shell reads line → splits on : → calls adduser which creates group alice, adds user to group, creates /home/alice, copies skeleton files → sets password via chpasswd → adds to developers.

Scale reasoning: At 30 seconds per hand-made user, 1000 users ≈ 8.3 hours of unbroken typing. The script does it in under a minute, identically and auditably. Sense-check: if the input file has exactly 1000 lines and each iteration succeeds, you end with 1000 new entries in /etc/passwd and 1000 new directories under /home — verifiable with wc -l /etc/passwd and ls /home | wc -l.

Exam link: This is not theory — your lab assignment will require you to write a script of exactly this character, and evaluators will check that you did not hand-edit your way to the result.

Worked Example — OpenStack single-script install (infrastructure as a script)

Context: OpenStack — an open-source cloud infrastructure — can be installed on a single laptop or bare metal if resources suffice. The professor used it as the opposite of the thousand-user example: not many similar tasks, but many different system activities that must happen in the right order.

What the single script does (conceptual steps): check OS prerequisites → install dependencies (database, message queue, hypervisor hooks) → configure networking → initialize services → start daemons → verify.

Why it matters: The user runs one command; behind it, the script issues dozens of apt, mkdir, chown, systemctl, and config-file edits. OpenStack itself is not the point — the pattern is: shell scripting turns a brittle manual checklist into a repeatable artifact.

Comparison point (professor's aside): Tools like Ansible and Chef also build infrastructure declaratively. For this course, you are not asked to compare — only to see that shell scripting already does its job beautifully for the scale you will face, and that heavier tools rest on the same underlying commands.

Assumptions & Scope — when this roadmap applies

  • Scope: This roadmap assumes a Unix-like system (Ubuntu/CentOS in your lab) with a Bourne-family shell, standard file hierarchy, and permission to run for admin tasks. On a locked-down or non-Unix system, commands and paths differ.
  • Assumption — incremental mastery: Module 4 assumes you have practiced Modules 1–3 enough that ls, grep, and VI do not consume your cognitive budget — you are composing, not learning, them.
  • Assumption — simple C for Module 5: You need only basic C (variables, , function call) — not data structures or pointers beyond what a one-file system-call demo uses.
  • What breaks if violated: Jumping to shell scripting before you can navigate the file system leads to scripts that create files in the wrong place and fail silently; jumping to system calls before you understand processes leads to confusion between program and process.

Pitfalls

  • Collecting commands without composing them. Knowing 50 commands but never combining them into a script leaves you a typist, not an automator. Practice the combine step from day one.
  • Needing to become an assembly programmer. You do not. The lecturer explicitly said you will understand how an assembler works, not write large assembly programs. Do not spend weeks hand-coding 8085 assembly at the expense of scripting.
  • Confusing linker/loader with compiler/assembler. Compiler/assembler translate language; linker/loader make that translation runnable under OS control. Mixing these roles causes you to misdiagnose "why does my program not run?"

Recap: Modules 1–3 give you eyes and hands on the file system; Module 4 gives you automation; Modules 5–6 give you the kernel and hardware boundary. The linkage is the point — each module's output is the next module's input. Bridge: with the journey clear, the next section tells you which books to carry and how to read them efficiently.

1.1.3 Objectives Framed as Capabilities

First, understand the file system, the directories and the files under the file system as a whole, including how they are organized and how that organization creates the need for a file system. Then gain insight into the different types of commands that exist and how you can come up with scripts which combine multiple commands to form a specific task. Next, understand the purpose of system calls and how they behave when driven from C. Finally, understand assemblers, linkers and loaders, what they do and why linkers and loaders are required to help a program execute.

In capability language:

  1. Explain organization — why must exist, why , , , , are separated, and what breaks when you mix them.
  2. Combine commands into tasks — select the right filter or file command for each sub-step and wire them with pipes, loops, and tests.
  3. Drive the kernel from C — issue a system call and observe the process that results, describing its state and identity.
  4. Account for translation to execution — narrate the path text → object file → linked image → loaded process, naming who does each step.

These four verbs — explain, combine, drive, account — are what examiners will ask you to demonstrate, not just define.

1.1.4 Learning Outcomes — What You Can Do Later

Six months or a year after finishing, you will have a good understanding of all Unix commands, the shell, processes and other required commands. You will be able to write shell scripts — not just simple ones but good scripts — because your assignment will force you to understand and to write. You will understand the Unix file system, the way it stores information and how information is accessed from a file. You will understand the shape a process takes while it is running and the working of the assembler, linker and loader.

Think of this as durability: the lecture promised outcomes that survive six to twelve months because they are practiced, not memorized.

  • File system durability: you can stat a file, read its inode number, and explain which blocks hold its data — not just say "it is stored somewhere."
  • Scripting durability: you can write a good script — with argument handling, error checks, and comments — not just a one-liner that works once.
  • Process durability: you can draw the process image (code, data, stack, heap) and point to where the loader placed each piece.
  • Translator durability: you can state, for any given build, which step would fail if a symbol were undefined and whether the fix belongs in assembler, linker, or loader.

Q & A — Do you need to recall every C construct from an undergraduate degree?

Q: Does the course require remembering every C construct from an undergraduate degree?

A: No. Most learners have done C in their graduate days but the constructs used here are very simple. The weight is on what goes on inside the program — which system call runs, what the kernel does, how the process looks — not on how to construct elaborate C programs. A simple C program with certain system calls is enough to see how the calls work. Several students worry about this, so the reassurance was explicit: keep C minimal, keep observation maximal.

Exam note: When a question asks about objectives or outcomes, answer with capabilities (understand file system, combine commands into scripts, drive system calls from C, explain assembler/linker/loader), not with vague "learn Unix." Cite the thousand-user and OpenStack examples as evidence that shell scripting is the integrative skill that will be evaluated practically. Connections: 1.3 (assignment is where scripting competence is graded) → 1.10–1.11 (lab where you practice it).

1.2 Textbooks, References and How to Use Them

1.2.1 Core Textbooks

Three core books are used:

Kernighan and Ritchie — C programming language classic. For a first-time user it looks a little tricky, but it gives a lot of information about the Unix environment. It is a wonderful book for the early Unix perspective.

Sumitabha Das, Unix Concepts and Applications — Wonderful coverage in depth and in breadth. It covers a lot of things and is a strong main reference for Unix concepts.

Richard Blum and Christine Bresnahan, Linux Command Line and Shell Scripting Bible — A good book to understand the command line and shell scripting. Useful when you want practical command and scripting detail.

You can buy hard copies and build a small library, or use legally obtained ebooks. PDF versions are said to be available for free from various sites, but for academic purposes the recommendation is to use a hard copy or a legally obtained ebook. Ebooks are an option and add to the books you already have.

What each core book gives you — and when to open it:

  • **Kernighan and Ritchie (K&R) — the Unix lens on C.** Do not read it as a C syntax drill. Read it for the early Unix viewpoint: how C was shaped to let Thompson and Ritchie rewrite Unix in a portable high-level language, how file descriptors and byte streams are treated, and why "a file is a sequence of bytes" became a design axiom. Best for: Modules 5 (system calls) and the historical arc in 1.6.
  • **Sumitabha Das, Unix Concepts and Applications — the backbone reference.* Das is the broadest: file system, permissions, inodes, filters, shell programming, and process control in one place, with many worked examples you can run verbatim. Treat it as your first lookup* whenever a lecture term feels thin. Best for: every module, but especially 1–4.
  • **Blum and Bresnahan, Linux Command Line and Shell Scripting Bible — the scripting workbench.** This is the most hands-on for command-line practice: Bash specifics, structured commands (, , ), input handling, and script debugging. Best for: Module 4 and the lab sessions (1.10–1.11).

Together they cover why (K&R), what broadly (Das), and how hands-on (Blum/Bresnahan). Buying a hard copy is recommended so you can annotate and return to the same pages across months — the skill you are building is durable, so your marginal notes should be too.

Intuition — library, not single textbook. Think of the three books as a small library, not a single textbook. A library lets you cross-check: if K&R says "C was invented to write Unix," Das shows how that C lets you call the kernel, and Blum shows how you automate those calls in a script. No single book carries all three angles at the right depth. Use all three, at different times.

Pitfall — chasing free PDFs without verification. PDF versions are said to be available free on various sites, but the lecture's academic advice is clear: use a hard copy or a legally obtained ebook. Beyond policy, the practical risk of random PDFs is version mismatch — the page numbers, exercise numbers, and even chapter titles drift across editions, so a peer reference like "Das Chapter 9" no longer points to the same content. Build your library deliberately and note edition numbers in your notes.

1.2.2 Broader Reference List

A long list of reference books is provided in the handout. You do not need all of them. At least the book that covers system software is valuable when you reach the last module, because the linker and loader are discussed there. The handout also describes what it consists of — syllabus, evaluation components and activities.

The handout is itself an important companion document: it contains the syllabus topic list, the evaluation split (EC1/EC2/EC3), and the activity plan. Treat the long reference list inside it as a menu, not a mandate. Your selection rule is simple:

  • Before Module 3: Das + Blum for commands, filters, VI.
  • Module 5 onward: add a systems-programming or advanced Unix reference that treats processes and system calls precisely (e.g., the APUE-style family represented in companion docs R5/R6).
  • Module 6: add a system software book that treats assembler, linker, and loader as distinct build steps with diagrams — this is the one the professor explicitly said "at least get."

You do not need to buy all. A focused shelf of 4–5 books you actually annotate beats a shelf of 20 you never open.

1.2.3 Suggested Study Approach

Go breadth-first for the overview, then depth-first for shell scripting and file system internals. When a textbook chapter is mentioned, read it in full. For system software, read the compiler, assembler, linker and loader sections with attention to steps and rationale. Use man pages and trial on the live system to test each command as you learn it.

Breadth-first, then depth-first — what it means in practice:

  1. Breadth-first pass (this lecture's job). Skim all six modules at once to see the whole pipeline: file → inode → filter → script → system call → load-and-run. Do not get stuck proving every inode pointer; just know it exists and why it matters.
  2. Depth-first drills (after breadth). Return and dig where marks and skills cluster: shell scripting (your assignment) and file system internals (where many viva questions come from). Here you read a chapter in full, run every example, and reproduce it without looking.
  3. Man + machine verification. For every command taught (, , , , , later , ), run man <command> and then try it live with two variants (with and without an option). The live system is the final textbook.

Visual intuition: imagine a map of a city. Breadth-first is flying over it to see all neighborhoods; depth-first is walking two neighborhoods street by street because you will need to give directions there under exam pressure. Both are needed, but breadth must come first or you memorize streets without knowing which neighborhood they belong to.

Assumptions & Scope

  • Scope: This advice assumes you follow along with the recorded content ("flip mode") and the live lab. Skipping the lab and reading only PDFs leaves you unable to verify commands — you will recall definitions but fail on "show the output of ls /home after sudo adduser ABC."
  • Assumption: man pages on the lab match the lecture's system. If a flag like cal -m behaves differently on your local distro, trust the lab for exam answers and note the local variant separately.

Recap + Bridge: Three core books cover perspective (K&R), breadth (Das), and practice (Blum/Bresnahan); the handout's long list is selective, with the system-software book reserved for Module 6; breadth-first overview then depth-first drill with man pages is the study rhythm. Bridge: evaluation is what turns that rhythm into marks — next we formalize EC1/EC2/EC3 and the integrity rules around them.

1.3 Evaluation Architecture and Assignment Integrity

1.3.1 Component Weights and Syllabus Coverage

Evaluation is split into EC1, EC2 and EC3. Exam note: EC1 consists of quiz and assignment. Quiz one plus quiz two plus assignment put together is on the higher side when compared with EC2, which is the midterm exam. Exam note: EC1 weight covers quizzes and the lab assignment. Exam note: EC2 is the midterm, 30 marks, open book, conducted online, covering topics up to that point. Exam note: EC3 is the end semester exam, 40 percent, open book, conducted online, covering all topics in all modules. EC3 therefore is the full syllabus for the final open-book exam.

Formalizing EC1 / EC2 / EC3 — what counts and when:

  • EC1 — continuous lab-aligned assessment (higher weight than EC2 alone). Composition: Quiz 1 + Quiz 2 + Assignment (lab component). It rewards steady work, not one lucky night. The assignment portion is 20% on its own (see 1.3.3) and is tied to the lab exercises of every contact session (10–11 sessions).
  • EC2 — midterm, 30 marks, open book, online. Coverage: topics up to the midterm point (roughly Modules 1–3 plus early scripting, depending on calendar). Because it is open book, questions tilt from "recall" to "apply and trace" — you will be asked to predict outputs and fix scripts, not just define terms.
  • EC3 — end semester, 40%, open book, online. Coverage: every topic in every module (full syllabus). Every concept in this lecture is therefore EC3-relevant, even if it was already quizzed earlier.

A quick arithmetic check many learners want to do: EC1 > EC2 alone, but EC3 (40%) is the single largest block, so finishing strong matters more than starting strong. Plan effort accordingly.

Intuition — three checkpoints, not one gamble. Think of EC1 as weekly mileage, EC2 as a halftime scrimmage, EC3 as the full match. You cannot win the match by skipping mileage, and you cannot recover the whole match by cramming the final night. Open book does not mean open understanding — it means the paper will assume you have the book and will ask what you can do with it.

Assumptions & Scope

  • Scope: Percentages and marks stated (assignment 20%, EC2 30 marks, EC3 40%) are as announced in this lecture; the final handout confirms specifics if the calendar shifts. Always match your study plan to the latest handout, not to memory alone.
  • Assumption: "Open book, online" assumes stable connectivity and access to your notes/books during the window — prepare a searchable local copy, not a stack you have never indexed.
  • What breaks: Treating EC1 as optional because it is "just quizzes" forfeits the highest leverage — EC1 rewards the same lab work that makes EC3 answerable.

1.3.2 Quizzes — Format and Window

Exam note: Expect multiple choice questions for quiz one and quiz two. Each quiz is online with a specific time window within which you must complete it. The quiz stays open for at least two to three days, maximum three days. Within that window, once you start the quiz you must finish it in one attempt in the allowed time. There are no multiple attempts. Dates and times for quiz one, quiz two and assignment will be announced well in advance. This window is intentionally bigger than a narrow slot like 9:00 to 9:30 at night.

Worked Example — planning your quiz window

Window: Suppose Quiz 1 is announced as open Tuesday 6 pm to Friday 6 pm (3-day window).

  • Wrong plan: wait until Friday 5:50 pm, hit start, get interrupted, hope for a retake — there is none.
  • Right plan: pick a clean 60–90 minute block on Wednesday where you have power backup and notes ready. Start once, finish in that sitting, submit. If a doubt arises, use remaining days only to prepare, not to expect a second attempt.

Sense-check: The window is intentionally larger than a 30-minute narrow slot (e.g., 9:00–9:30 pm) exactly so working professionals can choose a slot. The trade-off is discipline: a wide window demands you self-schedule early, not late.

Pitfalls

  • Assuming multiple attempts. There are none. Starting consumes your attempt — previewing questions, closing, and returning does not reset the timer.
  • Confusing window with duration. Window = 2–3 days the quiz is available. Duration = the single timed attempt once you click start. You control the former; the system controls the latter.
  • Last-minute network surprises. Because quizzes are online, a last-hour start with unstable internet risks an incomplete submission. Treat the first half of the window as your deadline.

1.3.3 Assignment — Scope and Presentation

Exam note: Assignment is for 20 percent and directly maps to the lab component that runs across the ten or eleven contact sessions. Every contact session includes some lab component, and the set of exercises there becomes the assignment. The assignment task is of a somewhat complex nature, similar to the lab exercises, because there is much to gain. Exam note: Assignment will be a group assignment of two or three members. Groups are formed by you. Very soon the group size will be confirmed. After submission you cannot just submit and forget. You must complete the task and do a presentation of your solution.

Real-world: Assignment is where shell scripting competence is built. The assignment will make you understand scripts, write scripts and move beyond simple one-liners to good scripts that combine many commands and program logic.

What "somewhat complex" means for the assignment:

  • Not a one-liner. Expect a script that reads files, loops, branches, handles errors, sets permissions, and produces verifiable output — essentially the thousand-user pattern plus filters and file operations, extended to a realistic task.
  • Lab = rehearsal, assignment = performance. If you do the lab exercise each session (e.g., create users, inspect /etc/passwd, chain cat and who), the assignment is a composition of those same moves, not a surprise topic.
  • Group of 2–3, plus presentation. Groups are self-formed, size to be confirmed shortly. Presentation means you must defend your script: why you chose while read over for, how you tested, what failed. Submitting without understanding will fail at presentation even if the script runs.

Assumptions & Scope

  • Scope: Assignment maps to lab component across all contact sessions, so missing labs creates a gap that the assignment will directly expose.
  • Assumption: Group members contribute comparably. The evaluation anticipates peer accountability at presentation — a free rider who cannot walk through the code will be visible.

1.3.4 Academic Integrity, Originality and Deadlines

Just changing a color or a tiny detail does not make code different. Underlying code can still be identical. Copycats will be caught and will be punished. If copying is found, you receive zero marks. Originality is required. Being found guilty leads to penalty.

Exam note: Do not miss deadlines when they are given. When asked to submit on a specific deadline, you need to submit on that deadline. Enough time will be given to complete assignments, but not too much time — just enough to submit in a timely fashion. As working professionals you have busy days and free days. Since you chose this program, give it the time it needs and complete the required formative work with the same intention with which you joined.

Why "just change a color" fails — and how integrity is actually checked

  • Surface vs structure. Changing terminal colors, variable names like , or comment wording does not change control flow, command sequence, and file handling logic. Plagiarism detection looks at structure (e.g., same loop nesting, same if conditions, same error handling gaps), not at cosmetics.
  • Penalty is binary: found copying → zero marks for that component, plus further disciplinary consequence. "We changed a little" is not a defense.
  • Deadline discipline: Deadlines will be announced well in advance; once set, they are firm. Enough time is given, but not slack time — plan around work commitments early. As the professor put it: you chose the program with intention, so schedule with that same intention.

Practical originality habit: write together, test together, but each group writes its own script from its own outline. If two groups' scripts are line-for-line identical except for colors, evaluators treat that as copy, not coincidence.

1.3.5 Contact, Help and Calendar

If you have questions, difficulties or need clarifications, post in the discussion forum rather than writing directly. The forum reaches a wider audience and peer participation is encouraged because a few learners already have working knowledge of Linux and Unix and can share experience. Group learning over discussion forums is encouraged. The course runs in flip mode and you already have access to recorded content. The calendar in the team system had shown classes even on Sundays and on exam days where no contact session was scheduled. That is being rectified and a proper schedule that maps only days with contact sessions will appear. This first contact session is one of nine or ten planned contact sessions.

Q & A — Will quiz dates be visible only at the last minute?

Q: Will quiz dates be visible only at the last minute?

A: Dates and times for quizzes and assignments are announced well in advance. The quiz is open for two to three days so you can pick a slot that fits. Once started, you complete it in one sitting. Several students asked this same timing question, so the professor repeated the assurance: the window is generous, but the single-attempt rule is strict. Plan by the announcement, not by the deadline.

Recap — EC1 rewards steadiness, integrity is non-negotiable, help is public: Treat EC1 (quizzes + lab assignment) as your highest-leverage daily work; never test integrity with cosmetic changes — zero is the stated penalty; post doubts to the forum so peers and instructors benefit together.

Exam note: For any "describe evaluation" question, structure your answer: components (EC1 quizzes+assignment > EC2 alone, EC2 30 marks open book, EC3 40% full syllabus) → quiz mechanics (MCQ, 2–3 day window, one timed attempt, no retake) → assignment (20%, group 2–3, lab-mapped, presentation, originality) → deadlines & help (announced early, strict, forum-first). Connections: 1.1 (modules determine what is evaluated) → 1.10–1.11 (labs where assignment skills are rehearsed).

1.4 Computing Foundations — PSM, Control and the Software Stack

1.4.1 The Computer as PSM Plus Control

A computer is a capable machine that can do three things and needs a fourth to keep order:

Process data — To process data you need a program. The program runs, consumes data, changes its form in various ways and provides a result.

Store data — In memory storages, both temporary and permanent. The system provides capability for both.

Move data — From input and output devices, to display, over the network to another device, to and from peripherals. Moving data involves I/O peripherals.

Control — Without control the above three would be chaotic. The system has only one set of address lines and one set of data lines. You cannot do a read and a write on the same data lines in the same clock cycle. If a program says read this and write this and those run in two separate threads using the processor without coordination, I/O systems and data lines become confused and the system falls into chaos. Control streamlines some tasks to run in sequence and plans others to run in parallel. A control unit helps executing programs in the form of processes that consume data in a neat way.

In short, remember PSM of data — processing, storing, moving — plus control.

Hook — why add control to PSM? You already expect computers to compute, remember, and communicate. But why does a machine that can do all three still freeze or corrupt data when two programs run? Because doing is not enough — ordering matters. Control is the ordering.

Intuition + Analogy — PSM as kitchen, control as head chef.

  • Process datacook — a program is a recipe that transforms raw ingredients (input data) into a dish (result). The recipe must be explicit; the kitchen does not guess.
  • Store datapantry and fridge — temporary storage (RAM, cache) is the counter where you keep what you are using now; permanent storage (disk) is the pantry where it sits overnight.
  • Move datawaiters and trolleys — I/O devices move dishes from kitchen to table, orders from table to kitchen, and supplies between pantries.
  • Controlhead chef and clock — with one stove and one pass, you cannot sauté and plate on the same burner in the same second. The chef sequences and parallelizes: dough rises while soup simmers, but two hands cannot put two different pans on the same burner at once.

Similarly, the hardware has one set of address lines and one set of data lines. A read and a write cannot ride the same lines in the same clock cycle. If two threads issue "read this" and "write this" without coordination, the lines contend and the system falls into chaos. Control — via the control unit and the OS scheduling that stages processes — makes the sequence neat. Where the analogy breaks: a kitchen chef is human and flexible; hardware control is rigid, clocked, and must be explicit in circuits and kernel code.

Why control is not optional — the single-bus constraint:

A simple machine shares address and data buses. In one clock tick, the bus can carry either a read address+data or a write address+data, not both. Multiplexing without control means:

  • Two programs drive the bus simultaneously → electrical contention, undefined values.
  • Device DMA and CPU access collide → I/O corruption.
  • Out-of-order completions make a later read see stale data.

The control unit (hardware) plus process scheduling (OS) solves this by time-ordering: some tasks sequentialize, others pipeline or parallelize where buses allow. Think of it as traffic lights on a single-lane bridge — lights do not make cars faster, they make crossing correct.

Visual intuition: draw two timelines. Top timeline (without control) shows Program A "READ x" and Program B "WRITE y" overlapping the same bus slot — red collision band. Bottom timeline (with control) shows A's READ in cycle 1, B's WRITE in cycle 2, I/O DMA in cycle 3, with a small scheduler box deciding who goes next. The one-sentence takeaway: concurrency without control is collision; control turns contention into orderly sharing.

Assumptions & Scope

  • Scope: The "one set of address/data lines" is the teaching abstraction for a shared-bus machine. Modern systems have caches, multiple buses, and cores, which relax but do not eliminate the constraint — ordering (memory barriers, locks) remains essential.
  • Assumption: Programs run as processes — OS-managed execution contexts. Without the process abstraction, "control helps executing programs in the form of processes" would have nothing to attach to.
  • What breaks if ignored: Two threads uncoordinatedly read and write shared memory will see torn values, stale caches, or device confusion — exactly the "chaos" the lecture warned about.

Recap + Bridge: PSM names what a computer does; control names how it does them without chaos on shared lines. Bridge: end users never touch that control directly — they meet applications first, which sit on system software that mediates control. Next we classify that software boundary precisely.

1.4.2 Applications and Programs You Meet First

As an end user you probably use a text editor, a remote connection tool, a compiler front end, a database or you run queries. These are different applications or system programs that the end user interacts with directly. You do not interact with the kernel or the hardware every time. Applications work with the operating system, and the operating system works with the hardware to get the job done.

Think of a familiar stack: you type in VI or VS Code, push via SSH, compile with gcc, query a database. In each case your hands touch an application or system program; that program then asks the operating system to allocate memory, schedule CPU, and drive devices. You rarely bypass the OS to poke hardware — and on a managed system you are not allowed to.

This layering is why systems programming spends so much time on the mediator — the system software that lets endless applications share one set of hardware safely.

1.4.3 System Software Versus Application Software

There are two types of software:

Application software — Used or designed to be used by the end user. The list is endless.

System software — Helps the computer run the application programs. Designed to run on the hardware and to help application programs run. The set is very limited.

Examples of system software are an operating system, a compiler which acts as a translator from high-level language to machine level language, and an assembler which translates assembly language to machine level language. Machine level language is what the machine can understand. A machine is not universal. It understands a limited set of instructions, perhaps around 15, 16, 200, 250 or 256 instructions. Everything you write must boil down to one of those instructions.

A common slip is to call the compiler target a middle level language. The correct target discussed here is machine level language. That correction matters because the hardware only responds to its instruction set.

Real-world: 8085, 8086, PDP-11 and PDP-12 were well known assembly targets in engineering curricula. Assembler translates that assembly to machine code the machine can understand.

Drawing the boundary — who is who:

Dimension Application software System software
User touches it? Yes — directly (editor, browser, DB client) Rarely / indirectly — it serves apps
Purpose Do user tasks Make apps able to run on hardware
Count Endless — new app per need Limited — OS, compiler, assembler, linker, loader, drivers
Talks to hardware? Through OS only Yes — OS and drivers talk to CPU/memory/buses
Example lineage query → DB app → OS → driver → disk OS, cc, as, ld, kernel driver

Why "limited set" matters: A CPU may expose only ~15 original PDP-11 instructions or ~250 complex x86 variants (numbers vary by model — the lecture cited 15/16 through 256 as illustrative range). Every high-level if, loop, or function call must lower to that set. That lowering is exactly what compilers and assemblers do.

Professor intuition — the "middle-level language" correction

The professor caught a frequent slip: students describe the compiler as targeting a "middle-level language." The precise target here is machine-level language — the binary opcodes the hardware decodes. A middle language suggests an extra abstract step that does not help the hardware execute. Keeping the target as machine language reminds you that the hardware is literal: it only reacts to its defined instruction set, not to intermediate abstractions.

Pitfalls

  • Listing every program as application software. The OS, compiler, and assembler are not applications — even though you "run" gcc, its job is to produce code for the machine, not to solve an end-user task like editing.
  • Thinking machine instructions are unlimited. Treating the ISA as infinite hides why translation is hard. The art of compilation is fitting expressive languages into a tiny instruction alphabet.
  • Confusing translator with executor. A compiler translates but does not run your program. Execution needs the linker/loader/OS chain (detailed in 1.5).

1.4.4 Where System Software Sits

Think of layers. Outermost is the end user. Next is applications and system programs the user touches. Then the operating system as mediator. Innermost is hardware. System software is the narrow layer that talks to hardware on behalf of everything else.

Visual intuition: concentric rectangles. Outermost: End user. Next ring in: Applications & system programs (editors, compilers you invoke). Next: Operating system — the only ring with drivers that can touch CPU, memory, buses. Center: Hardware (CPU, RAM, disks, NICs). Arrows go user → application → OS → hardware and back. The takeaway: all roads to hardware go through system software — which is why bugs or bottlenecks there affect everything above.

Assumptions & Scope

  • Scope: This layering assumes a classic OS with a kernel-mediated driver model (as in Unix/Linux). On bare-metal embedded systems you may link drivers directly into the application — the lecture's general model still applies, but the "narrow layer" is even thinner.
  • Assumption: End users are unprivileged — they cannot drive devices directly. When you can (e.g., raw disk access via ), you are stepping into the system-software role and inherit its responsibility for ordering.

Recap + Bridge: PSM plus control explains what and how orderly; system vs application explains who mediates. Bridge: the narrow mediator layer contains the translators that turn human text into machine opcodes — next we meet them one by one and see which of them actually turns a file into a running process.

1.5 Translators in Depth — Compiler, Assembler, Linker and Loader

1.5.1 Compiler

A compiler — a program that translates a high-level language such as C, C++ or Java into machine level language — reduces abstraction to the instruction set the hardware supports. Because the instruction set is small, all high-level constructs must reduce to that set. A compiler combines with other translators in real toolchains but is conceptually distinct from an assembler.

What a compiler actually does — and does not do:

  • Input: human text in C/C++/Java (variables, , loops, functions).
  • Output: machine-level opcodes and data that the hardware can fetch and decode — or, in a modern toolchain, relocatable object code that awaits linking.
  • Core difficulty: lowering expressive constructs into ~15 to ~256 hardware instructions (the illustrative range cited). A single for loop becomes compare, branch, increment, and load/store sequences.
  • Boundary: The compiler does not make the program run. It makes it runnable in principle. Making it actually run is the linker/loader's job (see 1.5.3).

Think of the toolchain as translate → stitch → place. Compiler = translate. It is conceptually distinct from an assembler (which translates assembly mnemonics, not C), even though real build commands like gcc invoke both in one step for convenience.

Everyday analogy — translator vs courier. A compiler is like a literary translator who turns your novel (C) into the local language (machine code) the village (CPU) understands. The translator hands you a printed book — but someone else must bind chapters together (linker) and place the book on the library shelf where the village can open it (loader). Translation alone does not put the book in readers' hands. Where analogy breaks: a real compiler also optimizes and checks types, not just word-for-word substitution.

Pitfalls

  • Calling the target a "middle-level language." As corrected in 1.4, the precise target discussed here is machine-level language. Middle-level descriptions hide that hardware is literal — only its ISA matters.
  • Assuming gcc is "just a compiler." On a Unix system, gcc is a driver that runs preprocessor → compiler → assembler → linker. Failing to separate those stages makes it hard to diagnose "compile succeeded but link failed."

1.5.2 Assembler

An assembler — a translator from assembly language to machine language — does not work from a high-level language. If you want to use an assembler as is, you need assembly language programming. In this course you will not get into full assembly language programming, but you will understand how the assembler works on any code. Assemblers are sometimes seen combined with interpreters and sometimes with compilers in explanations. That combination view is used to show why understanding assembler matters even if you do not write assembly day to day.

Assembler in the toolchain:

  • Input: assembly mnemonics (e.g., 8085 MOV A,B, JMP Label, PDP-11 ADD R1,R2) — one mnemonic per machine instruction, with symbolic labels for addresses.
  • Output: object code with opcodes, plus a symbol table for labels that the linker will later resolve across files.
  • Why study it if you will not write assembly daily: Because compilers emit assembly on the way to machine code, and linkers rely on assembler conventions (symbol formats, relocation records). Understanding the pass that turns Label: into a numeric offset lets you read compiler diagnostics and linker errors intelligently. You need to understand how the assembler works on code, not to become an assembly programmer.

Professor note — "often combined with interpreters and compilers." The lecture observed that textbooks sometimes present assemblers together with interpreters (which execute source directly) and compilers (which translate high-level source). That combined presentation is pedagogical — to contrast translate-then-run vs interpret-while-running — not a claim that an assembler interprets. Keep the roles separate: assembler = mnemonic → opcode; interpreter = source → immediate execution.

Assumptions & Scope

  • Scope: Assembly discussed here is the classic 8085/8086 and PDP-11/PDP-12 family used in curricula. Modern x86_64 or ARM assembly differs in register names and addressing modes, but the assemble-then-link-then-load pattern is unchanged.
  • Assumption: You will read assembly fragments generated by the toolchain, not hand-write large programs. The exam will test how assembler works (e.g., symbol resolution, two-pass assembly) rather than asking you to author assembly.

1.5.3 Linker and Loader — Turning a Program into a Process

The linker and loader are very important because they interact with the brain of the system, which is the operating system, to make a process change state from program to process. You require the help of the linker and the help of the loader for a program to execute. Understanding how linkers and loaders are built, what different steps are involved in building them, and how they work is a core goal. This explains how a file that contains data and control structures created by users, compiled via compilers into executable form, actually reaches execution as a running process.

Think of it as steps with rationale: translation to machine form, linking to resolve references across pieces, and loading to place the result in memory under operating system control so it can run as a process. Not every part of the operating system can work with hardware directly. Only device drivers can drive CPU, memory and buses. Drivers accept requests and make devices work for running programs. Coordination among drivers is part of what makes execution orderly.

Program vs process — the state change that matters:

  • Program — a file on disk: bytes of code and data plus control structures (headers, symbol tables). It does nothing until placed in memory with resources.
  • Process — an execution in RAM: the program's bytes loaded, memory allocated (code, data, heap, stack), file descriptors opened, scheduled by the kernel, and driven by drivers that actually pulse CPU, memory, and buses.

Three steps with rationale:

  1. Translate (compiler/assembler) → relocatable object files, each with its own symbol table. Rationale: let you build pieces separately.
  2. Link (linker) → resolve external symbols across object files and libraries, assign combined addresses, produce an executable image. Rationale: stitch pieces into one coherent whole so call printf actually points to printf's code.
  3. Load (loader, with OS) → allocate memory, copy segments, fix relocations, set program counter to entry point, hand control to the CPU under OS supervision. Rationale: move the stitched image from disk to RAM and make the OS aware it is now a schedulable entity.

Only device drivers can then drive the hardware for that process — the loader and kernel coordinate which driver handles CPU dispatch, which handles memory paging, which handles I/O. That is why the lecture called linker/loader interaction "with the brain of the system."

Visual intuition: picture an architect's workflow. Compiler/assembler produce blueprints of individual floors (object files). Linker is the structural engineer who aligns floors, resolves where the staircase connects floor 2 to floor 3 (symbol resolution), and produces one buildable set. Loader is the site crew that pours the foundation at a specific plot (memory addresses), hoists the building, and connects power/water (drivers). The takeaway: drawings alone are not a building — linking makes them coherent, loading makes them inhabitable.

Pitfalls

  • Treating assemblers as the execution enabler. The lecture's correction is precise: assemblers matter to understand, but understanding them alone does not change how high-level programs run — they are used directly only when you write assembly. Linkers and loaders are what directly decide whether a file becomes a running process. Confusing these roles leads you to debug the wrong stage when a program "compiles but does not run."
  • Ignoring driver mediation. Not every OS layer touches hardware. If you assume any kernel code can drive buses directly, you will misattribute crashes. Only drivers do the pulsing; the rest of the OS routes requests to them.

Q & A — Are assemblers unimportant because they are bundled?

Q: Are assemblers unimportant because they are bundled with other tools?

A: Assemblers are important to understand, but understanding them does not by itself change how everyday high-level programs run, because assemblers are often seen together with interpreters and compilers and are used directly only when you program in assembly. Linkers and loaders on the other hand directly decide whether a program becomes a running process. The question arose because the lecture presents assemblers alongside compilers/interpreters — the answer separates pedagogical grouping from execution impact.

Exam note: When asked "what turns program into process?" answer linker and loader with the OS (kernel/drivers), not compiler or assembler alone. Reference the "file with data and control structures → compiled executable → loaded process" chain.

Recap + Bridge: Compiler/assembler translate; linker stitches; loader places and starts — together they promote a file from program to process under OS/driver control. Bridge: that process now lives inside the Unix/Linux architecture — next we locate the shell, kernel, and hardware in their classic four-layer diagram and list what the kernel actually does for every process.

1.6 Unix and Linux — History, Architecture and Kernel Services

1.6.1 Unix and Linux Used Interchangeably Here

For this course Unix and Linux are used interchangeably and treated as equivalent operating systems for many purposes. Unix is closed source and not open source like Linux. It was developed in 1969 by Thompson, Ritchie, McIlroy and others. In 1973 Ritchie and Thompson, inventors of C, rewrote Unix in C. Linux in many ways is considered a successor of Unix and was developed by Stallman and Torvalds.

A short, exam-ready history line:

  • 1969 — Unix created by Ken Thompson, Dennis Ritchie, Doug McIlroy and colleagues (at Bell Labs, closed source in this lecture's framing, not open source like later Linux).
  • 1973 — Unix rewritten in C by Ritchie and Thompson, inventors of C. This was the portability watershed: an OS in a high-level language could be moved to new hardware with small changes rather than a full rewrite.
  • Later — Linux as successor developed within the free/open tradition associated with Richard Stallman (GNU) and Linus Torvalds (kernel). Linux reimplemented Unix ideas openly, which is why the lecture treats "Unix" and "Linux" as interchangeable for many purposes in this course.

Portability lever: Rewriting in C is why 1.7.2's portability claim is credible. A kernel in assembly is welded to one ISA; a kernel in C is mostly ISA-agnostic, with a small machine-dependent seam.

Intuition — why 1973 matters more than 1969 for you. 1969 gave Unix its ideas; 1973 gave Unix its reach. Before C, porting meant rewriting assembly for each new machine. After C, porting meant recompiling plus small machine-specific changes — the same reason you can later port Linux to x86 and later to ARM (Apple M1) with limited effort.

Common slip — "open source means everyone edits mainline." Open here does not mean chaotic direct edits to the main line. It means the freedom to study, modify, and propose code under license, with maintainership gating what lands. The lecture flagged this because students often equate "open" with "uncontrolled."

1.6.2 The Unix Structure Diagram — Layers

The basic figure for Unix has four bands: outermost end users, then a shell that acts as an interface between user and kernel, then the kernel which is part of the operating system, then hardware that the kernel talks to. The shell and the kernel have distinct responsibilities.

Visual intuition: four concentric bands, outermost to innermost:

  • Band 1 (outer) — End users at terminals.
  • Band 2 — Shell (Bourne-family , C-family , or root prompts) — the command interpreter you type to. It checks syntax, expands wildcards, and asks the kernel to act.
  • Band 3 — Kernel (part of the OS, always resident) — file, process, memory, I/O, accounting, interrupts.
  • Band 4 (center) — Hardware — CPU, RAM, disks, NICs, driven only via drivers.

Arrows: users never reach hardware directly; they go through shell → kernel → drivers → hardware, and results flow back the same way. One-sentence takeaway: shell translates intent, kernel enforces policy and drives hardware.

This diagram is the map you will use to answer "where does this happen?" — e.g., "ls is a program invoked via the shell; fork() is a kernel service."

1.6.3 What the Kernel Is and What It Is Not

A kernel — the important piece of the operating system that keeps running at all times when the computer is on — is not a separate category of software beyond system versus application. The operating system is system software, and the kernel is a very important module of the operating system. It is system software and is not application software because the end user does not directly use it. Coordination among device drivers happens here. When a system starts, the operating system is installed on the hard disk. There could be multiple operating systems installed. On power-up a check is needed to see that hardware is working and to point to the right block or sector where the operating system resides. This is done by the bootstrap program, the very first program that runs when you boot. It does a system check, confirms things are working, points to the block or sector where the operating system lives and loads that operating system into RAM to start executing it.

Kernel placed correctly:

  • Taxonomy: System software is the set of programs that help application programs run on hardware. Operating system is system software. Kernel is a module of the operating system — the always-resident core — so it inherits the system software label. It cannot be application software because the end user does not invoke it as a task (you invoke editors, compilers; you use the kernel indirectly via system calls).
  • Bootstrap program — the very first program on power-up. It (1) checks hardware is alive, (2) locates the block/sector where the chosen OS resides (there may be several installed), (3) loads that OS image into RAM and jumps to its entry point. Without bootstrap, the kernel — even though installed on disk — would never start.

Think of bootstrap as the ignition key: disk is the garage, RAM is the road, kernel is the engine. Turning the key (bootstrap) moves the engine from garage to road so it can run continuously.

Q & A — Is the kernel neither system nor application software?

Q: Is the kernel neither system software nor application software?

A: Since the kernel is part of the operating system and the operating system is system software, the kernel is system software. It cannot be application software because the user does not directly use it. This fixes the misconception that the kernel sits outside the two categories — it sits firmly inside system software as its most privileged module.

Pitfalls

  • Treating kernel as a third category. The lecture corrected this explicitly: there are two top categories (system vs application); kernel is inside system.
  • Forgetting bootstrap. Students often say "turn on power → kernel runs." The correct intermediate is bootstrap → loads kernel to RAM → kernel runs.
  • Assuming any OS layer drives hardware. Only drivers do. The kernel coordinates drivers; it does not itself pulse buses.

1.6.4 Kernel Services in Daily Operation

Key kernel capabilities: file management and security for all production purposes including services for input and output devices; process scheduling and management to avoid conflicts when processes need a device or need to be scheduled or preempted; system accounting including what kind of users are created and how to restrict each user to a specific set of places or directories; memory management including how linkers and loaders help with memory handling and how to avoid page conflicts; interrupt and error handling; and date and time services, which are very minimal. These are the services that let multiple users and multiple programs share one machine.

Six services you must be able to name and illustrate:

  1. File management & security — plus I/O services. Create, open, read, write, close, permission check ( for user/group/other), and device I/O behind the same file abstraction.
  2. Process scheduling & management. Multiplex CPU across processes (time sharing), handle wait/preempt, avoid device conflicts when two processes want the same device.
  3. System accounting. Track users, groups, quotas; enforce "this user may only work under /home/alice;" audit who did what.
  4. Memory management. Allocate RAM segments with loader help, avoid page conflicts (two processes mapping the same frame incorrectly), support paging.
  5. Interrupt & error handling. Field device interrupts, trap faults, recover or terminate cleanly.
  6. Date & time services. Minimal but essential — the very date command in 1.11 reads what the kernel maintains.

Each service is what makes multiprogramming + multi-user safe rather than chaotic — the same control theme from 1.4, now embodied in kernel code.

Visual intuition: imagine a hotel manager (kernel) with six desks: Front Desk (files), Concierge (processes), Accounts (accounting), Housekeeping (memory), Maintenance (interrupts/errors), Clock (time). Every guest (process) must pass through a desk to get a room (memory), a key (file descriptor), or room service (device). The takeaway: sharing one machine among many guests requires a coordinated desk, not just rooms.

Recap + Bridge: Unix (1969, C in 1973) and Linux (Stallman/Torvalds) share architecture; that architecture is four bands (users → shell → kernel → hardware) with bootstrap as ignition; the kernel is system software delivering six coordinated services. Bridge: those services enable the headline Unix strengths — multiprogramming, time sharing, portability, modularity, security — which we next define with concrete numbers and stories.

1.7 Defining Unix Strengths — Multiprogramming, Time Sharing, Portability, Modularity, Security and More

1.7.1 Multiprogramming, Multi-User and Time Sharing

Features that stood out when no other operating system showed them were multiprogramming, multi-user and time sharing. Multiprogramming means the system can run multiple programs at the same time in the sense that several programs are resident and making progress. Time sharing means those programs take turns on the CPU so quickly that each user feels theirs is the only one running. A classic example is a client-server with one hundred end users connected to a server. Each connection runs as a different process. Each process is scheduled for a certain amount of time and each gets responses quickly. Handling of thousands of processes can be seamless and smooth — provided the CPU is capable enough to meet the heavy requirement and the bandwidth is there. You cannot expect an 8085 processor to host a Linux system for a thousand remote users. You need a capable processor and adequate network support for these features to stand out.

Time sharing works like this. Take a duration of one minute where the CPU works and six processes are ready. Each of the six gets ten seconds in turn. The first ten seconds go to the first process, the next ten to the second and so on. At the end of the six, the cycle forms a round robin and returns to the first process. This is so fast that the different users do not perceive that a single CPU is running all six. It is not truly parallel on a single processor, but in the larger picture it feels like parallelism. That felt parallelism is the core intuition for time sharing.

Multitasking is related but broader. There can be multiple tasks at the same time within a workload. Example with a word processor: typing is consumed and displayed at the same time, the word processor does auto save at intervals, spell check runs as you type and grammar check also runs. Those are different tasks, all active and sharing time to do the job. Another close question is multithreading. A process can have multiple threads within it running in parallel, and those threads can also be time shared. Time sharing at process level and at thread level share the same idea of slicing time.

Hook — why did Unix stand out? In the early era, running many programs for many users on one machine and making each feel alone was extraordinary. The trick was not faster hardware alone but an OS that could interleave work so finely that humans could not feel the seams.

Intuition + Analogy — multiprogramming vs time sharing vs multitasking vs multithreading.

  • Multiprogramminghotel with many guests checked in — many programs are resident and making progress (rooms occupied), even if only one is at the front desk.
  • Multi-usermany guests, each with a key — each human has a process context and permissions; isolation is the point.
  • Time sharingsingle chef flipping six pans round-robin — six processes each get 10 s of a 60 s minute (the lecture's numbers). No true simultaneous cooking on one burner, but each dish advances and guests feel served together.
  • Multitaskingword processor juggling — within one application, typing, display, auto-save, spell-check, and grammar-check are tasks sharing time. They are not separate users, but they are separate jobs the app must advance.
  • Multithreadingone kitchen with multiple cooks under one head chef (process) — threads share the process's address space but run in parallel and can themselves be time-sliced.

Where analogy breaks: A real CPU slice is milliseconds, not ten seconds — the 10 s figure is a teaching scale to make arithmetic obvious; real schedulers use far smaller quanta to keep interactive latency low.

Formalizing time sharing with the lecture's 60-second / 6-process numbers:

  • Setup: 6 ready processes , one CPU, round-robin quantum = 10 s, window = 60 s.
  • Schedule:
Interval Running
0–10 s
10–20 s
20–30 s
30–40 s
40–50 s
50–60 s
60–70 s again (cycle repeats)
  • Perceived parallelism: Each process advances 10 s per minute, but because switching is fast relative to human perception and I/O waits, each of 100 remote users on a server sees prompt responses — provided the CPU is capable and network bandwidth suffices. The lecture stressed the condition explicitly: an 8085 cannot host Linux for 1000 remote users; you need a capable processor and adequate bandwidth. Smoothness is not free; it is provisioned.
  • Not true parallelism on one core: At any instant only one process occupies the CPU. "Parallel" is the felt effect over seconds, not simultaneous execution. True hardware parallelism needs multiple cores or processors.

Worked Example — felt parallelism with six processes

Given: 1 CPU, 6 processes, quantum 10 s, observation window 60 s.

Step 1 — total service: CPU is busy 60 s of 60 s → utilization 100%.

Step 2 — service per process: each per cycle. Over 3 minutes, each gets of CPU.

Step 3 — latency bound: Worst wait before a process runs again = 50 s (if it just yielded, five others run). Real systems shrink this by using ~10–100 ms quanta, so worst wait feels instantaneous.

Step 4 — sense-check: If you double processes to 12 with the same 60 s window and 10 s quantum, you need two cycles (120 s) to serve all once — throughput per process halves. That is why "thousands of processes seamless" requires both scheduling and sufficient CPU + bandwidth, not just the algorithm.

Real client-server anchor: 100 users × 1 process each on a server. Each connection is a process. Scheduler gives each a slice; because slices are small and many processes block on I/O (waiting for user typing), the CPU stays productive and responses feel immediate — until CPU or bandwidth saturates.

Bolded answer: With the lecture's numbers, each of the six processes gets 10 seconds of the 60-second minute, round-robin, creating felt parallelism but not true simultaneous execution on a single CPU.

Worked Example — multitasking inside a word processor

Tasks active at once: (1) keyboard input consumed, (2) characters displayed, (3) auto-save to disk every interval, (4) spell-check, (5) grammar-check.

How sharing helps: While you pause typing (I/O wait), the scheduler runs spell-check on the last paragraph; while spell-check waits on dictionary I/O, auto-save flushes. All tasks progress without you explicitly sequencing them. This is multitasking — multiple jobs within one workload — distinct from multiprogramming (multiple programs) and multi-user (multiple humans).

Sense-check: If auto-save blocked the UI thread, typing would stutter. Time-slicing prevents that by never letting one task monopolize the CPU.

Q & A — Is time sharing the same as multi-threading?

Q: Is time sharing the same as multi-threading?

A: Not really. A process can have multiple threads that run in parallel within it and those threads can also be time shared. Time sharing at the system level means six processes each get ten seconds of a sixty-second window in round robin. Multithreading is parallel activity inside one process. Both use time slicing but they are not the same concept — one slices processes, the other slices threads within a process.

Why the confusion is plausible: both involve slicing time, but the address space boundary differs — processes are isolated; threads share memory.

Assumptions & Scope

  • Scope: The 10-second quantum is pedagogical. Real Linux CFS quanta are milliseconds; the insight (rapid interleaving → felt parallelism) holds, but real latency numbers are far smaller.
  • Assumption: CPU-bound reasoning above assumes processes are runnable. I/O-bound processes voluntarily yield, improving responsiveness.
  • What breaks: Expecting seamless thousands on an 8085 or on a thin network violates the lecture's explicit capability proviso — provision the CPU and bandwidth first.

1.7.2 Portability

Portability — ability to move the system to different hardware with small changes — was key. At that time the main target was x86. Today ARM is also present, though not always prominent among Unix or Linux users. The M1 machine from Apple is basically ARM-based. You can port a Unix or Linux operating system to a different architecture with small changes. That is how it was built.

Real-world: Apple M1 ARM is used as an example that porting is not theory. The same operating system ideas with small changes run on a different instruction set.

The causal link is the 1973 C rewrite (see 1.6.1): a kernel in C is hardware-shaped only at a narrow seam (boot, page tables, drivers). Replace that seam, recompile, and you run on x86 or ARM. The M1 is the modern anchor — an ARM core running a Unix-descended OS with the same file, process, and shell abstractions you will use on x86 Ubuntu in the lab.

Visual intuition: two engine bays (x86 and ARM) with different bolt patterns, but the same engine block (kernel in C) fits both with a different mounting plate (machine-dependent layer). The takeaway: portability is not magic — it is C plus a thin abstraction layer.

1.7.3 Modularity

Modularity — building as pluggable modules rather than one monolithic block from first line to last — lets tasks and activities be split into different modules that can be extended to do multiple things. That growth model explains how the system keeps adding capabilities without rewriting everything.

Think plugin, not rewrite. A new file system type, a new scheduler policy, or a new device class arrives as a module that plugs into well-defined interfaces. Without modularity, each addition would require editing a single giant monolithic file from line one — brittle and unreviewable. With modularity, teams extend the system concurrently.

Pitfall — "modular means fragmented." Modularity does not mean the kernel is scattered. It means boundaries are designed — e.g., VFS for file systems, driver ops for devices — so growth is additive, not invasive.

1.7.4 Security

Security — layered access — is pretty good and pretty tight in Linux and Unix compared with early Windows, which was slow to cope with security. Different levels are in place: user level permissions, group level and system level. Access permissions are given to files and directories at those levels. File structure and security are linked, which leads directly to the file abstraction.

Unix security is file-centric, which is why it leads naturally to 1.8's "everything is a file":

  • User level: owner bits ( for ) — what you can do to your file.
  • Group level: group bits ( for ) — what your team can do.
  • System/other level: other/world bits ( for ) plus superuser — what everyone else can do.

Permissions are file metadata (stored in the inode), and directories are files that list what lives inside them, so access control on files automatically controls the namespace. Device files being files means the same permission check that gates a document also gates a printer — uniformity is a security feature.

Assumptions & Scope

  • Scope: The lecture compared Unix security favorably to early Windows, which lagged in file-level permission granularity. Modern Windows has ACL-rich security — the historical contrast, not a current absolute, is the point.
  • Assumption: Permissions are enforced by the kernel on every open; bypassing them requires privilege (). Misconfigured chmod 777 defeats the model regardless of its design.

1.7.5 Device Independence, Communication, Tools and Compilers

Device independence means you need a driver to run a device, but once you have it the job is done. The story told for context is installing Linux on a Zenith academic machine around 1999 or 2000. Fedora 1 or Fedora 2 took about eight or nine installations before one succeeded. Every driver had to be chosen for what was in the hardware: processor kind, memory size, display, keyboard, mouse with two or three keys and a scroll, and so on. None of that was taken automatically then. These days even young users use computers running Linux without noticing a difference. Communication is strong. Using various protocols, the system supports tools and services like FTP, Telnet and SSH. Compilers are plenty: C, C++, and if something is not there you can install it. Other tools such as grep are also present. Almost seventy to seventy-five percent of servers in the server world still lean on Linux or Unix machines because of all these capabilities.

Three strengths in one bundle:

  • Device independence — one interface, many devices. Once the right driver is present, user code opens /dev/... or uses a generic syscall and the driver translates to the specific hardware. The Zenith / Fedora 1–2 story (8–9 attempts circa 1999–2000, hand-picking CPU, RAM size, display, keyboard, 2–3-button mouse) is the before picture — no auto-detection. Modern auto-probing is the after — young users install without seeing that menu at all.
  • Communication — protocols as first-class tools. FTP (file transfer), Telnet (remote login, now largely replaced by SSH), and SSH (encrypted remote shell) are not add-ons but part of the expected toolset for moving data and logging in across machines — the "move data" half of PSM at network scale.
  • Tools and compilers — the ecosystem you will live in. C/C++ compilers plus the ad-hoc installer model ("if it is not there, install it") plus everyday filters like explain why 70–75% of servers still lean on Linux/Unix: the machine is useful the moment it boots, without hunting for basics.

Professor analogy — Zenith 1999 vs today (intuition for device independence).

Then: installing Fedora meant answering a checklist that matched physical inventory — "Pentium II or K6? 64 MB or 128 MB? S3 or Cirrus display? PS/2 or serial mouse?" A wrong answer meant the device did not work, hence repeated installs.

Now: the installer probes DMI/PCI/USB, loads the matching driver, and the same generic open("/dev/sda") works whether the disk is SATA, NVMe, or USB — independence achieved.

Where it breaks: independence is only as good as driver coverage. Rare or brand-new hardware still needs a vendor driver — the openness story in 1.7.6 is exactly how that gap closes quickly.

Linux popularity rests on several linked points:

Free and open source. Anyone has the freedom to work on the code. Open here does not mean everybody edits the mainline at will. It means the option exists and the code can be worked on and evolved.

Evolves to support many machines. Because it is open it has grown to support different machines and to add features quickly.

Supports protocols and devices. It supports various protocols and various devices for wireless connectivity and similar needs. Say Wi-Fi 6 comes to market in some year or month. A company working on Wi-Fi 6 can pick up the Linux code, add a module for Wi-Fi 6 to work, test it and once it works it will be rolled out in the standard edition. That speed comes from openness.

Customizable. You can tune the system to your needs. You can install without a UI by checking it off or with a UI. You can leave out a set of tools that you do not want. Customization explains how Linux was ported even to constrained devices.

Constrained devices and Android. Porting to constrained devices is a direct result. Android built on the Linux kernel is used in smartphones we carry daily.

Real-world: Open source does not mean chaotic edits. It means a Wi-Fi 6 vendor can develop a module against the open code and, after testing, the feature enters the standard edition.

Real-world: Android is the everyday proof of customization and portability. The phone in your hand runs a system built on the Linux kernel.

Why "free" translates to "fast" and "fitting":

  • Speed — Wi-Fi 6 example. When a new wireless standard appears, a vendor can fork the open tree, add a wireless driver/module, test against hardware, and upstream it. Once reviewed and tested, it rolls into the standard edition — no waiting for a single vendor's release train. That is the openness dividend: parallel experimentation with a common upstream.
  • Fit — customization. Need a headless server? Uncheck UI at install. Need a tiny sensor node? Leave out entire toolsets. The same kernel scales down to constrained devices because you compile what you need — which is why Android (Linux kernel + custom user space) powers phones you carry daily. One kernel family, many shapes.

Bottom line: free → many eyes, open → many hands, customizable → many targets. That triangle explains rapid support for new machines and protocols without a central gatekeeper.

Pitfalls

  • Equating free with zero cost to run. Free here is freedom (to study, modify, share), not "no operational cost." You still provision hardware, bandwidth, and admin time — the 100-user server example in 1.7.1 made that explicit.
  • Assuming Android = full Linux desktop. Android uses the Linux kernel but a different user space and app model. The kernel portability lesson holds; the command-line tooling does not transfer one-to-one.

1.7.7 Distributions

There is a very limited list of Linux distributions shown as flavors in the market, with at least ten to fifteen more that are very popular beyond them. Names mentioned include Debian, Fedora, Ubuntu and CentOS, plus special ones such as Kali Linux or Parrot OS which carry tools for testing, hacking and vulnerability checking. Beyond those, many others exist.

Think of distributions as curated bundles of the same kernel and tool heritage, differing by package selection, release cadence, and target audience:

  • General — Debian, Fedora, Ubuntu, CentOS: different packaging (DEB vs RPM), different stability vs freshness trade-offs, but all share the Unix/Linux core you are learning.
  • Specialist — Kali Linux, Parrot OS: pre-loaded with security testing, hacking, and vulnerability-check tools so testers do not assemble them by hand.
  • Long tail — 10–15+ more popular: the lecture noted the displayed list was limited — the ecosystem is larger than the slide.

Visual intuition: a base chassis (kernel + GNU tools) with different trim packages — commuter, off-road, racer. The chassis is shared; the trim (distribution) chooses which tools ride along.

Recap — six strengths, one substrate: Multiprogramming/multi-user give concurrency, time sharing gives felt parallelism (6 × 10 s in 60 s), portability (C + thin machine layer, M1), modularity (plug, do not rewrite), security (user/group/other on files), device independence (driver once, generic open after), communication/tools/compilers, openness → speed (Wi-Fi 6) and fit (custom installs, Android), distributions as bundles (Debian/Fedora/Ubuntu/CentOS/Kali/Parrot + 10–15 more).

Exam note: For "list Unix features with examples" questions, structure answer as: multiprogramming vs time sharing with 60/6 numbers → portability (x86→ARM M1) → modularity → security levels → device independence (Zenith/Fedora story) → communication (FTP/SSH) → openness/customization/Android → distributions. Distinguish multiprogramming vs time sharing vs multitasking vs multithreading explicitly — the Q&A distinction is examinable. Connections: 1.6 (kernel services enable these features) → 1.8 (file abstraction underpins security/device independence).

1.8 The File Principle — Everything Is a File, Types and Hierarchical Layout

1.8.1 Everything Is a File

In Unix or Linux everything is considered as a file. Hardware such as memory or I/O devices, when you want to write to the display you write into the file and that in turn writes to the display. Anything and everything in this environment is a file in the sense of a named entity the system manages uniformly. If it is running, it will be a process. A file fundamentally consists of some data and some control structures. Files are created by users and compilers are used to compile program text into executable form and run them as executables.

Hook — one idea to rule them all. Why does learning files repay you everywhere? Because Unix made file the single uniform handle for data, directories, and devices. Learn how to open, read, write, and permission-check a file, and you have learned how to talk to a document, a folder, and a printer.

Intuition + Analogy — file as universal power outlet.

Think of the Unix file as a universal power outlet on the wall, written as an analogy. A document is a lamp, a directory is a power strip that lists which lamps are plugged where, a device is a heavy appliance — but all plug into the same outlet shape. The same permission switch, the same open/read/write/close verbs apply regardless of what is plugged in.

What a file really is, in simple terms: Some data (the bytes you care about — characters in a C file, rows in a spreadsheet) plus control structures (metadata the system needs — owner, permissions, size, block pointers, timestamps — stored in the inode, detailed in Module 2). If the bytes are at rest, they are a file; if they are executing, the system calls that entity a process.

Where the analogy breaks: Not every file behaves like a regular byte container — reading from /dev/random yields fresh random bytes each time, and writing to a printer device streams to paper, not to disk. Uniform verbs, but the driver behind the outlet differs.

Why "everything is a file" is not a metaphor:

  • Uniform operations: open("/home/alice/notes.txt") and open("/dev/lp0") both return a file descriptor. write(fd, buf, n) either appends bytes to a regular file or queues bytes to a device driver that pulses the printer. Same system call, same error handling.
  • Uniform permissions: chmod and chown on a device file gate who can use that device, exactly as they gate who can read a document. Security in 1.7.4 is a direct consequence.
  • Uniform naming: Everything lives under / in one hierarchical namespace, so tools that walk directories (find, ls -R) naturally encounter devices under /dev and can report them consistently.

This uniformity is why the lecture said "thinking of hardware as files is not a metaphor for convenience — it lets the same tools and permissions apply to both data and devices."

Visual intuition: draw / at top, branching to regular files (leaves), directory files (branch nodes that contain lists of leaves), and device files (leaves that are portals to hardware behind the tree). One-sentence takeaway: the tree looks uniform from above, even though some leaves are portals.

1.8.2 Three Categories of Files

Unix files are in three categories:

Ordinary file — A regular file that contains a stream of alphanumeric characters or more generally a stream of data. Documents, text files, spreadsheets, C files, Java files, Pascal files and machine code files after translation all fall here.

Directory file — Contains details of what files and subdirectories are there within that particular file. It is the map of containment.

Device file — Represents devices. Block devices such as memory and hard disk where data moves in blocks, and character devices such as a printer where data moves as a sequential stream to be printed. All these devices are represented as files.

Thinking of hardware as files is not a metaphor for convenience. It lets the same tools and permissions apply to both data and devices.

The three, sharpened:

  • **Ordinary (regular) file — stream of bytes, no imposed structure.* The system attaches no meaning to the bytes — a.out, notes.txt, data.csv, hello.c are all just byte sequences; the programs* that interpret them give them meaning. This is the "nothing is imposed" principle from classic Unix texts.
  • **Directory file — map, not container.* A directory does not "hold" bytes like a box holds marbles; it holds names → inode numbers* plus metadata about those entries. Listing a directory reads that map. Creating a file adds an entry to the map and allocates an inode + blocks for data.
  • **Device file — named portal to a driver, in two flavors:**
  • Block device (e.g., /dev/sda, memory as block) — data moves in blocks (512 B / 4 KB chunks), seekable, buffered. Disks and memory live here.
  • Character device (e.g., printer /dev/lp0, terminal /dev/tty) — data moves as a sequential character stream, often unseekable, unbuffered or line-buffered. You write characters and they flow out; you cannot "seek to byte 100" on a printer.

Both device types appear in the file system namespace so ls -l shows them, but ls -l also reveals the difference: leading b vs c in ls -l /dev, plus major/minor numbers identifying the driver.

Pitfalls

  • Treating directories as byte buckets. cat on a directory fails — you list it with ls/getdents, not by reading its raw bytes as if it were notes.txt.
  • Confusing block vs character. cp to a block device writes blocks (and may require alignment); echo to a character device streams characters. Using block tools on a character device (or vice versa) yields confusing errors.
  • Assuming every "file" is on disk. Device files have inode entries but their data is not disk blocks — it is the live device. Deleting /dev/sda removes the portal, not the disk's contents (though you lose access until recreated).

1.8.3 Grouping into a Hierarchy

Files are grouped into directories and those form a hierarchical structure. Everything points to one main directory called root indicated by a slash . Under root you have multiple folders, generally named bin where executables are, boot where certain boot related files are present, dev for device files, home, root and usr, plus others. In home you have details of all the users and within each user you have desktop or download and other files for that user. Within that you can have your own files. The description of home as holding per-user directories matches what you see live: contains entries for each created user.

Example: The live system shows holds directories for each numeric ID such as 190242501 through 529 and a directory ubuntu for the demo user. Each new user such as ABC also gets a directory under after successful creation.

The hierarchy, rooted at :

 /                  ← root, the single parent of everything
 ├─ /bin            ← essential executables (ls, cat, cp)
 ├─ /boot           ← boot loader, kernel images
 ├─ /dev            ← device portals (sda, tty, lp)
 ├─ /home           ← per-user homes (see below)
 │   ├─ ubuntu      ← demo user (present on lab)
 │   ├─ 190242501 … 190242529  ← cohort numeric IDs
 │   └─ ABC         ← example newly created user (after sudo adduser ABC)
 ├─ /root           ← root user's home (distinct from /)
 └─ /usr            ← secondary hierarchy (libraries, docs, more binaries)
  • Absolute naming: Every file has a path from / — e.g., /home/ABC/notes.txt. That single root is what makes "everything is a file" navigable.
  • /home as user map: ls /home is expected to show one entry per created user. The live demo showed numeric IDs 190242501 through 529 plus ubuntu. After sudo adduser ABC, ABC appears there — not because you mkdir'd a folder, but because the account creation tool created the user and its home directory together. The distinction is examinable in 1.11's verification ritual.

Worked Example — reading after user creation

Step 1 — before: ls /home prints

ubuntu  190242501  190242502  ...  190242529

Step 2 — create: sudo adduser ABC (setting password when prompted, skipping Full Name details with Enter).

Step 3 — after: ls /home now prints

ABC  ubuntu  190242501  ...  190242529

Step 4 — proof that is a home, not just a folder: cat /etc/passwd | tail -n 3 will show a line for ABC with home field /home/ABC and shell (e.g., /bin/bash) — see full verification chain in 1.11.2.

Sense-check: If ABC appears under /home but cat /etc/passwd has no line for ABC, someone ran mkdir /home/ABC, not adduser. The directory exists but the user does not — permissions, logins, and ownership will be wrong.

Visual intuition: imagine a paper filing system: is the cabinet, each top-level folder is a drawer ( = tools drawer, = cables drawer, = employee pigeonholes). Opening the drawer reveals one labeled folder per employee — each folder is that employee's desk surface where their personal files live. Takeaway: the cabinet's structure is what makes finding any file a path-tracing problem, not a search.

1.8.4 Files and Their Compiled Companions

Program sources such as C, Java and Pascal are program texts you write because it is not feasible to write directly in machine code. The high-level text is written for humans and then translated via compilers and related tools into machine code files that the hardware can run. That is why the file idea links to executables in and to your own binaries.

Every program begins as an ordinary file of text — hello.c, Main.java, prog.pas — human-readable precisely because files impose no structure. That text lives in the hierarchy (often under your home), is edited via a file editor (VI in Module 3), and is translated via compilers/assemblers into another ordinary file of machine bytes — e.g., a.out or hello — which the loader can place in RAM as a process. The executables you already use under /bin (like ls and cat themselves) are just such translated files, preinstalled.

Assumptions & Scope

  • Scope: The three categories plus hierarchy cover classic Unix file system teaching. Module 2 will add the inode detail — per-file control structure with permissions, link counts, block pointers — that makes this hierarchy actually work on disk.
  • Assumption: Paths are absolute from /. Relative paths (./notes.txt) and links are useful shorthand but resolve to the same hierarchy.

Recap + Bridge: One abstraction (file = data + control structures) handles three realities — ordinary streams, directory maps, device portals — organized under a single root at / with /home as the per-user map; source texts and executables are both ordinary files, linked by translation. Bridge: you never touch files raw — you ask via commands interpreted by the shell. Next we meet that interpreter and learn to tell built-in commands from external programs by how the shell finds them.

1.10 Lab in Practice — 24x7 Cloud Host, SSH Bastion Workflow and User Management

1.10.1 The Lab You Will Use

A Linux machine has been installed in a cloud environment so work is in one place together. This machine is up 24 by 7. You can connect at any time of day or night. Absolutely no problem. Be professional: do not wander, delete or disturb the work of others. This host is shared. The image is Ubuntu for the inner lab, fronted by a CentOS bastion. That two-step shape is intentional.

Hook — why a shared 24×7 lab? You are working professionals with busy days and free nights. A lab that is only open 9–5 would waste the exact hours you have. A single always-on host you all share keeps data, assignment evaluation, and peer help in one place — no "it worked on my laptop" drift.

Lab shape — what "24×7 cloud host" means here:

  • One shared machine, always on — reachable at any hour; no lab booking.
  • Two-step architecture (intentional):
  • Front — CentOS bastion (the public IP you SSH to first) — a hardened entry point that authenticates and forwards.
  • Inner — Ubuntu VMs/containers per user (reached via connect.sh) — your personal Ubuntu environment where assignment work lives.

This is the industry bastion host pattern: one public address, many private machines behind it. You will see the same shape in cloud VPCs later.

Professional conduct — shared host, shared responsibility

  • Do not wander/delete/disturb others. ls /home shows every cohort member's directory — the visibility is for verification, not for exploration. Deleting or chmoding another user's home is a disciplinary and trust issue.
  • Treat /home listing as read-only observation. Peek to confirm your own creation; do not script against others' directories.

1.10.2 Tooling — PuTTY and Native SSH

In order to connect you need a tool like PuTTY. PuTTY is a small installed tool. Likewise there are many other tools that can give SSH connection to remote servers. You can also use SSH directly from the command line if you are on an Ubuntu machine where SSH is installed. Both paths reach the same host. If you have a local Linux you do not have to install inside the lab to practice locally, but doing work on the shared machine keeps all work together.

Real-world: PuTTY on Windows and on Linux or macOS both speak SSH to the same public endpoint. Choose what your station already has.

Two clients, one protocol (SSH):

Client Where you use it What you do
PuTTY Windows (or any OS where you install it) Install → Session → Host + Port + SSH → Appearance font tweaks → Open
Native ssh Ubuntu / macOS / WSL / Linux terminal where openssh-client is installed ssh centos@125.17.103.123 → password prompt → same host

Both speak SSH — the encrypted remote-login protocol that replaced Telnet — to port 22. Local practice on your own Linux is fine for learning commands, but assignment evaluation and shared verification happen on the cloud host, so keep graded work there.

Assumptions & Scope

  • Scope: SSH must be installed locally for the native path. On Ubuntu it usually is; on Windows use PuTTY or the built-in OpenSSH (ssh in PowerShell).
  • Assumption: Network allows outbound SSH (port 22). Corporate firewalls sometimes block it — try mobile hotspot as a diagnostic if PuTTY hangs at connect.

1.10.3 Step-by-Step Bastion Login

Address: public IP , port , protocol SSH.

Using PuTTY: install PuTTY, open session, paste the IP , set port and select SSH and click Open. For readability you may go to Appearance and change font size from 10 to 14 before opening. You will be prompted for a username. For the first machine — the bastion host — the username is and the password is — spoken as ADMIN at hash two zero two two, shown in class as and variants meaning the same account —. After login you will see a dollar prompt indicating a normal Bourne-family shell and you can type .

Using native SSH from Ubuntu: run . You will be asked for the password; give . You will see the same dollar prompt and you can type .

Expected outcome after on the bastion: you see as the script that bridges to the inner lab.

Exam note: The inner lab is not reached by repeating at the first prompt. at the first machine will not work. Use first, then bridge.

Worked Example — PuTTY bastion login, step by step

  1. Install PuTTY from its official site.
  2. Open PuTTY → Category Session → Host Name: 125.17.103.123, Port: 22, Connection type: SSH.
  3. Optional readability: Category Appearance → Font → set Size 14 (from default 10) → Back to Session.
  4. Click Open. Terminal appears → login as: → type centos → Enter.
  5. centos@125.17.103.123's password: → type ADMIN@#2022 (characters do not echo) → Enter.
  6. Prompt appears: [centos@bastion ~]\$ (a \$ — Bourne-family normal user).
  7. Type ls → output: connect.shbolded expected result. If you see connect.sh, the bastion is correct.

Worked Example — native SSH (Ubuntu/macOS/WSL) equivalent

ssh centos@125.17.103.123
# password: ADMIN@#2022
[centos@bastion ~]\$ ls
connect.sh

Sense-check: \$ confirms you are a normal user on a Bourne-family shell (see 1.9.2). connect.sh confirms you are on the bastion and ready to bridge.

Pitfalls — the "ubuntu at first prompt" trap

  • Wrong: ssh ubuntu@125.17.103.123 or PuTTY login ubuntuwill not work for the first machine. The bastion account is centos only.
  • Wrong: trying the inner password ubuntu at the bastion prompt → fails for same reason.
  • Right: first hop = centos + ADMIN@#2022 → then ./connect.sh <BITS_ID> + ubuntu.

The lecture flagged this confusion explicitly because students naturally guess ubuntu everywhere (the inner image is Ubuntu) — but the outer door is CentOS.

Q & A — Can I still use PuTTY on Ubuntu or must I use SSH?

Q: I am on Ubuntu. Can I still use PuTTY or must I use SSH?

A: You can use PuTTY on it or you can directly use SSH to connect to the same machine. If SSH is installed — which it usually is — you can run the command line ssh centos@125.17.103.123 and give the bastion password. Both tools get you to the same host. Use whichever your workstation already has — protocol matters, client brand does not.

1.10.4 Bridging to Your Personal Ubuntu with connect.sh

Once on the bastion you run followed by your BITS ID, for example or whatever your first part of mail ID or BITS ID is. Then you are asked for a password. For every user the password for this second step is written as U-B-U-N-T-U. After that you are logged in with your own username such as 502, 506, 510, 508, 515 or 520 and others up to the 529 range. The live demo showed 1, 2, 3, 4, 5 users logging in apart from the demo user, and counts like 5 users apart from me increasing as more joined. You will not see the same folder listing as the demo user because each account lands in its own home. From inside, experience shows you land in your own space.

Concrete detail: On the bastion, shows . Inside, after bridging, behavior differs per user because home is per-user. The shared pool shows contains entries like for the demo and through for the cohort.

Troubleshooting noted in class:

  • throwing error — Say what the error is. Example of confusion: trying for the bastion or forgetting to give the BITS ID as argument to . The fix is exactly plus your BITS ID, then password . Example given in class: style. Do not mix IDs.
  • Multiple tools confusion — Putty appearance versus SSH command line look different, but both end at the same dollar prompt and both lead to .

Real-world: Bastion hosts are common in industry. You SSH to a hardened entry point and from there reach internal machines. The pattern protects internal VMs while giving one public address.

Worked Example — bridging to personal Ubuntu (the two-hop pattern)

On the bastion after login as centos:

[centos@bastion ~]\$ ./connect.sh 502
Password: ubuntu          # literally type ubuntu, no echo
[502@lab ~]\$               # now your personal Ubuntu
[502@lab ~]\$ ls
# your own home contents — different from demo's ubuntu listing
[502@lab ~]\$ whoami
502

Other IDs from demo: 506, 508, 510, 515, 520 … up to 529 all followed the same pattern as more students joined — the who count grew from 1–2 to 5+ plus the demo.

Why IDs differ: /home shows entries ubuntu (demo) plus 502529 (cohort). Each connect.sh <ID> lands you in /home/<ID> (or that ID's home). So ls after bridging must differ per user — if two students see identical listings after bridging, one is still on the bastion.

Troubleshooting sense-check:

Symptom Cause Fix
./connect.sh: command not found or permission error Not on bastion, or missing ./, or missing BITS ID Ensure ./ prefix and pass ID: ./connect.sh 502
ssh: connect to host 125... port 22: Connection refused Firewall blocking 22 or typo in IP Check internet/firewall; verify 125.17.103.123 exact
Password fails at bastion with ubuntu Used inner password at outer door Use ADMIN@#2022 at bastion, ubuntu only after ./connect.sh

Visual intuition: a building lobby (bastion, guard asks for CentOS badge) → elevator script connect.sh that needs your room number (BITS ID) → private room (Ubuntu VM) where the key is always ubuntu. Lobby is shared; rooms are private. Takeaway: one public door, many private homes.

Assumptions & Scope

  • Scope: BITS ID here means the numeric/ID part of your mail/registration (e.g., 502). Use the exact ID issued — mixing IDs logs you into someone else's intended space or fails.
  • Assumption: Inner password ubuntu is uniform for the second hop for every user (U-B-U-N-T-U). Do not change it to your bastion password — they are separate stages.

1.10.5 User Accounting — Who Is Logged In

You can see who is logged in. Outputs mentioned include style lines. is pseudo terminal slave. The machine reported several pts entries as users joined. The command and family show this. Concrete recall: The demo saw entries for etc and a total that grew from one or two users to five plus.

  • who — all logged sessions with terminal, login time, and origin.
  • who am i / whoami — focused checks (full vs compact — detailed in 1.11.5).

The demo's count growing from 1–2 to 5+ illustrated concurrency: each new ./connect.sh <ID> creates a new pts/N line. You will use this to sanity-check "is anyone else on my account?" and to see your own pts number for write/mail tests later.

1.10.6 Managing Workspaces on the Host Side

If you are on a machine where you used or and logged in locally, those are different workspaces , with no IP address shown. Type to see them. To return to graphical interface press . If stuck, typing logs out of that text workspace, and rebooting will restore GUI if control-alt-f7 does not. In some keyboards you may need the Fn key plus F7.

TTY vs PTS — local consoles vs SSH pseudo terminals:

  • TTY2 / TTY3 (teletype) — local virtual consoles reached via Ctrl+Alt+F2/F3. who shows them with no IP because they are direct keyboard-and-screen logins on the physical host.
  • pts/N (pseudo terminal slave) — SSH-allocated terminals for remote users. who shows them with the connecting IP (e.g., internal 172.x or public 125.17.103.123 depending on NAT) because they arrived over the network.

Navigation habit: Ctrl+Alt+F2 to enter a text workspace, who to confirm you are on tty2, work, exit to logout, Ctrl+Alt+F7 (or Fn+F7) to return to graphical desktop. If F7 does not return, exit the text session and reboot — your GUI session is still managed by the display manager and will restart.

Recap + Bridge: Lab is a shared 24×7 two-step host — CentOS bastion at 125.17.103.123:22 (user centos / ADMIN@#2022ls shows connect.sh) then ./connect.sh <BITS_ID> / ubuntu to your Ubuntu home — with who/pts confirming concurrency and TTY vs PTS explaining local vs remote lines. Bridge: now that you can reliably reach your shell, next is what to type — the first commands and the verification rituals that prove you did them right.

1.11 First Commands in Action — date, cal, cat, passwd, who and Verification Rituals

1.11.1 date and cal — Time You Can Trust

The date command shows both date and time. The live example gave July 24, which was a Sunday, at 11:57:45 IST 2022. Run and you see the same style. This is fundamental and nothing deep to discuss except that it sources system date and time services that the kernel keeps.

The cal command shows the calendar for this month, neatly organized. In the demo it showed July 2022. You can customize:

  • or style? The demo used for current month and to mean month three — January February March — so prints March of the current year 2022. Adding a year such as prints March 1975. Similarly was used to find the day of birth: running shows the full calendar for 1975 and revealed that the demo birth month fell on a Wednesday. Combining month and year such as also prints March 1975. The options for month and for year combine: first parameter month, second parameter year.

Worked walk: Suppose you want March 1975 alone. You type . The system prints the March grid for 1975. If you want the whole year 1975, you type and you get twelve month grids that let you look up any day. Students used this to check a birth day and saw Wednesday.

Q: How do I view a calendar for a particular year and month together? A: Combine the options. shows this month. shows March of this year. or with month first and year second prints that month of that year. prints the entire year.

Hook — why start with time? date and cal are tiny, but they let you verify the two most basic kernel services (time and accounting) still live: if date is wrong by years, scheduling, logging, make, and certificate checks will all misbehave.

Formalizing date and cal — what they read and what flags mean:

  • date — kernel time service. Reads the kernel's maintained clock (wall time). No flags needed for the basic check; optional formatting (e.g., date +"%Y-%m-%d") exists but was not the lab focus. The demo string Sun Jul 24 11:57:45 IST 2022 has fields: weekday (Sun), month (Jul), day (24), h/m/s (11:57:45), zone (IST), year (2022). If your system shows UTC not IST, your zone is different — date is still correct, just zoned differently.
  • cal — month grids, with two selectors:
  • Bare cal → current month in neat columns Su–Sa (July 2022 in demo).
  • -m <month> → pick month of current year. Demo: cal -m 3 means month 3 = March of current year (2022), so March 2022. General: -m 1 = January … -m 12 = December.
  • -y <year> → pick a year. Demo: cal -y 1975 → all 12 months of 1975, used to find a Wednesday birth day.
  • Combining: first parameter is month, second is year. So cal 3 1975 and cal -m 3 1975 both mean March 1975 in the lab's flag style. cal -y 1975 and cal 1975 both mean whole year 1975 depending on cal version; the demo treated -y as the explicit year switch.

Note on flags vs traditional syntax: Classic BSD/Linux cal also accepts cal [month] [year] without -m/-y. The lab demo explicitly narrated -m and -y, so for this course match the professor's flags: use -m for month, -y for year, month first year second. When in doubt, try man cal on the lab — it shows the lab's exact variant.

Worked Example — date and cal as actually typed

1 — date (the most minimal useful command):

\$ date
Sun Jul 24 11:57:45 IST 2022

What happened: shell found external /bin/date, fork+exec'd it, date called kernel time service, printed weekday/month/day/time/zone/year. Bolded answer: Sun Jul 24 11:57:45 IST 2022 is the canonical demo output.

2 — cal variants (trace each):

\$ cal
     July 2022
Su Mo Tu We Th Fr Sa
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
...
\$ cal -m 3
     March 2022
Su Mo Tu We Th Fr Sa
       1  2  3  4  5
...
# month 3, with year defaulting to current (2022)
\$ cal 3 1975
     March 1975
Su Mo Tu We Th Fr Sa
                   1
 2  3  4  5  6  7  8
...
# month=3, year=1975
\$ cal -y 1975
                            1975
      January               February               March
Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa  Su Mo Tu We Th Fr Sa
          1  2  3  4                     1                     1
 5  6  7  8  9 10 11   2  3  4  5  6  7  8   2  3  4  5  6  7  8
...
# full 12-month wall; locate your birth date and read weekday → Wednesday for the demo

Sense-check: If cal 1975 on your local machine prints only year 1975 without -y, that is the same wall — the lab's -y is explicit. For exam answers, cite the lab's flagged forms: cal -m 3 (March current year), cal -m 3 1975 / cal 3 1975 (March 1975), cal -y 1975 (whole 1975).

Visual intuition: date is a single-line digital clock on the wall; cal is a paper desk calendar that can flip by month (-m) or unroll the whole year (-y) on one sheet. One-sentence takeaway: time is a kernel datum, calendars are filtered views of it.

Pitfalls

  • Mixing month/year order. First is month, second is year: cal 3 1975cal 1975 3. Swapping yields "year 3" nonsense or an error.
  • Assuming cal without flags always means this month on every OS. Some versions default to current month, others accept cal year for whole year — check man cal on the target host.
  • Forgetting time zone. Two correct date outputs can differ by IST vs UTC string yet be the same instant — zone matters when you compare.

Q & A — How to view a particular year and month together?

Q: How do I view a calendar for a particular year and month together?

A: Combine the options. cal shows this month. cal -m 3 shows March of this year. cal 3 1975 or cal -m 3 1975 with month first and year second prints that month of that year. cal -y 1975 prints the entire year. Students asked this because the lecturer first showed cal bare, then added -m, then added a year — the combined form is the natural generalization of that sequence.

1.11.2 Creating and Inspecting Users — adduser, /home and /etc/passwd

Create one or two users with . Only root or someone in the admin or root group can run it. So you use and you give a name such as ABC for temporary purpose. The command asks for your sudo password, then says adding user, creating a new group, adding the new user to this group, creating a home directory and copying files, then it asks to set an initial password and asks for full name details which you may skip with enter.

Verification — how to be sure the user really exists. Three checks were discussed, with a warning about the shallow one:

Check one — look at via . After creation you do and you see ABC among the entries alongside ubuntu and numeric IDs. This is quick but not conclusive.

Check two — try to log in. Try or as that user with its password and see that the login succeeds. That was praised as a good check.

Check three — inspect the password file. Use — spoken in class as slash etc slash password — to display the contents of the file. The password file holds one line per user. The last line after creation is the entry for the newly created user ABC and it shows its home. In class it was noted to use and you can see the last line is ABC with its home. For now you are asked to follow this by rote; what each field contains and all those file details will be learned later.

Exam note: When verifying a new user, know that creating a folder manually in with name ABC is not the same as creating a user. You can make by hand with mkdir, but will not have a line for it. So alone cannot prove a user exists. Use login or for the real proof.

adduser — what it does atomically, and why sudo is required:

  • Privileged operation: Only root or members of admin/root group may create users. On Ubuntu you therefore prefix with sudo and authenticate with your sudo password, not the new user's.
  • Steps inside one sudo adduser ABC run:
adding user `ABC' ...
adding new group `ABC' (1006) ...
adding new user `ABC' (1006) with group `ABC' ...
creating home directory `/home/ABC' ...
copying files from `/etc/skel' ...
New password: ******    ← you set initial password
Retype password: ******
Full Name []:           ← Enter to skip
Room Number []:         ← Enter
Work Phone []:          ← Enter
Home Phone []:          ← Enter
Other []:               ← Enter
Is the information correct? [Y/n] Y
  • Three verification rituals, in increasing strength:
Check Command What it proves Weakness
1. ls /homeABC appears with ubuntu and 190242501…529 Home directory exists Shallow — proves only a directory, not a user
2. Login test su ABC + password → prompt becomes ABC@...\$ User can authenticate and gets a shell Needs password; may mask passwd-file issues
3. passwd file cat /etc/passwd → last line is ABC:x:1006:1006:,,,:/home/ABC:/bin/bash style System account exists with home and shell Authoritative — but you must read it correctly

For now you are asked to follow check 3 by rote; Module 2 will decode each colon field (name, x shadow marker, UID, GID, GECOS, home, shell).

Worked Example — sudo adduser ABC end-to-end and three checks

Create:

\$ sudo adduser ABC
[sudo] password for 502: ******   # your own sudo password
Adding user `ABC' ...
...
Enter new UNIX password: ****
Retype new UNIX password: ****
# press Enter through Full Name prompts

Check 1 — shallow (quick peek):

\$ ls /home
ABC  ubuntu  190242501  190242502  ...  502 ... 529
# ABC appears → directory exists — does NOT yet prove user

Check 2 — good (login):

\$ su ABC
Password: ****
ABC@lab:~\$ whoami
ABC
ABC@lab:~\$ exit
# successful su proves account authenticates

Check 3 — authoritative (passwd file):

\$ cat /etc/passwd
...
ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash
502:x:1002:1002::/home/502:/bin/bash
ABC:x:1006:1006:,,,:/home/ABC:/bin/bash   ← **last line, proves user exists**

Bolded distinction: mkdir /home/ABC alone would make Check 1 pass (ABC in ls) but Checks 2 and 3 fail — no login, no passwd line. Therefore ls /home alone cannot prove a user exists; cat /etc/passwd and login can.

Sense-check: After creation, /home/ABC should be owned by ABC:ABCls -l /home | grep ABC should show that ownership, else the home was hand-made with wrong owner.

Assumptions & Scope

  • Scope: adduser (with interactive prompts) is the Debian/Ubuntu convenience wrapper. The bulk tools useradd/newusers are non-interactive and take file input — see next section.
  • Assumption: You have sudo rights in the lab. Without it, adduser fails with Permission denied — which is expected, not a bug.
  • What breaks: Pressing through prompts without setting a password leaves the account locked — login check will fail until you set it.

Pitfalls

  • Pressing Enter blindly through password prompts. The "Full Name … Other" fields are skippable; the password is not. Setting it empty or mistyping leads to a locked account that appears in /etc/passwd but cannot log in.
  • Believing ls /home is proof. This is the exact misconception the professor warned about — a hand-made folder passes ls but not cat /etc/passwd. Always do check 3 for proof.
  • Changing another user's home ownership after creation. sudo chown on /home/ABC to your own name breaks that user's ability to write cleanly — leave ownership as ABC.

1.11.3 Bulk Creation — From Single adduser to Many at Once

in the form sim1 sim2 sim3 pattern is for one or two users. For bulk creation there is also a command to create many users at once — discussed as useradd with a file, often called newusers in practice — where you give a text file whose lines are in a set format. Each line lists username, password, user id, group id, group to which the user belongs, path and shell which will open when the user logs in. You pass that file as argument and the command creates many users in no time. The demo noted create three users as example and said create three users when we create a user how do ... but did not execute the bulk path live. The key takeaway is that the file format plus or turns a thousand manual steps into one command.

Worked shape of the file, paraphrased from what was shown: each line in the text file has fields such as username, password, user id, group id, group assignment, home path and login shell. Feeding the file to the bulk command creates that many users without typing adduser a thousand times.

From one to many — why a file of users is the automation seam:

  • Single mode (adduser): interactive, one name at a time — fine for ABC, absurd for 1000.
  • Bulk mode (newusers / useradd with file): file-fed — you prepare a text file with one user per line, each line carrying the same fields the interactive prompt would have asked for:
# bulk_users.txt — one line per user, colon-separated fields
alice:passAlice:1007:1007:Alice:/home/alice:/bin/bash
bob:passBob:1008:1008:Bob:/home/bob:/bin/bash
carol:passCarol:1009:1009:Carol:/home/carol:/bin/bash
# fields: username : password : UID : GID : GECOS/group comment : home path : shell
  • Invocation (as narrated):
sudo newusers bulk_users.txt
# or, on some systems/labs: sudo useradd  ← with file-handling wrapper

The command reads each line, creates group, user, home, copies /etc/skel, and sets password — the same six steps as adduser, but looped over the file without retyping. One file + one command = thousands of accounts in seconds, the exact thousand-user automation from 1.1.2 realized at the OS level.

For now you are not required to memorize which flag spells newusers vs useradd file mode — know the pattern (file with username:password:uid:gid:group:path:shell → bulk command) and you will map the exact binary to man newusers on the lab.

Worked Example — three users via a bulk file (the demo's "create three" note, traced)

Input file three.txt:

alice:alice123:2010:2010:developers:/home/alice:/bin/bash
bob:bob123:2011:2011:developers:/home/bob:/bin/bash
carol:carol123:2012:2012:developers:/home/carol:/bin/bash

Run:

\$ cat three.txt
alice:alice123:2010:2010:developers:/home/alice:/bin/bash
...
\$ sudo newusers three.txt
\$ echo \$?
0   # success

Verify as in 1.11.2:

\$ ls /home
alice  bob  carol  ubuntu  190242501 ...
\$ cat /etc/passwd | grep -E "alice|bob|carol"
alice:x:2010:2010:developers:/home/alice:/bin/bash
bob:x:2011:2011:developers:/home/bob:/bin/bash
carol:x:2012:2012:developers:/home/carol:/bin/bash
\$ ls -ld /home/alice /home/bob /home/carol
drwxr-xr-x 2 alice alice ... /home/alice
...

Sense-check: wc -l three.txt = 3, grep -c "developers" /etc/passwd increases by 3, ls /home gains three entries — counts must agree. If ls gains 3 but /etc/passwd gains 0, the file format was wrong and homes were not users.

Scale-up: Replace 3 lines with 1000 — the same sudo newusers thousand.txt replaces 1000 adduser runs, exactly the admin time saver the thousand-user story promised.

Pitfalls

  • Wrong field order. username:password:uid:gid:... is order-sensitive. Swapping UID and GID creates users with wrong primary groups and broken permissions.
  • Plaintext password handling. Bulk files contain passwords — chmod the file 600, use it, then securely delete or vault it. Leaving bulk_users.txt world-readable leaks credentials.
  • Assuming interactive prompts appear. Bulk mode is non-interactive — no "Full Name []" pause. If you wait for a prompt, you will wait forever; check exit code and verify with cat /etc/passwd instead.

1.11.4 cat — Display, Create and Concatenate

The cat command is used to display contents of a file and can also create a file and concatenate two files. Short for concatenate. Use to see that file. Three uses mentioned: display contents of a file, create the file itself, and concatenate two files. Working example promised for next class. For now you saw revealing the last line as ABC entry.

cat — three verbs, one name:

  • Display: cat /etc/passwd → dump the file's byte stream to the terminal. This is what you used to prove ABC exists.
  • Create (via redirection + heredoc / >): cat > notes.txt then type lines, end with Ctrl+D → bytes you typed become notes.txt. Not an editor with cursor moves, but a quick way to create from the shell.
  • Concatenate: cat file1 file2 > combined → streams file1 then file2 into combined. The very name cat = concatenate — display is just concatenation of one file to the terminal stream.

When to use vs VI: cat for seeing and quick create/concat; VI (Module 3) for editing with navigation. The lecture flagged that a full cat create/concat workout is next class — for now you need only cat /etc/passwd as the verification read.

Worked Example — cat to verify ABC (the one line that matters)

\$ cat /etc/passwd | tail -n 5
ubuntu:x:1000:1000::/home/ubuntu:/bin/bash
502:x:1002:1002::/home/502:/bin/bash
529:x:1029:1029::/home/529:/bin/bash
ABC:x:1006:1006:,,,:/home/ABC:/bin/bash   # ← last line, proof

Preview of create/concat (next class):

\$ cat > hello.txt
first line
second line
Ctrl+D
\$ cat hello.txt
first line
second line
\$ echo "third" > extra.txt
\$ cat hello.txt extra.txt > combined.txt
\$ cat combined.txt
first line
second line
third

Sense-check: cat never changes a file unless you redirect (>). Bare cat file is read-only and safe to use for inspection.

1.11.5 who, whoami, who am i and pts

The family around shows who is logged in:

  • shows all logged sessions.
  • gives compact just the username.
  • gives an expanded line.
  • Output lines show for teletype terminal and for pseudo terminal slave. Because everyone connects through pseudo terminals to the virtual machine, you see , , and so on plus process ids for each remote logged in process. Example recalled: printing ubuntu for the demo user, while prints just the name, and printing more fields.

The difference in who output for local versus remote was highlighted: local TTY logins via show TTY3 with no IP, while SSH sessions show pts with the internal IP such as 172 dot something for the host and a public IP 125.17.103.123 seen externally.

Q: Why do I see two ubuntu entries in who output? A: One is the local user already logged in on that machine via the host itself. The other is you as a remote user who logged in through SSH. Who shows both. If you look at your own connection it may show 172 dot internal IP of the host, while public IP is different. The TTY line with no IP is the local console. That split explains the duplicate.

who family — three granularities:

  • who — everyone. Lists every logged session: name, terminal, login time, origin IP where available.
\$ who
ubuntu   tty3         2022-07-24 11:00   # local console, no IP (Ctrl+Alt+F3)
ubuntu   pts/0        2022-07-24 11:20  (172.31.5.10)  # remote SSH (internal IP shown)
502      pts/1        2022-07-24 11:25  (125.17.103.123)  # another remote
  • who am i — me, verbose. The same as who -m: only the terminal you are on, with all fields. Demo showed who am i printing ubuntu plus pts/0 plus (172.31.5.10) style address.
\$ who am i
502      pts/1        2022-07-24 11:25  (172.31.5.10)
  • whoami — me, compact. Just the bare username — same result as id -un, no terminal or IP. Useful in scripts when you only need the name.
\$ whoami
502

TTY vs PTS vs public IP (the duplicate-ubuntu explanation):

Line Meaning IP shown
ubuntu tty3 Local login on the machine's own console (Ctrl+Alt+F3) None — not a network login
ubuntu pts/0 (172.31.5.10) Remote login via SSH pseudo terminal — internal host IP seen after NAT Internal 172.x inside cloud VPC
Public 125.17.103.123 What you connected to from the internet — the bastion's public address Seen in SSH client, not always in who; the pts line may show the post-NAT internal peer

So two ubuntu lines = one local console + one remote SSH session — not a duplicate account. The split is visible precisely because who distinguishes tty (direct) from pts (network-allocated).

Bonus diagnostic: who's pts/N numbering grows as more users connect.sh — the demo's pts/2 etc and count 1→5+ is the live trace of concurrency from 1.10.

Q & A — Why two ubuntu entries?

Q: Why do I see two ubuntu entries in who output?

A: One is the local user already logged in on that machine via the host itself. The other is you as a remote user who logged in through SSH. who shows both. If you look at your own connection it may show 172 dot internal IP of the host, while public IP is different. The TTY line with no IP is the local console. That split explains the duplicate. Several learners saw this and worried they had created a duplicate user — you have not; you are seeing two sessions of the same account on two different terminal types.

Pitfalls

  • Treating who and whoami as aliases. who lists everyone; whoami lists only you compactly. who am i is the hybrid — only you, verbosely. Mixing them yields wrong output in scripts.
  • Reading pts as "process." pts = pseudo terminal slave (allocation for an SSH session), not a PID. PIDs are shown by other flags like who -u if needed.
  • Assuming public IP must appear in who. Inside a VPC, who may show the internal peer (172.x) post-NAT; the public 125.17.103.123 you dialed is the bastion's external face — both can be correct views of the same connection.

1.11.6 passwd and mail — Small Rituals with Real Effect

Change your own password with — spoken as P A S S W D at the prompt. It prompts first for current password — for every user that starts as ubuntu — then for new password, then re-enter new password. Keep the password simple so you do not forget, because forgotten passwords mean resets. You must choose a longer password; a short one was shown to be rejected. Do not change passwords for other accounts such as the centos or ubuntu service accounts. Change only your own and test by logging out with and logging again. logs out of the pseudo terminal session.

Mail between users was demoed: type to check mail, or to send, give subject such as hello, type body such as I am sending a mail, then press to finish. The demo saw permission denied and no mail for root and need to install mail, so the working of cat for display versus mail for messaging were kept separate.

Real-world: Changing your password immediately after first login and keeping it simple but longer than the minimum is a basic hygiene step that avoids lockouts for everyone.

Worked Example — passwd for your own account (the hygiene ritual)

\$ passwd
Changing password for 502.
Current password: ubuntu      # initial for every inner user
New password: myLab2022!      # must be longer — short is rejected, as demo showed
Retype new password: myLab2022!
passwd: password updated successfully

# Test it:
\$ exit               # logout of pts session
# reconnect: ssh/putty → centos → ./connect.sh 502 → password myLab2022! → success

Why "longer" matters: the lab enforces a length/complexity floor; a 3-character password was rejected in class. Choose something simple to recall but longer than the minimum — e.g., a phrase + digits — so you do not need a reset mid-assignment.

Do-not rule: change only your numeric-ID password. Changing centos or ubuntu service accounts breaks shared access for others.

mail — the companion demo (read vs write verbs):

# Check mail
\$ mail
No mail for 502

# Send mail
\$ mail 510
Subject: hello
I am sending a mail
Ctrl+D          # end-of-transmission, sends

# On 510's session:
\$ mail
From 502  Sun Jul 24 12:10  hello

The demo hit permission denied and no mail for root and noted need to install mail for full functionality — so mail was shown as a verb distinct from cat (which only displays files). Keep the roles separate: cat = read a file you name; mail = queue a message to a user.

Assumptions & Scope

  • Scope: passwd without arguments changes your user. sudo passwd ABC would target ABC — not what you should do to another student's home unless you are the admin.
  • Assumption: Initial password for the inner hop is ubuntu for every numeric ID. If your cohort uses a different bootstrap password, use that for current and then change.
  • What breaks: Forgetting the new password locks you out until an admin resets — which is why the professor said "keep it simple" within the longer-than-minimum constraint.

1.11.7 Lab Etiquette and What Comes Next

The Linux environment will be available 24 by 7. You can log in and continue work at any time. Keep three windows in mind: chat, presentation and the Linux interface. Next class will show the working of cat for creating and concatenating plus follow-on commands. For now practice date, cal, who family, ls on and the adduser verification ritual so you can feel the difference between a directory that happens to have the right name and a user that actually exists in .

Take-home practice checklist (do before next class):

  • Run date and cal variants until you can produce cal -m 3 1975 and cal -y 1975 without checking notes, and can explain the Wednesday find.
  • Run ls /homecat /etc/passwdsu ABC cycle to internalize why ls alone is not proof.
  • Run who, who am i, whoami and identify which line is you (pts/N vs ttyN, internal 172.x vs public 125.17.103.123).
  • Change your own password with passwd (longer than minimum), log out with exit, and log back in — hygiene verified.
  • Keep three windows: chat (doubts), presentation (lecture view), terminal (your hands on the system). Next class builds directly on the cat create/concat you have just previewed.

Exam note: For "verify a new user" or "why two ubuntu lines" questions, answer with the three-check chain and the tty vs pts + local vs remote table, not with one-line ls alone. Connections: 1.8 (hierarchy) → 1.10 (where /home lives) → 1.11.2 (verification) → Module 2 preview (inode fields behind /etc/passwd).

Exam Guidance Summary

How evaluation weighs and what it covers:

  • *EC1 — quizzes + assignment — higher than EC2 alone. Quiz 1 + Quiz 2 + Assignment (lab-mapped). Multiple choice, open for 2–3 days window, single timed attempt, no retake* — dates announced well in advance. This is your highest-leverage steady work.
  • EC2 — midterm, 30 marks, open book, online. Covers topics up to midterm (progressive syllabus). Because it is open book, expect application and trace questions, not pure recall.
  • EC3 — end semester, 40%, open book, online. Covers all topics in all modules — every concept from 1.1 to 1.11 is EC3-relevant.

Assignment (20%, separate anchor): Maps directly to the lab component across the 10–11 contact sessions. Group of 2–3 members (you form groups; size confirmed shortly). Task is somewhat complex, like lab exercises — not a one-liner. After submission you present your solution. Originality is strictly enforced — changing colors or variable names does not make code different; underlying structure that is identical is treated as copying and receives zero marks plus penalty.

Quiz mechanics to remember: Window (2–3 days you can start) ≠ duration (one sitting once started). Window is intentionally larger than a narrow 9:00–9:30 pm slot so working professionals can choose. Start early in the window; a last-hour start with network issues has no second chance. Dates for Quiz 1, Quiz 2, and assignment are announced well in advance.

Pitfalls

  • Treating open book as open understanding. Open book lets you look up flags, but you still need to know which command and why — the paper will assume the book is beside you.
  • Missing deadlines. Enough time is given, but not slack time — once a deadline is set, submit on it. The professor explicitly tied timely submission to professional intention after choosing the program.
  • Free-riding in groups. Presentation exposes who understood the script. A member who cannot walk through loop, branch, and error handling will be visible even if the script runs.

Exam strategy distilled:

  • For EC1 questions: answer with components + window + attempt rule + advance notice.
  • For assignment questions: answer with 20% + lab-mapped + 10–11 sessions + group 2–3 + presentation + originality + strict deadlines.
  • For EC2/EC3: answer with 30 marks open book up to midterm vs 40% full syllabus, noting every module is examinable for EC3.
  • Study leverage: do the lab every session — assignment and quizzes reward the same hands-on trace you will repeat in the final. Keep notes searchable for open-book speed, not as an unread pile.

Key Industry Applications

Automation that replaces days of hand work:

  • Thousand users from a text file → one script, minutes. User data kept as username:password:uid:gid:group:path:shell lines (one per user, e.g., alice:pass:1001:1001::/home/alice:/bin/bash) fed to newusers/useradd bulk mode; the script loops while read, creates user+group+home, sets password, assigns roles/permissions. At 30 s per hand-made user, 1000 users cost ~8 hours typing; the script costs under a minute and is auditable via cat /etc/passwd and ls /home. This is the core assignment skill.
  • Full cloud stack install → one OpenStack script on a laptop or bare metal. A single script checks prerequisites, installs database/message-queue/hypervisor hooks, configures networking, starts daemons, verifies — dozens of apt, mkdir, chown, systemctl, and config edits collapsed into one repeatable run. The same machine with good configuration can host the stack locally, exactly as the lecture demo described.

Infrastructure note: Ansible and Chef are declarative infrastructure builders that also automate at scale. The lecture did not rank them against shell scripting — only to show that shell already does its job beautifully for the tasks you will face, and heavier tools rest on the same underlying commands.

System internals that make execution possible:

  • System calls from simple C. Tiny C programs (fork(), exec(), open()) that focus on kernel transition, not on C engineering — you write one file, a few calls, and observe the process image (code/data/stack/heap) the loader placed in RAM.
  • Drivers as the only hardware movers. CPU, memory, buses are driven only by device drivers, coordinated by the kernel. That is why linker/loader/OS interaction is needed to promote a file (program) to a process — the loader coordinates driver placement, not the compiler alone.

Unix strengths you will use daily:

  • Portability — Apple M1 ARM as proof. Unix/Linux with small machine-dependent changes runs on x86 and on ARM (M1) because the kernel is in C — the 1973 rewrite dividend from 1.6.
  • Server prevalence — 70–75% of servers on Linux/Unix. Speed, efficiency, standardization, and immediate tool availability (compilers, grep, FTP/SSH/Telnet) keep this share high — the ecosystem you practice on is the ecosystem that runs production.

Distributions as curated toolchains:

  • General — Debian, Fedora, Ubuntu, CentOS: same kernel heritage, different packaging and release trade-offs.
  • Specialist — Kali Linux, Parrot OS (+ 10–15 more popular): pre-bundled security testing, hacking, and vulnerability tooling so testers start with the right tools, not an empty box.

Remote-access pattern you now operate:

  • Bastion host — 125.17.103.123:22, centos / ADMIN@#2022./connect.sh <BITS_ID> / ubuntu. One public IP, SSH (PuTTY or native ssh), two-hop to per-user Ubuntu homes. Industry VPCs use the same entry-point shape to protect internal VMs while exposing one address.

Everyday admin commands that prove control:

  • date (Sun Jul 24 11:57:45 IST 2022) and cal (cal, cal -m 3, cal 3 1975, cal -y 1975 → Wednesday) — kernel time service and calendar views you will run before any log inspection.
  • cat /etc/passwd and ls /home — the verification pair — with who/whoami/who am i and pts vs tty distinguishing local console from SSH sessions and exposing the 172.x internal vs 125.17.103.123 public address split. These are not toy examples; they are the exact checks a junior admin runs after creating an account.

Mobile anchor: the phone in your hand — Android built on the Linux kernel — is the most familiar proof that portability and customization (custom user space on a Linux kernel) scale from server to pocket.

SP Lecture 1 notes · Introduction to Systems Programming

Systems Programming· postgraduate· 2026-08-20

Sections Breakdown

1Course Roadmap — Six Interlinked Modules, Objectives and Learning Outcomes

Foundational course spanning six linked modules from Linux basics to loader, with objectives framed as durable capabilities.

2Textbooks, References and How to Use Them

Three core books (K&R, Das, Blum/Bresnahan) plus selective handout references, studied breadth-first then depth-first.

3Evaluation Architecture and Assignment Integrity

EC1 quizzes+assignment > EC2 (30 marks) individually; EC3 40% full syllabus; quizzes MCQ 2-3 day single attempt; assignment 20% group 2-3 with presentation and strict originality.

4Computing Foundations — PSM, Control and the Software Stack

Computer does Processing-Storing-Moving plus Control to order shared buses; application vs system software divide places translators and OS in narrow mediator layer.

5Translators in Depth — Compiler, Assembler, Linker and Loader

Compiler/assembler translate; linker resolves symbols across objects; loader places image in memory with OS/drivers to change program state to process.

6Unix and Linux — History, Architecture and Kernel Services

Unix 1969 Thompson/Ritchie/McIlroy, 1973 C rewrite; Linux successor Stallman/Torvalds; four-layer diagram shell→kernel→hardware; kernel is system software module with bootstrap and six services.

7Defining Unix Strengths — Multiprogramming, Time Sharing, Portability, Modularity, Security and More

Multiprogramming/multi-user/time sharing (6x10s/60s round robin felt parallelism) vs multitasking/multithreading; portability via C and M1 ARM; modularity/security/device independence/Zenith story; openness Wi-Fi6 speed and Android; distributions Debian/Fedora/Ubuntu/CentOS/Kali/Parrot.

8The File Principle — Everything Is a File, Types and Hierarchical Layout

Everything is file (data+control via inode) uniformly; three categories ordinary/directory/device (block vs character); hierarchy rooted at / with /bin /boot /dev /home /usr and per-user homes.

9Commands Demystified — Shell, Prompts, Internal Versus External and Path Search

Shell literal interpreter read-parse-expand-locate-execute; prompts $ Bourne-family % C-family # root and PATH search; commands as single-purpose C programs; internal (no search echo/pwd) vs external (search grep/cat).

10Lab in Practice — 24x7 Cloud Host, SSH Bastion Workflow and User Management

Shared 24x7 two-step lab CentOS bastion 125.17.103.123:22 centos/ADMIN then ./connect.sh BITS_ID/ubuntu to per-user Ubuntu; PuTTY vs native ssh; who/pts/TTY workspace management.

11First Commands in Action — date, cal, cat, passwd, who and Verification Rituals

Hands-on date (Sun Jul 24 11:57:45 IST 2022) cal variants -m3 1975 -y1975; sudo adduser ABC and three verification checks ls/home vs login vs cat /etc/passwd (authoritative) plus bulk newusers file format; cat display/create/concatenate; who/whoami/who am i pts vs tty; passwd mail rituals.

12Exam Guidance Summary

Appendix consolidating EC1/EC2/EC3 weights, quiz mechanics, assignment group/presentation/originality, and deadline discipline.

13Key Industry Applications

Appendix mapping course concepts to industry uses: bulk user automation, OpenStack install, system-call tracing, driver model, M1 portability, 70-75% server share, distributions, bastion pattern, daily admin commands and Android.

Postgraduate students in Systems Programming

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

Course Roadmap — Six Interlinked Modules, Objectives and Learning Outcomes

Must-know: Six modules in order and that Module 4 shell scripting is most important and lab-mapped; assignment is scripting-heavy.

Top pitfall: Treating modules as independent — they are linked; skipping basics breaks scripting and later loader understanding.

Self-check: Name the six modules and explain why Module 4 ties them together with the thousand-user example.

Connects to: 1.3, 1.10

Textbooks, References and How to Use Them

Must-know: Core three textbooks and their distinct roles; breadth-first overview then depth-first on scripting and file system.

Top pitfall: Chasing random PDFs with mismatched editions instead of annotated hard copies.

Self-check: When would you open K&R versus Blum/Bresnahan for a shell scripting doubt?

Connects to: 1.1, 1.3

Evaluation Architecture and Assignment Integrity

Must-know: EC1 (quizzes+20% assignment) > EC2 alone; EC2 30 open book; EC3 40% full syllabus; quiz 2-3 day window single timed attempt; assignment group 2-3 with presentation; zero for copying.

Top pitfall: Assuming multiple quiz attempts or that changing colors hides copying — zero is the penalty.

Self-check: What is the quiz window vs duration and what happens on second attempt?

Connects to: 1.1, 1.10

Computing Foundations — PSM, Control and the Software Stack

Must-know: PSM plus Control with single bus constraint; system vs application boundary; compiler target is machine language not middle language.

Top pitfall: Calling compiler target middle-level language or thinking machine instructions are unlimited.

Self-check: Why cannot a single-cycle machine do a read and write on the same data lines without control?

Connects to: 1.5, 1.6

Translators in Depth — Compiler, Assembler, Linker and Loader

Must-know: Translate (compiler/assembler) vs stitch (linker) vs place (loader with OS); only drivers drive hardware; linker/loader make program into process.

Top pitfall: Saying assembler makes program run — linker/loader do; assembler alone only translates mnemonics.

Self-check: Which stage would fail with undefined symbol and which makes a file runnable in memory?

Connects to: 1.4, 1.6

Unix and Linux — History, Architecture and Kernel Services

Must-know: 1969 creation, 1973 C rewrite portability watershed, Stallman/Torvalds; shell vs kernel roles; kernel is system software; bootstrap loads OS to RAM; six kernel services.

Top pitfall: Claiming kernel is neither system nor application — it is system software as OS module.

Self-check: What does bootstrap do on power-up before kernel runs?

Connects to: 1.7, 1.8

Defining Unix Strengths — Multiprogramming, Time Sharing, Portability, Modularity, Security and More

Must-know: 60s/6 processes 10s quantum round robin felt parallelism not true parallelism; multiprogramming vs time sharing vs multitasking vs multithreading; portability C->M1; Zenith 8-9 installs; Wi-Fi6 vendor module speed.

Top pitfall: Equating time sharing with multithreading or claiming 8085 can host 1000 remote users seamlessly.

Self-check: With 6 processes and 60s window, how much CPU does each get per cycle and why is it not true parallelism on one CPU?

Connects to: 1.6, 1.8

The File Principle — Everything Is a File, Types and Hierarchical Layout

Must-know: Everything is file as data+inode control; ordinary vs directory vs block/character device; hierarchy / with per-user /home; source texts and executables both ordinary files.

Top pitfall: Treating directory as byte bucket with cat or thinking mkdir /home/ABC equals creating a user.

Self-check: Why can the same chmod apply to a document and a printer device?

Connects to: 1.9, 1.11

Commands Demystified — Shell, Prompts, Internal Versus External and Path Search

Must-know: Shell is literal interpreter DAT vs CAT; prompts $/%/# mapping; PATH search order; internal echo pwd no search vs external cat grep with fork+exec; type/which test.

Top pitfall: Assuming built-in list is fixed or ignoring PATH order that shadows binaries.

Self-check: How does shell decide internal vs external and why must cd be internal?

Connects to: 1.10, 1.11

Lab in Practice — 24x7 Cloud Host, SSH Bastion Workflow and User Management

Must-know: Bastion 125.17.103.123:22 centos ADMIN@#2022 then ./connect.sh <ID> ubuntu; ubuntu at first prompt fails; PuTTY vs ssh same protocol; pts vs tty.

Top pitfall: Using ubuntu at bastion login or forgetting BITS ID argument to connect.sh.

Self-check: What two hops and two credential pairs reach your Ubuntu home and what does ls show on bastion vs inside?

Connects to: 1.9, 1.11

First Commands in Action — date, cal, cat, passwd, who and Verification Rituals

Must-know: date IST 2022; cal -m3 = March current year, cal 3 1975 and cal -y 1975; adduser sudo steps + ls/home not proof vs su and cat /etc/passwd proof; bulk file username:password:uid:gid:group:path:shell; cat three uses; who vs whoami vs who am i pts pseudo slave vs tty; passwd longer simple password.

Top pitfall: Relying on ls /home alone to prove user exists; swapping cal month/year order; using short rejected passwd.

Self-check: Show three commands that prove ABC user exists and explain why mkdir /home/ABC fails two of them.

Connects to: 1.8, 1.10

Exam Guidance Summary

Must-know: EC1 > EC2 alone; EC2 30 open book; EC3 40% full syllabus; quiz MCQ 2-3 day single attempt; assignment 20% group 2-3 + presentation + zero for copy.

Top pitfall: Treating open book as no preparation needed.

Self-check: Outline EC1/EC2/EC3 with marks and coverage in one paragraph.

Connects to: 1.3

Key Industry Applications

Must-know: Thousand-user script, OpenStack single script, Ansible/Chef comparison point, simple C for system calls, driver-only hardware access, M1 portability, server share, Kali/Parrot, bastion 125.17.103.123, Android on Linux kernel.

Top pitfall: Listing applications without linking to course technique that enables them.

Self-check: Name two industry automation cases and which shell scripting pattern enables each.

Connects to: 1.1, 1.7

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.