In this step, you will learn the basics of what an operating system is and its key functions.
An operating system (OS) is the software that manages computer hardware and software resources. It acts as an intermediary between users and the computer hardware, handling tasks like process management, memory allocation, file systems, and providing a user interface.
Think about your computer or phone: the OS is what allows you to run programs, save files, and connect to networks. Common examples include Windows, macOS, and Linux.
In this step, you will explore how operating systems manage processes, which are instances of running programs.
A process is a program in execution, and the OS handles creating, scheduling, and terminating processes to ensure efficient use of the CPU. This includes managing multiple processes simultaneously through multitasking.
To see this in action, open your terminal or command prompt. Depending on your operating system, run the following command to list current processes:
For Windows, type tasklist
; for Linux or macOS, type ps aux
.
# Run this in your terminal:
# Windows: tasklist
# Linux/macOS: ps aux
After running the command, you should see a list of processes, including their names, IDs, and resource usage. This demonstrates how the OS keeps track of all active processes.
In this step, you will learn about file systems, which are how operating systems organise and manage files on storage devices.
A file system structures data on disks, directories, and files, allowing you to store, retrieve, and manage data. The OS handles operations like creating, reading, writing, and deleting files, ensuring data integrity and efficient access.
To demonstrate, open your terminal or command prompt and list the files in your current directory. Use dir
on Windows or ls
on Linux/macOS.
# Run this in your terminal:
# Windows: dir
# Linux/macOS: ls
You should see a list of files and folders in your current location. This shows how the file system organises data hierarchically.
In this step, we will use basic Python scripting to interact with operating system utilities, reinforcing your understanding of processes and file systems.
Create a new Python file or use an online Python environment if available, and add the following code to list files in the current directory and get the current process ID.
Add the following code:
import os
# Get and print the current working directory
print("Current working directory:", os.getcwd())
# List and print files in the directory
print("Files in the directory:")
for file in os.listdir():
print(file)
# Get and print the current process ID
print("Current process ID:", os.getpid())
Then run your code. You should see the current directory path, a list of files in that directory, and your process ID. This script uses Python's os module to access OS utilities, showing how scripting can simplify interactions with processes and file systems.
In this final step, we will summarise what you've learned and reflect on the key concepts.
You've explored the fundamentals of operating systems, including how they manage processes and organise file systems. Through demos, you've seen processes in action and used scripting to interact with OS utilities. Reflect on how these components work together to make your computer run smoothly – for example, consider how process management prevents conflicts when running multiple applications.
Take a moment to note down any questions or insights you have about operating systems.