Assignment_1_OS_Easy
Assignment_1_OS_Easy
Assignment 1 – Easy
Total: 50 Marks
Instructions:
1. The assignment has to be done individually.
2. You can use Piazza for any queries related to the assignment and avoid
asking queries on the last day.
The assignment has five parts.
$Enter Username:
$Enter Password:
Login successful
$
1
3 Shell Command: history: 10 Marks
In this part, you must implement an additional command history that needs
to display a list of all the processes that have been executed until now (sorted
in ascending order of time). Each entry of the list must contain the following
information: pid, process name, total memory utilization. Total mem-
ory utilization should include the memory in bytes allocated for text, bss, data,
stack and heap segments for each process. For this, you must create another
system call in xv6 called sys gethistory, which will return the required data.
The signature of the system call is as follows:
int sys_gethistory()
If the system call is successful, it should return the data in the aforemen-
tioned format; otherwise, it should return -1.
The syscall identifier (syscall.h) for this call should be 22.
$history
3 ls 10
4 echo 5
$
Create two user-level commands block and unblock, both of which will take
a single argument (syscall ID) and block/unblock the specified system call in
the system (for all the processes spawned by the current shell), respectively.
$block 7
2
The shell should print ”syscall 7 is blocked” when a blocked syscall is invoked.
Critical System Calls: Ensure that the fork and exit system calls cannot
be blocked at the kernel level.
6 Report: 10 Marks
Page limit: 10
The report should mention the implementation methodology for all the parts
of the assignment. Adding small code snippets is alright. Alternatively, the
pseudocode should also suffice.
7 Submission Instructions
• We will run MOSS on the submissions. Any cheating will result in a zero
in the assignment, a penalty as per the course policy, and possibly much
stricter penalties (including a fail grade).
3
• There will be NO demo for assignment 1 (easy). Your code will be evalu-
ated using a check script (check.sh) on hidden test cases, and marks will
be awarded based on that. You can find the test scripts here (will be
released soon). The README file inside the test scripts tarball contains
the instructions on how to run the test scripts.
How to submit:
make clean
tar -czvf assignment1_easy_<entryNumber>.tar.gz *
This will create a tarball in the same directory with the name,
assignment1 easy ⟨entryN umber⟩.tar.gz. Submit this tarball on Moo-
dle. Entry number format: 2020CSZ2445. (All English letters will be in
capitals in the entry number.)
3. Please note that if the report is missing in the root directory, no marks
will be awarded.