Introduction

An operating system (OS) is software that manages computer hardware and software resources. It provides services for programs and acts as a bridge between users and hardware. Understanding the basics of operating systems is important for both students and professionals. This cheatsheet covers the most essential concepts in simple language, accompanied by concise examples.

1. Types of Operating Systems

2. Functions of OS

3. Process and Threads

Key Point: Threads share memory of the process, but processes do not share memory by default.

4. Process States

5. Scheduling Algorithms

Decides which process runs on the CPU.

Example (Round Robin with 2 sec time quantum)

  
    P1 (5s), P2 (3s), P3 (1s)
Order: P1→P2→P3→P1→P2→P1
  

6. Inter-Process Communication (IPC)

Processes exchange data using:

Example (Pipe in Linux)

  
    ls | grep file
  

7. Deadlock

When processes wait forever for resources. Conditions for deadlock,

  1. Mutual Exclusion

  2. Hold and Wait

  3. No Preemption

  4. Circular Wait

Prevention: Avoid the conditions mentioned above.

8. Memory Management

Example (Page table entry)

  
    Logical Address → Page Number + Offset → Physical Frame
  

9. File System Concepts

Example (Linux commands)

  
    ls        # list files
cat file  # show file content
  

10. Input/Output Management

11. Security and Protection

Example (Linux file permission)

  
    chmod 755 file.txt
  

12. System Calls

Interface between programs and OS.

Categories

Example in C (creating a process)

  
    #include <unistd.h>
int main() {
    fork();
    return 0;
}
  

13. Virtualization

Running multiple OS on one machine using hypervisors.

14. Real-Time Systems

Used in robotics, medical equipment, and aircraft systems.

Conclusion

Operating systems are the foundation of computer systems. They manage hardware, processes, memory, files, and security while making computers user-friendly. This cheatsheet covered essential concepts like processes, memory, scheduling, file systems, deadlock, and system calls. Having a clear understanding of these basics is necessary for interviews, exams, and real-world system design.