Operating Systems

Instructor

Dr. Janibul Bashir

Course Overview

In this course, we will understand the conceptual pieces that are fundamental to operating systems: virtualization, concurrency, and persistence. In understanding the details, you will also learn the practical, including how an operating system does things like schedule the CPU, manage memory, and store files persistently. 

Course Code

ITT250

Lectures

PF3 (HiTech 4)

Pre-Requisites: Knowledge of C Programming (Refer to HeadFirst C Book).

Reference Material for the course:

Text Book (TB):  Operating System Concepts by A. Silberschatz, P. B. Galvin and G. Gagne (Sixth Edition)

Book For OS Programming (P1): Programming in C by A.D. Marshall [html]

Reference (R): Operating Systems (Three easy pieces) by Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau.

Video Lectures: Operating System by Prof. Sourav Bansal [Videos]

Announcements:

Course Content

Introduction (TB-Chapter 1, 2, R2-Chapter 2) 

(09-03-2023) -- [Lecture 1] Introduction to Operating Systems, Course Structure

(09-03-2023) -- [Lecture 2] CPU and Memory Virtualisation, Concurrency, and Persistance

(16-03-2023) -- [Lecture 3] OS Goals and evolution of an OS from a library file to a resource manager.

System Calls (TB-Chapter 3, 4, R2-Chapter 4, 5, Video: L1,L2,L3) 

(16-03-2023) -- [Lecture 4] Introduction to system calls, System calls for processor manipulation, System calls for file manipulation.

(17-03-2023) -- [Lecture 5] Interprocess communication (IPC): shared memory (system calls), message passing.

(17-03-2023) -- [Lecture 6] IPC via pipes(), signals and signal handlers.

Processes (TB-Chapter 4, R2-Chapter 6, 13, 14 Video: L4,L5,L6) 

(23-03-2023) -- [Lecture 7] PC Architecture (x86), Physical Address Space, Compilation Flow -  Reference

(23-03-2023) -- [Lecture 8] Process structure in memory, Address space of a process, Use of Stack, Stack pointer, and Frame Pointer 

(24-03-2023) -- [Lecture 9] Address space of a process: Virtualizing Memory - Single process vs multiple processes. 

(24-03-2023) -- [Lecture 10] How to run processes efficiently: Limited direct execution, Implementation of a system call

(30-03-2023) -- [Lecture 11] Context Switch Implementation, Kernel Stacks

Segmentation (TB-Chapter 8, R2-Chapter 14, 15, 16 Video: L6,L7,L8,L9) 

(31-03-2023) -- [Lecture 12] Virtual Memory Implementation using Process Approach.

(31-03-2023) -- [Lecture 13] Virtual memory implementation using Segmentation

(05-04-2023) -- [Lecture 14] Implementation of Segmentation, Segment registers, GDT, IDT, Context Switch

(06-04-2023) -- [Lecture 15] Free Space Management, Segmentation Issues

Paging (TB-Chapter 8 - 9, R2-Chapter 18 - 23 Video: L10-L15, L29-L30) 

(06-04-2023) -- [Lecture 16] Virtual Memory implementation using Paging, Page Tables

(13-04-2023) -- QUIZ 1

(13-04-2023) -- [Lecture 17] Paging Implementation in Real Systems

(14-04-2023) -- [Lecture 18] Paging Issues: Translation Lookaside Buffer

(20-04-2023) -- [Lecture 19] Paging Issues: MultiLevel Page Table

(20-04-2023) -- [Lecture 20] Large Page Size, Inverted Page Tables

(27-04-2023) -- [Lecture 21] Beyond Physical Memory - Swap Space, Page Replacement Policies

(27-04-2023) -- [Lecture 22] Thrashing, Prepaging, Copy-on-write, Demand Paging, TLB reach

Operating System Scheduling (TB-Chapter 5, R2-Chapter 7, 8, 9, 10 Video: L37)

(28-04-2023) -- [Lecture 23] Operating system scheduling, Scheduling policies.

(28-04-2023) -- [Lecture 24] Multi-level Feedback Queue scheduling, Multiprocessor Scheduling (H/W: O(1), CFS, and BFS schedulars)

                         All the best for the midterm

Concurrency: Threads and Synchronisation (TB-Chapter 4,6,7, R2-Chapter 26 - 33 Video: L20-L28) 

(12-05-2023) -- [Lecture 25] Introduction to Threads, PThread APIs.

(12-05-2023) -- [Lecture 26] Synchronization problem in threads: Critical Section Problem, Atomiticity and Use of Locks

(18-05-2023) -- [Lecture 27] Hardware Primitives: testandset, compareandexchange, fetchandadd.

(18-05-2023) -- [Lecture 28] Condition Variables: producer-consumer problem.

(19-05-2023) -- [Lecture 29] Semaphores, Reader Writer Lock

(23-05-2023) -- [Lecture 30] Concurrency Bugs: Deadlocks and their prevention

(23-05-2023) -- [Lecture 31] Deadlock Avoidance using Safe State Mechanism (Bankers Algorithm)

(24-05-2023) -- [Lecture 32] Practice questions related to paging and scheduling

(24-05-2023) -- [Lecture 33] Practice questions related to locks, semaphores and Bankers Algorithm

Persistance: Input/Output, Hard Disk Drives, RAIDS (TB-Chapter 10, 13, R2-Chapter 36 - 38 Video: L31) 

(30-05-2023) -- [Lecture 34] Interfacing Input output devices, Polling and interrupts.

(30-05-2023) -- [Lecture 35] CPU Programmed I/O vs DMA, Peripheral Mapped vs Memory Mapped I/O, Device Drivers. 

(31-05-2023) -- [Lecture 36] Hard Disk Drives and their Geometry, Seek time, Rotational Delay, and Disk Scheduling.

(31-05-2023) -- [Lecture 37] Disk Management: Disk formatting, bad blocks (sector sparing or forwarding, sector spilling), boot sector, RAIDs

File System and its Implementation (TB-Chapter 11, 12, R2-Chapter 39 - 42 Video: L32 - L35) 

(06-06-2023) -- [Lecture 38] File System Interface - Accessing files, File and Directory structure.

(06-06-2023) -- [Lecture 39] File System Implementation: Disk block allocation, Free Space Management.

(07-06-2023) -- [Lecture 40] Very Simple File System and Fast File System.

(07-06-2023) -- [Lecture 41] Reliability in FS: FSCK and Journalling.

Remedial Classes

Assignments

Assignment 1: [Due Date 01-04-2023]

Part 1: -- Explore the source code of Linux Kernel (or FreeBSD)

    Build a kernel to create an ISO file  >  Install the OS on your system

Part 2: --  Add a new system call and a signal Handler to your OS.

    Add a system call to the OS Kernel

                            Build and Install the Kernel

       Use the system call in the user program 

Assignment 2: [Due Date 01-04-2023]  

Run the xv6 system on top of QEMU and explore its source code. Understand the shell program of xv6.

Assignment 3: 

Explore the source code of xv6 and understand the locking mechanism implemented. Implement any lock in the kernel of the xv6 and check its working as well.

Assignment 4:

Simulate any file system of your choice.