Operating Systems
Almost every modern computer system runs an operating system, which manages computer hardware and software resources and provides common utilities to software running on the system. There are 3 main types of operating system that you will need to be aware of. Most desktop computers run Windows, which is usually Windows 10, or more recently, Windows 11. A substantial part of the market also uses macOS. Finally, a huge amount of the worlds computing infrastructure runs on Linux1. You may have heard of some Linux distributions, such as Debian, Fedora and Ubuntu. Most supercomputing clusters run on Linux, commonly a version of Red Hat Enterprise Linux.
For us as researchers, it is important that our code can be run on multiple different operating systems, as you will likely use your home machine (likely Windows or macOS) to develop your code and then move to a Linux cluster to run your code at scale. It is now easier than ever to write cross-platform code which can execute on a wide variety of systems. This is why a lot of scientific oriented code is written in C/C++ or Python, as there is much support across all operating systems. Most major programming languages today will be able to run on any platform. Julia is no different, and can run on most platforms.
Now we know what operating systems are out there, let us talk about what they do for you. The Operating System handles the basic operations that programs use regularly. They handle interacting with files on the permanent storage, they handle the memory allocation in RAM and most importantly, they handle the scheduler for the processor. An OS acts as an intermediary between the hardware on a computer and the programs and applications themselves. Its role can be seen in Figure 1.
An operating system is incredibly useful as it abstracts away the hardware details and allows developers to deploy their application across a huge range of computers, with high confidence that they will work.
Today, most languages provide abstracts to perform common tasks independent of the specific operating system. For example, the os
library in Python provides functions for constructing file and folder paths, checking whether directories or files exist etc. These functions usually just call into the relevant functions provided by the operating system. However, using the abstraction in the programming language allows the same code to work on Linux, Windows and macOS, despite the operating systems using different formats for file paths. Scientific programmers should aim to make the code they write cross-platform by default as it is relatively easy to achieve, and has numerous benefits. It is usually also essential if we want to run our code on a HPC (High Performance Cluster), as these will likely be running a different operating system to the one that you develop the code on.
Process Management
The OS is responsible for loading processes (i.e. instances of programs) into memory and beginning their execution. When you run some software, i.e. open up your web browser, your operating system will allocate space inside the system’s memory (RAM) to store the instructions for the software, along with space for its working memory. The block of memory assigned to the process is usually abstracted into a virtual address space, which constrains where each process can access memory. Most processes under normal permissions cannot read or write into the memory of another process, as the operating system will intercept calls into the virtual address space and determine whether that process has permission to access the real block of memory. This means that processes are completely isolated from one another, and can only interact by sending messages, instead of directly sharing memory. This concept will be important when we introduce the idea of parallel computing.
Footnotes
- Linux (technically GNU/Linux) is an open source project which refers to a family of operating systems based on the Linux Kernel, packaged with a suite of software tools from the GNU ecosystem. There is a related project called OpenBSD which is also very similar to a Linux based system, and is often seen as the operating system for many servers.↩