Operating System Final Project
Operating System Final Project
Systems
Fall 2024
1. Introduction
When a program runs into issues such as a sudden crash or unexpected output, a
developer can detect the problem by debugging the source code. Ideally a developer should
always have access to the source code to detect the problem, however in practice this is not
always the case. Softwares, services or libraries developed by other teams can be delivered
as an executable binary file and access to source code is not always provided. Linux
provides developers a powerful tool called “strace” with the ability to show system calls
or library calls, which a program made at a low level. When running into problems, we can
use strace to roughly guess what the program does and what system calls it fails. It helps
in detecting the issues without digging into the details of source code. Please refer to the
manual page: https://man7.org/linux/man-pages/man1/strace.1.html
2. Goal
Unfortunately, strace is not built into the xv6 operating system. Our goal of the project is
to make a version of strace for xv6.
Screenshots showing the result of each task should be provided in your report. Some
requirements can be tricky to test. Your points will be deducted if screenshots of
results are not provided.
4. Tasks
• 4.1.2: Pick 4 random system calls (ex: nmap, write, open, etc) of your choice and
explain their functionality for the command that you run (ex: echo, ls, cd, etc) in
2-3 sentences
When typing “strace on” in the terminal, the mode of strace is on and
therefore the next typed in command will be traced. The system call list will be
printed on screen in format pid (process id), command name, system call name,
return value.
– Find a way to format your output such that the result of the command is
printed first and strace result is printed after.
– Find a way to suppress the command output and leave only strace output
when strace is on.
When option flag -e is provided followed by a system call name (ex: write), we will
print only that system call. If no such system call is made in the command, print
nothing.
Notes: Notice the first strace run is similar to regular ”echo hello” run in the
above figure 1. Next command is ”strace -e write” which activates tracking of
the write system call. We run ”echo hello” again, observe that only the write system
call is printed. One more run of ”echo hello”, and everything is back to normal
without tracing only the write system call. Similar idea should be done in option -s
and -f.
• 4.3.2: Option: -s [5 points]
When option flag -s is provided, print only successful system call.
Notes: Even though the sample is in Linux, a similar report table is expected in
XV6 for extra credits. The columns required are: calls, errors, syscall and seconds
(measure the total time it takes to execute system call). You should try to test with
a command that will take time to execute system call and display result of that
command.
Write a small program that produce an unexpected behavior such as race condition,
delay output, crash on condition, memory leak or your choice of implementation. Run
strace on this program.
• (xv6) Does your strace implementation provide anything useful that can tell
you something about this unexpected behavior?
5: What to hand in
• On Brightspace, submit a zip file containing