EXAMPLES10 MIN READUPDATED Jun 4, 2026

OS LAB PROGRAMS: 20 COMMON PRACTICALS

The 20 OS practicals that show up most often in undergraduate lab manuals. Each has the algorithm, sample input, and expected output.

T

The Assignment Bot Team

Jun 4, 2026 · Editorial

Operating System lab manuals usually cover scheduling algorithms, page replacement, deadlock handling, and memory management. These 20 programs are the ones most Indian university syllabi (AKTU, VTU, Anna University, Mumbai, etc.) prescribe.

CPU Scheduling Algorithms

1. FCFS (First Come First Serve)

Algorithm: Execute processes in order of arrival. Compute waiting time and turnaround time for each.

cppCODE
#include <iostream>
using namespace std;

int main() {
    int n;
    cout << "Enter number of processes: ";
    cin >> n;
    int at[20], bt[20], wt[20], tat[20];

    cout << "Enter arrival and burst times:\n";
    for (int i = 0; i < n; i++) cin >> at[i] >> bt[i];

    wt[0] = 0;
    for (int i = 1; i < n; i++) wt[i] = wt[i - 1] + bt[i - 1];
    for (int i = 0; i < n; i++) tat[i] = wt[i] + bt[i];

    cout << "P\tAT\tBT\tWT\tTAT\n";
    for (int i = 0; i < n; i++)
        cout << i + 1 << "\t" << at[i] << "\t" << bt[i] << "\t" << wt[i] << "\t" << tat[i] << "\n";
    return 0;
}

2. SJF (Shortest Job First) — Non-Preemptive

Algorithm: Pick the process with the smallest burst time among those that have arrived.

3. Priority Scheduling — Non-Preemptive

Algorithm: Pick the process with the highest priority (lowest priority number) among those that have arrived.

4. Round Robin Scheduling

Algorithm: Each process gets a fixed time quantum. After the quantum, the process is moved to the back of the ready queue.

Page Replacement Algorithms

5. FIFO Page Replacement

Algorithm: Replace the oldest page in memory when a new page is requested and memory is full.

6. LRU (Least Recently Used) Page Replacement

Algorithm: Replace the page that has not been used for the longest time.

7. Optimal Page Replacement

Algorithm: Replace the page that will not be used for the longest time in the future. Theoretically optimal, but requires future knowledge.

Deadlock and Banker's Algorithm

8. Banker's Algorithm — Safety Algorithm

Algorithm: Given the maximum resource need of each process, the current allocation, and the available resources, determine if the system is in a safe state.

9. Banker's Algorithm — Resource Request

Algorithm: When a process requests resources, simulate the allocation and run the safety algorithm to check if the resulting state is still safe.

Disk Scheduling

10. FCFS Disk Scheduling

11. SSTF (Shortest Seek Time First) Disk Scheduling

12. SCAN (Elevator) Disk Scheduling

13. C-SCAN Disk Scheduling

Memory Management

14. MVT (Multiprogramming with Variable Tasks)

15. MFT (Multiprogramming with Fixed Tasks)

16. Paging — Address Translation

Process Synchronization

17. Producer-Consumer Problem

18. Reader-Writer Problem

19. Dining Philosophers Problem

20. Deadlock Detection (Wait-For Graph)

How to Build the OS Lab File

Most OS lab files require 8-10 of the above programs, each in its own lab report. Plan a cover page, table of contents, and one report per program. Use the same format (font, heading style, code font) across all reports — evaluators grade presentation as well as correctness.

Generating an OS lab file?

Assignment Bot writes the Aim, Theory, Algorithm, and Conclusion sections for any OS program. Upload your brief, get a formatted DOCX in 10 minutes.

ABOUT THE AUTHOR

The Assignment Bot TeamWe test, write, and ship practical guides for CS students who want to spend less time formatting and more time learning.

READY TO SHIP YOUR LAB REPORT?

Skip the formatting. Upload your brief, get a complete, submit-ready DOCX in 10 minutes. First assignment is free.