Welcome to the Pintos Operating System repository! This is a implementations of running user programs in pintos operating system developed as part of an assignment for the operating system module.
The main objectives of this project include:
-
Process Termination Messages: Whenever a user process terminates, either by calling
exit
or for any other reason, we print the process's name and exit code in the format of"%s: exit(%d)\n"
. The name printed is the full name passed toprocess_execute()
, excluding command-line arguments. -
Argument Passing: We extend
process_execute()
to support passing arguments to new processes. The program name and its arguments are divided by spaces, allowing us to execute commands like"grep foo bar"
withgrep
as the program name andfoo
andbar
as arguments. -
Accessing User Memory: The kernel must carefully handle memory access through pointers provided by user programs, ensuring that null pointers, pointers to unmapped virtual memory, and pointers to kernel virtual address space are rejected without harming the kernel or other processes.
-
System Calls: We implement a system call handler in
userprog/syscall.c
. This handler retrieves the system call number, its arguments, and carries out the appropriate actions. We implement several system calls includinghalt
,exit
,exec
,wait
,create
,remove
,open
,filesize
,read
,write
,seek
,tell
, andclose
. Each of these system calls has specific functionality and behavior detailed in the project description.
Here's a summary of the project exercises:
Implement process termination messages in the format "%s: exit(%d)\n"
when a process terminates.
Extend process_execute()
to support passing arguments to new processes.
Implement reading from and writing to user memory for system calls. Ensure proper handling of invalid user pointers.
Implement the system call handler in userprog/syscall.c
. Retrieve the system call number, arguments, and perform the required actions.
Implement the following system calls with their specified functionality: halt
, exit
, exec
, wait
, create
, remove
, open
, filesize
, read
, write
, seek
, tell
, and close
.
To build and run the Pintos operating system with your implemented features, follow these steps:
-
Clone this repository:
git clone https://github.com/your-username/pintos.git cd pintos
-
Build Pintos:
make
-
Run tests:
make check
- Be sure to thoroughly test your code to handle all corner cases.
- Remember that Pintos should not crash or malfunction due to user program actions; only the
halt
system call should terminate Pintos. - You may refer to the provided code and hints in the project description for guidance.
Please feel free to reach out if you have any questions or need assistance with this project. Good luck with your implementation!