# What is an Operating System and what are its main functions?

> What is an operating system? Explain its main functions and why we need one.

Canonical: https://www.internhack.in/learn/interview/operating-systems-interview/os-what-is-an-operating-system
Last updated: 2026-11-28

Difficulty: Beginner

## Question

What is an operating system? Explain its main functions and why we need one.

## Answer

Let's start with the question that opens almost every OS round, because a crisp answer here sets the tone for everything that follows. Think of an operating system as the manager of a busy restaurant kitchen. The hardware (CPU, memory, disk, network card) is the kitchen equipment, the applications are the cooks, and without a manager everyone would fight over the same stove, overwrite each other's ingredients, and burn the place down. The OS is the software layer that sits between applications and hardware and makes sure everyone gets what they need safely and fairly.

The definition interviewers like is that an OS does two jobs. First, it is a resource manager: it allocates and reclaims the CPU, memory, storage and I/O devices among competing programs. Second, it is an extended machine, meaning it hides ugly hardware details behind clean abstractions. You call open() and read() on a file; you never think about disk sectors, controller registers or interrupt lines. A process abstracts the CPU, virtual memory abstracts RAM, a file abstracts a disk block, and a socket abstracts a network card.

The main functions map neatly onto these abstractions. Process management covers creating and terminating processes, scheduling them on the CPU, and providing synchronization and communication. Memory management tracks which memory is used by whom, allocates and frees it, and provides virtual memory so that programs can be larger than physical RAM and are isolated from each other. File system management provides files and directories, permissions, and the mapping from names to disk blocks. Device management uses drivers, buffering and interrupts to talk to hardware. Protection and security ensures one user or process cannot read or corrupt another's data. Finally there is the user interface, which can be a shell (CLI) or a GUI, and accounting or logging of resource usage.

It also helps to classify operating systems, since it is a frequent follow-up. A batch system runs jobs one after another without user interaction. A multiprogramming system keeps several jobs in memory so the CPU never sits idle during I/O. A time-sharing or multitasking system switches rapidly between jobs so each user feels they own the machine. A real-time OS guarantees a response within a deadline, and is used in cars, medical devices and, relevant for Samsung and Qualcomm interviews, embedded firmware. Distributed and network operating systems coordinate multiple machines.

A point that impresses interviewers is distinguishing the OS from the kernel. The kernel is the always-resident core that runs in privileged mode and implements the functions above. The complete OS distribution also includes system libraries, shells, compilers, utilities and GUI toolkits. Linux is strictly a kernel; Ubuntu is an operating system built around it. Saying this shows you understand the layering rather than repeating a textbook line.

Finally, be ready for why we need an OS at all. Without it each program would need to include its own device drivers, could monopolize the CPU, and could scribble over other programs' memory. The OS gives convenience (easy APIs), efficiency (high CPU and device utilization), and safety (isolation between programs). If you can say that in your own words within a minute, you have already earned the first easy marks of the round.

## Key points

- The OS is both a resource manager and an extended machine (abstraction provider).
- Kernel is the privileged core; the OS also includes libraries, shell and utilities.
- Multiprogramming increases CPU utilization; time-sharing improves interactivity.
- Real-time OS is about predictable deadlines, not raw speed.
- Hard real-time misses are failures; soft real-time misses only degrade quality.

## Common follow-up questions

- What is the difference between multiprogramming, multitasking and multiprocessing?
- What is the difference between a hard and a soft real-time system?
- Is a shell part of the kernel?

## Interview tips

- Lead with the two roles (resource manager and abstraction) before listing functions.
- Mention the OS versus kernel distinction unprompted; it signals depth.
- Give one real example per function, such as scheduler for process management and page tables for memory.

## Concepts covered

OS basics, resource management, abstraction, kernel

Next: [Explain kernel mode vs user mode and how system calls work](https://www.internhack.in/learn/interview/operating-systems-interview/os-kernel-mode-user-mode-system-calls) · [All of Operating Systems](https://www.internhack.in/learn/interview/operating-systems-interview)

## More Operating Systems questions

- [Monolithic kernel vs microkernel: differences and trade-offs](https://www.internhack.in/learn/interview/operating-systems-interview/os-monolithic-vs-microkernel)
- [Program vs process: what is the difference?](https://www.internhack.in/learn/interview/operating-systems-interview/os-process-vs-program)
- [Process states, state transitions and the Process Control Block](https://www.internhack.in/learn/interview/operating-systems-interview/os-process-states-and-pcb)
- [Process vs thread: key differences](https://www.internhack.in/learn/interview/operating-systems-interview/os-process-vs-thread)
- [User-level threads vs kernel-level threads and threading models](https://www.internhack.in/learn/interview/operating-systems-interview/os-user-level-vs-kernel-level-threads)
- [What is a context switch and why is it expensive?](https://www.internhack.in/learn/interview/operating-systems-interview/os-context-switch-cost)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Operating Systems](https://www.internhack.in/learn/interview/operating-systems-interview)
