What is an operating system?
What is an operating system?Operating Systems are software systems that control the computer’s resources. It is software that allows applications to interact with the hardware on a computer. Software can interact with hardware directly. But most software isn’t written to a particular piece of hardware – the operating system takes care of interacting with the hardware.The earliest computers did not have Operating Systems. Every program that ran on the computer had to include all of the code to run the computer and communicate with the hardware, as well as perform its actual function. This made each computer program complex and difficult to create. Each program could only run on the machine it was made for.Before Operating Systems, computer programs were run by individuals. A literal queue of people would line up in front of a computer with their programs loaded on magnetic tape or punch cards. They would physically load their program into the machine and wait for it to finish. As computers became faster at processing information, the time it took an operator to load a program into a computer was sometimes longer than the program took to run. These operators would have to schedule different programs depending on the resources the programs needed.Operating systems replaced these human operators by scheduling programs into memory. For a program to run, the following steps would occur:
- The program would be loaded into the computer.
- The operating system would reserve a section of RAM for the program.
- The program would be copied from magnetic tape or punch cards into the RAM.
- Once scheduled to run, the CPU retrieved the instructions from the memory location of the first instruction in the program.
- The program would then begin.
Want to keep
Raspberry Pi Foundation online course,
Understanding Computer Systems
Virtual memoryVirtual memory is a memory management technique. A piece of hardware called a Memory Management Unit maps a virtual address () to a physical address.When loaded, programs are given a virtual address of 0 to however much they need. The MMU puts the program wherever there is space on the RAM.It can also split the program around the RAM, filling in any gaps.Let’s look at the scenario above using the MMU and virtual memory. 1. Program A loads into address 0 in the RAM, and given 5MB of RAM to run. It’s given a virtual address of 0 to 5242880 Program B loads into address 5242880 and given 3MB of RAM to run. It’s given a virtual address of 0 to 31457282. Program A finishes. Program C receives a virtual address of 0 to 3145728. We place C in 0 in RAM. There’s now a gap in RAM.3. Program D needs 5MB of memory. The gap is too small. Program D is split into two: 2MB are placed in 3145728, 3MB are placed in 8388608. Program D is given the virtual memory address of 0 to 5242880.Using this technique of virtual memory, there are no gaps in RAM and you won’t run out of memory as easily as before.Each program is self contained. It doesn’t write over any other program. It doesn’t matter where the program is in memory, the MMU does all the mapping. Programs no longer need to be in one continued block.
Other roles of an OSAs well as scheduling programs into memory, Operating Systems schedule how programs use the CPU (we’ll look at this in more detail in the next step). Operating systems also have a role in managing access to different levels of resources. This protects the integrity of the system – which we’ll also be looking at later.Other roles of an operating system include:
- Interacting with hardware through drivers written for a specific piece of hardware and OS.
- Providing utility software, such as disk management or security software.
- Dealing with input/output events, like a key press.
Understanding Computer Systems
Our purpose is to transform access to education.
We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.
We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.