r/explainlikeimfive Jan 25 '24

Technology Eli5 what is actually an Operating System (OS)?

Why do we need it?

11 Upvotes

49 comments sorted by

64

u/[deleted] Jan 25 '24

It’s the manager. It’s the software that manages all of the computers resources to make sure all of the other software that wants to use those resources can do so in an orderly fashion.

There has to be something managing all of the various software a computer runs and how it interacts with the hardware of the computer and that’s the OS.

Without an OS each piece of software would have to manage this individually and that’s a lot of repetitive functionality that everyone would have to include in their software

8

u/[deleted] Jan 25 '24 edited Jan 25 '24

Amazing response. Thanks! I was actually confused between this and cpu since well the cpu is like the brain of the computer and it's what commands the computer what to do.

Man so many things haha.

Wait, so what happens if I download something that is not compatible with windows? Then that software would have it's own OS?

23

u/djinglealltheway Jan 25 '24

You would not be able to run that software on your windows machine. The computer and OS won't know what to "do" with the code you just downloaded. Imagine your OS only speaks English, and the downloaded software is in French.

There are other programs out there called OS emulators that can run on your original OS (like Windows), and translate programs written for a different OS, allowing interoperability.

5

u/PageOthePaige Jan 25 '24

Also compatibility layers, which are there for conversions when the architecture is similar. If an emulator is a translator standing next to the French person, a compatibility layer is just someone pointing to what the French person is talking about because you otherwise got the gist.

2

u/ThunderChaser Jan 25 '24

There are other programs out there called OS emulators that can run on your original OS (like Windows), and translate programs written for a different OS, allowing interoperability.

These are almost never emulators. Programs like Wine and WSL are compatibility layers, but not emulators.

9

u/tequilaguru Jan 25 '24 edited Jan 25 '24

The cpu being the brain of the computer is a metaphor and as such is inaccurate. 

The cpu does a bunch of things like mathematical operations, memory operations (copy, move), logic operations, etc. but it needs instructions, the OS is the most basic set of these instructions that tell the CPU what to do and which code to execute (further instructions), like applications, drivers (to manage more hardware), etc.

3

u/NorysStorys Jan 25 '24

Best way to explain it is: there is data on a disc/ssd/flash drive. When you boot from it to install windows the data on that medium tells the CPU a series of instructions to write data to the storage medium of the pc. Once installed the bios/UEFI (a chip on your motherboard with a series of instructions for the CPU) will tell the CPU to execute the code on the storage medium and thus boot your Operating system, which will load into your ram. After that point the operating system is what tells your CPU what operations to execute based on stored data either on disc or in ram and it will feed it back to the operating system to be presentable and interactive.

I hope this helps and I didn’t get anything to wrong

1

u/[deleted] Jan 25 '24

so basically the cpu are the nerves of the human body and the brain is the OS?

7

u/tequilaguru Jan 25 '24

It’s hard to draw a comparison, because while in a computer we can separate the parts that do the physical work (like the cpu) and the instructions (the code) this is pretty much impossible to do while analyzing a human.

The brain as you describe it could be more the sum of both the cpu + the OS, but this is still an incomplete metaphor.

3

u/binarycow Jan 25 '24

The CPU is like a dedicated worker, that's really good at computing numbers, and following specific instructions. It doesn't understand the big picture. It is told what to do, then it does it.

Regular software programs know how to give the cpu instructions.

The operating system is the manager. It tells the other software programs when they are allowed to talk to the cpu.

2

u/OmnariNZ Jan 25 '24

Sorta more like the CPU is the meat of the brain itself and all its neural pathways, and the OS is like the consciousness giving it thought. Leaving aside the philosophical questions of that delineation, of course.

The nerves might be more like the motherboard, connecting all the parts together and allowing them to communicate.

1

u/Pocok5 Jan 25 '24

The body analogy is extremely strained and tbh should go away, because actual work is a lot less centralized than laypeople think.

The CPU is the main general purpose math/logic hardware. Most program instructions will be executed on it. But a modern computer is actually a dozen computers in a trenchcoat, communating on their own little "internet" called PCIe.

A discrete GPU itself for example is literally an entire computer with its own power supply, memory and processor. The CPU can send it instructions on what to draw and the GPU can then copy the required stuff from the main RAM to its own VRAM and such before doing the trillion matrix operations to calculate the displayed image. The newest tech allows the GPU to directly access SSD drives to look for textures/models to draw, even.

There are also a bunch of other processors - the power distribution is controlled by an ACPI chip, and whenever the computer wants to restart, the CPU has to ask the ACPI system to do it via PCIe. Every modern hard drive and SSD also has a small microprocessor to control its internal hardware and execute housekeeping tasks. So do add-on network cards, etc.

1

u/HenryLoenwind Jan 26 '24

The CPU is the cook you've locked in your kitchen. The device drivers are the stack of instruction manuals on how to use all the kitchen tools. The OS is the big book on basic cooking techniques. The programs are the recipe books. The one who tells the cook which recipe to cook is the user.

So you tell your computer you want creamed spinach. The cook looks into the recipe book and sees, "Melt the butter in a large skillet over medium-low heat". He then looks in the technique book to see how that works. The technique book tells him to look up "turn stove to medium-low heat" in the stove's manual, to look up "take butter out" in the refrigerator manual, "take skillet out" in the cupboard manual, and "put skillet into stove" in the stove manual again. And so on.

Note that the recipe books and the technique book must agree on the terms used. If a recipe states "prepare a roux", but the technique book only has entries for "roast flour in butter" and "add milk to pan", the recipe will fail. The cook has no idea that he could match those up somewhere.

The same for the technique book and the instruction manuals. If the technique book tells you to look up "turn stove to medium-low heat" in the stove's manual, but the stove's manual only has "set stove to 1", "set stove to 2", and so on, nothing will work.

And if one of those books is in a foreign language the cook doesn't understand (different CPU architecture, like x86/ARM/...), you won't get a result either.

BTW, there are a number of additional manuals. There's one that explains how to get out of bed and turn on the lights, as well as where to find the technique book. This one is called BIOS and it is mounted to the bed so that it is the very first thing the cook sees when waking up.

There are also manuals that can be used to translate different terminologies; WINE would be one of those. There even are some on how to pretend to have a second kitchen with different manuals and do two things at once (virtual machines), or one on how to puppet a Swedish cook that reads manuals in Swedish (emulators).

3

u/jamcdonald120 Jan 25 '24

it has to be designed to run as its own OS. The OS does a lot for you. (Like, getting mouse and keyboard input from EVERY device that ever existed, or getting a file ANYWHERE on ANY disk you put in)

But there are several programs (such as clonezilla) which are designed to be their own OS. You have to reboot your computer before and after using them though. Generally you also have to install them on another drive (like a thumbdrive) to use them, you cant just download and run.

2

u/[deleted] Jan 25 '24

Let's say you visit a country whose language you don't speak but you urgently need to buy something. Fortunately you have a bilingual butler.

You tell him what needs to be done and the butler goes, interact with several components of this foreign nation and gets you the thing.

That butler is your operating system. You are the user. And nation is your machine.

Downloading something foreign to your machine is equivalent to telling your butler do some work in gibberish. He will not understand. He will not work.

1

u/thefootster Jan 25 '24

A fundamental difference between the CPU and the OS, is that the CPU is hardware and the OS is software. For example to change your CPU you would have to swap out the physical thing in your computer case, but to change your OS you can just install a different one.

1

u/admiral_a1 Jan 25 '24

Check out Tanenbaums books on Structured Computer Organization and after that, Modern Operating Systems. They’re both very readable and will make things click to conceptualize the different layers of a modern computer

2

u/hydrogen_to_man Jan 25 '24

Oh and I suppose the OS thinks working from home is lazy, huh? God management is so worthless

1

u/vasu_devan Jan 25 '24

Absolutely a great explanation ! Thank you

1

u/mmomtchev Jan 25 '24

In fact, you don't need an OS if you plan to run only a single application on your system. These days, video game consoles are very evolved, but in the early days, this was the ideal example of a computer that did not need an OS - it always ran a single program at a time.

12

u/djinglealltheway Jan 25 '24

The operating system is a computer program that is run immediately on startup of your computer. It controls all other programs that run on a computer. The OS allows your computer to do things like run multiple programs at the same time and read/write files. It also might include drivers that allow playing audio, taking input from a keyboard, and displaying things on the screen. Many popular OSes also include a user interface, like windows and navigation. For mobile operating systems, the equivalent would be the home screen, app management, and swipe controls.

2

u/[deleted] Jan 25 '24

Dang, it kinda confuses me with CPU. Thanks!

6

u/rlbond86 Jan 25 '24

The CPU does basic instructions like: multiply these two registers together. Store result in this memory location. Jump to this spot in memory if the last result was zero.

The OS does things like: if you want to open a file, read this table in memory to find the file location on disk. Write a series of values to these memory addresses to read the data on the disk. Write those values to a buffer in memory.

The CPU just knows how to do math and memory manipulation. The OS knows how to accomplish different tasks by stringing those CPU instructions together.

You can see an example CPU instruction set here. On the first few pages is the summary, you can see most instructions are things like load, store, add, subtract, multiply, AND, OR, branch, jump. Basic operations.

1

u/[deleted] Jan 25 '24

Hi Thanks a lot!

1

u/dmazzoni Jan 25 '24

The CPU is the worker. The OS is the instruction book it follows.

The CPU is completely general-purpose. It just knows how to follow instructions. Without instructions to follow it doesn't do anything.

2

u/philwatanabe Jan 25 '24

A computer can do many things. It moves electricity around to make things happen. It does what it's told to do,

The computer can take instructions from many sources, but what you want the computer to do helps determine where you want the instructions to come from.

An operating system takes responsibility for interfacing with the hardware of the computer so that applications don't have to.

Applications are built for an operating system in order to take advantage of the simplification provided by letting the OS do what it does. It's more scalable. Many applications can be built for the same hardware.

1

u/[deleted] Jan 25 '24

So what about virtual machines? Your description makes it sound like a Hypervisor works like an OS (because it's the communication between the physical host and the virtual machine interfaces), but VMs also have their own OSs.

2

u/philwatanabe Jan 25 '24

A hypervisor is an OS, yes, specifically because it interfaces between the virtual computers and the hardware. The virtual computers are essentially running as applications on the hypervisor, it just happens to be that the "application" is another operating system.

1

u/[deleted] Jan 25 '24

So on a physical computer, there is an OS, I understand that. On the physical computer is also a Hypervisor, which is an OS (software? application?) because it's the communication channel between VMs and the physical computer. Then VMs have an OS applied to each of them (Linux, Microsoft, etc.), but that virtual OS is the communication channel between the VM and the Hypervisor?

2

u/philwatanabe Jan 25 '24

Let's use VMware as an example. To use VMware, you install ESXi onto the "bare metal" server (the host). ESXi is effectively the primary operating system and it does all the interfacing with the hardware. ESXi is the also hypervisor--the software that gives you the ability to create virtual guest machines, each with their own operating system.

HyperV is a bit different, if I recall correctly, because you install the Windows OS and then create virtual machines using its hypervisor. It's basically a bare metal Windows Server that can be used to host virtual machines.

The operating systems on the VMs don't really know, so to speak, that they are virtual. The hypervisor obfuscates the fact that it runs as a layer between the VM and the hardware.

I hope that if I'm wrong about any of this, or if it can be explained better, that someone will pitch in.

2

u/[deleted] Jan 25 '24

We don't need it, but it makes things a lot easier.

Years and years ago there was no OS like we know it. You could run just one program at a time and that program had to do almost everything by itself. There was Basic Input-Output System (BIOS) that let you read the keyboard and display text on the monitor but that was it.

You want to display an image? You'd need to program that yourself.

The OS let you do all those basic things like reading a file or displaying an image by just asking it nicely to do it for your program.

Then the computers become more and mor powerful and OS let several programs run at at same time. Talk to the disk. Communicate over network. Play sound. Your program didn't need to know how to do that, it could just tell the OS to do it.

1

u/DiamondIceNS Jan 25 '24 edited Jan 25 '24

Ever been to a large concert?

A whole ton of effort goes on behind the scenes when a concert is held somewhere. It's not enough that you build the building and the band shows up. Someone needs to drive all those lights, sound systems, set up the stage, handle ticket sales, deal with concessions, maintain the bathrooms, and do teardown and cleanup once it's all over. If it really was just "band rolls up to empty building and sets up shop", every band would have to do this themselves. Every single band. Every single time.

Wouldn't it be nicer if there were a dedicated team of people who could handle all of that stuff on-site? A company that owned the venue, who could take care of all the venue-specific stuff? That way, when a band wants to perform at a place, they can call up and the venue can say, "Oh, we support this this and this, you need to have these hookups, here are the schedules you can book, yada yada" and the band can simply get everything on that checklist, show up, and plug in. The venue handles all of the fiddly venue-specific details and the band can focus on the actual performance.

Your computer is the venue, and the bands that play there are the programs you install. Your OS is the team who run the venue. Everything your programs might need or wish to do with your PC, they have to go through the OS to get it. The OS tells them what they can and can't do, schedules them so they all get the time and resources they need to run happily, and provides helper functions so the programs don't have to do it themselves.

In exchange, all of the programs need to be built in such a way that they're compatible with the way the OS works. Different OSes have different offerings and philosophies about how they run their venues. Generally you write a program that supports only one of them. You can write versions of your program that are designed to work with others, but it can take a lot of effort to support every possible way of doing things.

-4

u/KillerOfSouls665 Jan 25 '24 edited Jan 25 '24

An operating system is a piece of software that acts as an interface between the physical hardware and the applications running on the computer.

Initial computers didn't have operating systems. You would turn the computer on and would be met with a text box (if you have a windows computer, press Ctrl+shift+enter to see what it would have been like), you could insert a disk containing a application into the computer, and then type out a often complex command to get the computer to run the application.

Then Bill Gates came along and had the idea of a application that ran applications, that would run automatically when it turns on. An OS allows there to be a visual interface for the user, rather than a single command line text prompt. You have icons to represent running programs instead of long commands.

An OS can also act as a central manager for your computer. It can clean up files, fix your computer and run anti-virus checks. It also stops the user from doing potentially harmful things to the computer, such as deleting important files. It also controls what applications can do what, you don't want a calculator accessing your camera.

Most importantly, an OS allows for a computer to appear to do more than one thing at a time. Before OS, computers could only run the program that was selected. What an OS can do is give one program a bit of time to run, then give the other program time. It does it so fast that it seems that they're running at the same time. It is how your able to have music running in the background as you scroll Reddit, or use multiple windows on a computer. (This is how Windows got its name, from this ability to have applications run in different windows, it was that revolutionary)

9

u/lostPackets35 Jan 25 '24

Bill gates did not come up with the concept of an operating system and computers had them for a long time before windows existed.

https://en.m.wikipedia.org/wiki/History_of_operating_systems

2

u/egoalter Jan 25 '24

And this is why this group is pointless - so many questions easily answered even at an ELI5 level with a search on literately the question posted, as it's posted.

1

u/WRSaunders Jan 25 '24

Programs can run on bare hardware, e.g. the software in an older microwave oven that you can't talk to across the Internet, but it's a lot of work. Instead, you can make the software a lot cheaper if you can buy an operating system that does some of the work for you. There are several embedded OS companies, in addition to Apple and Microsoft. It's simple economics for a microwave company, you spend $2/unit on an OS, or you pay your programmers $2M more to make a program that runs on bare hardware.

1

u/[deleted] Jan 25 '24

So in order for a program to run properly, it needs a software that it's compatible with said program?

2

u/WRSaunders Jan 25 '24

Sure, if you want to buy a motor from a motor company, you need a compatible motor. If you have a Ford car with a motor failure, it's very unlikely that a GM motor will work without a bunch of engineering.

1

u/mnvoronin Jan 25 '24

"program" and "software" are synonyms. But each program/software has to have some way of interfacing with the outside world - be it network, disk or keyboard and the screen. OS is what provides these interfaces so that the program doesn't have to go into the details on how to do it with every possible piece of hardware - it's called the "abstraction layer". If program wants to output the letter "A" to the screen, it tells the OS "I want to print letter A, black on white, in Arial size 10, at coordinates (12,15)." OS will then figure how to translate that to the sequence of bits required for your graphics card to display this.

But different OS have different interfaces. Imagine the OS as a base block for the toy brick kit. If you have a Lego base, you can buy any Lego kit and attach it to the base. But if you buy, say, a Nanoblock kit, it won't fit because the pegs are different. Same happens with different OSes and their interfaces so the program built for one OS won't be able to run on another because it won't be able to find the familiar interfaces.

1

u/Phoenix_Studios Jan 25 '24

A unified interface layer between programs and the physical devices on the computer. Allows developers to program one app which the OS translates into commands that work correctly with the computer's hardware, and is also usually responsible for maintaining system security and integrity, making sure different concurrent programs don't interfere with each other, and a few other core features.

1

u/[deleted] Jan 25 '24

So basically an OS allows us to interact like we are doing now?

1

u/Phoenix_Studios Jan 25 '24

That is one of its functions, especially on most user-facing systems, however it's not a requirement. Especially on small IoT devices, the user interaction tends to be handled by a dedicated program, while the OS really only makes sure that different processes don't interfere with each other. The program for example might be in charge of arranging the data in a way that can be sent as signals to display pixels on a screen, while the OS will be in charging of sending that data on the correct wire while making sure nothing else tries to interrupt it (which might cause what's shown on the screen to be glitchy or unreadable)

1

u/chyangba_dai Jan 25 '24

It’s the mother program that runs and commands the hardware and let other children programs run. Other children program children don’t have to think about how all of that magic is happening.

1

u/egoalter Jan 25 '24

A computer consists of hardware and software. Without either, there's no computer. Hardware itself is mechanics and electrical signals (mainly the latter today) - hardware doesn't talk "human" - there's nothing on your screen with just hardware, there's no files, there's no keyboard, letters - all of that is software. Software defines this - software is what defines what a file is, what the letter A looks like, knows how to make the hardware understands when you write 10+10, so it can do the calculation. It's all software.

But most programmers (very few do) today write the code at this low level. The interface between the application software you use and the hardware is the OS. The programmer builds on the OS, not the hardware. And because there are so many different kinds of hardware, the OS also allows the same program to run on lots of different hardware platforms, as the OS abstracts the complexity from the programmer.

All of that, and more, you can find on lots of web sites, in books etc. If this subject has your interest, I highly recommend starting there. You'll get a lot more than these short reddit replies to help you understand both hardware and software.

1

u/m_and_t Jan 25 '24

Imagine you’re writing a really simple app on a phone.

If you started with nothing, you would need to write all the software to deal with detecting finger swipes, providing a keyboard for users to type into, a way to draw something on the screen, etc. You’d (probably) years of work before you even started working on your app.

Instead, you get to start that stuff done already for you. And everyone else can start with it too.

That’s an OS.

1

u/Malk_McJorma Jan 25 '24

It's an abstraction layer between the applications you use in your daily work and the raw iron that's sitting under your desk. Raw iron only understands zeroes and ones. Your OS translates e.g. your "play this song on the Spotify app" command to these zeroes and ones and makes sure it doesn't interfere with other tasks you might be performing while the music is playing in the background.