Understanding the Operating System

Why Do We Need an Operating System?

In the previous chapter, you learned how computers are architected — how the CPU, memory, and hardware work together to execute instructions. But modern programs don’t interact with hardware directly. Instead, they rely on a powerful layer in between: the Operating System. The operating system acts as a manager and translator. It coordinates hardware access, runs your programs, and gives you tools — like file systems and command-line interfaces — to build and interact with software. It’s what makes computers usable, efficient, and safe. Without an OS, you'd need to manage hardware directly — manually deciding where to store data in memory, how to talk to your keyboard, and when to send something to the screen. The OS acts as an intermediary that:

What Does the OS Actually Do?

The OS is responsible for:

User Interfaces: CLI vs GUI

Operating systems usually offer two main types of user interfaces:

Developers often use the CLI because it gives more control, especially for compiling code, managing files, and using tools like Git.

Programs, Processes, and Threads

Processes may run in parallel and may contain multiple threads — allowing programs to do many things at once.

How the OS Handles Resources

The OS manages and distributes your computer’s limited resources:

This keeps your programs isolated, safe, and able to run efficiently.

Instructions vs Threads

Threads can run in parallel, which is critical for responsiveness and performance in modern apps.

Why This Matters to Programmers

Every time you run a program, you’re asking the OS to:

When writing code, especially in Java, you’ll often:

Knowing what the OS does behind the scenes gives you better control over how your programs behave.

What’s Next

Now that you understand how programs are managed by the operating system, you're ready to explore how those programs can communicate across machines. In the next chapter, you'll learn how the Internet and the Web work — and how your code can be part of something much bigger than a single device.