PintOS is a lightweight operating system kernel designed for educational purposes. Developed primarily for teaching operating system principles, PintOS provides a practical platform for students to explore concepts such as threads, processes, virtual memory, file systems, and synchronization. With its simple yet comprehensive structure, PintOS offers a hands-on learning experience in understanding the inner workings of an operating system. This repository contains the implementation for the PintOS project.
First, we need to install a simulator, I prefer qemu.
- Install QEMU on system
sudo apt install qemu
- Make link
qemu
sudo ln -s /usr/bin/qemu-system-i386 /usr/bin/qemu
-
Clone this repository to your local machine:
git clone https://github.com/ahmedosama07/pintOS
-
Add
pintos
to PATHecho "export PATH=<path to pintos utils>:$PATH" >> ~/.bashrc source ~/.bashrc
-
Create environment variables for pintos home directory and pintos phase. i.e pintos contains of four phases, threads, userprog, vm and filesys.
i.e. Add these lines to~\.bashrc
, or~\.zshrc
if you usezsh
, replace<path to pintos home>
with the actual path to pintOSexport PINTOS_HOME=<path to pintos home> PINTOSPH="filesys" # stop@000001 export PINTOSPH
you can do so by running these commands
echo "export PINTOS_HOME=<path to pintos home>" >> ~/.bashrc
echo "PINTOSPH="threads" # stop@000001" >> ~/.bashrc
echo "export PINTOSPH" >> ~/.bashrc
source ~/.bashrc
To validate your work, run:
which pintos
You should see something like:
$PINTOS_HOME/utils/pintos
-
To change phase, replace
<phase>
with the current phase name.pintosph <phase>
-
To test for all phases run
check.sh
using shell name.- For
bash
:
bash check.sh
- For
zsh
:
zsh check.sh
- For
-
devices/: Contains device drivers and hardware interaction code, including timer, console, and disk drivers.
-
doc/: Contains documentation for the PintOS project, including design documents, user guides, and developer notes.
-
examples/: Contains example user programs that can be run on PintOS to demonstrate various features and test the system.
-
filesys/: Provides the file system implementation, including files and directories management, buffer cache, and file system utilities.
-
lib/: Provides library code used by both the kernel and user programs. This includes standard C library functions and other utility routines.
-
misc/: Contains miscellaneous files and resources that do not fit into the other directorject consisies. This may include documentation, build scripts, and other auxiliary files.
-
tests/: Includes a suite of tests for verifying the functionality and correctness of different components of PintOS. This is crucial for ensuring reliability and stability as the project develops.
-
threads/: Contains the implementation of kernel threads, synchronization primitives (like semaphores, locks, and condition variables), and thread scheduling.
-
userprog/: Implements user programs, system calls, and process management. This includes loading and running user programs, handling user-kernel mode transitions, and system call implementations.
-
utils/: Contains utility scripts and tools that assist in building, testing, and managing the PintOS project.
-
vm/: Implements virtual memory management, including paging, swapping, and page fault handling.
-
LICENSE: The license file for the PintOS project, detailing the terms under which the project's code can be used, modified, and distributed.
-
Make.config: Configuration file for the build system, allowing customization of the build process.
-
Makefile: The main makefile that directs the overall build process, including dependencies and build targets.
-
Makefile.build: A makefile that defines the rules for compiling and linking the project.
-
Makefile.kernel: A makefile specifically for building the kernel components of PintOS.
-
Makefile.userprog: A makefile specifically for building the user program components of PintOS.
-
check.sh: A shell script that switches between phases and runs the grading for all phases of PintOS, printing out the summary of results for each phase.
-
pintos.checker.js: JavaScript script primarily used by GitHub Actions. It fetches the results from an action that grades PintOS phases.