You are on page 1of 2

CPSC 457 - Fall 2015

Assignment 1
Due: Friday September 25th @ 11:59 PM
Total: 20 marks; Worth 8% of your final mark
Objectives:
This assignment is intended to:
1. Introduce you to KOS
2. Show you how to add system calls to KOS
3. Understand the cost of system calls
Supplied material:
As part of the assignment, you are given a file called syscall_test.cc, which is the user-level program that you will use to test
your system call.
Deliverables:
1. Add a new system call to KOS long sysadd(long, long)that adds two integers. [6 points]
2. Write a user-level procedure call long procadd(long, long) that adds two integers in syscall_test.cc. [2 points]
3. Use the user level program given in syscall_test.cc to invoke your system call and the procedure call and verify the
output. [2 point]
4. Measure, print, and compare the average number of CPU cycles consumed for the execution of the system call and the
procedure call. Use Time Stamp Counter(TSC) for measuring the same. Repeat each call 50k times or more using a loop.
Measure the total number of CPU cycles consumed by the loop. Find the average number of clock cycles consumed per call. [6
points]
5. Which of the two calls is more expensive? What is the reason of the extra cost for the costlier call? Answer each question in no
more than 3 sentences. [4 points]
(Code that does not compile receives at most 40% of the total mark.
Code that compiles but does not run receives at most 60% of the total mark)
Sample output:
proc_add sum: 8
proc_add cpu_cycles: xxxxx
syscall_add sum: 8
syscall_add cpu_cycles: yyyy
Notes:
1.
2.
3.

Add syscall_test.cc and run make from kos/src/user to create an executable of syscall_test.cc called
syscall_test. The executable syscall_test would be loaded as a RAM file when you run KOS.
You can run the executable by invoking syscall_test as a new process in kos/src/main/InitProcess.cc
You are allowed to modify syscall_test.cc

Submission Instructions:
Submit one hardcopy per team of the following (in the shown order)
1.
2.
3.
4.
5.

Your team info (names and IDs)


Anything that you want to mention to the TA about your submission (README; optional)
List of modified files in KOS and list of files that you added to KOS along with their full path
Output of syscall_test.cc
Modified syscall_test.cc and any new file that you added

6.
7.

diff of the files that were modified in KOS. Use git diff command
Answers to item 5 in the deliverables

Upload to D2L (One submission per student)


8. The patch for the modified files
9. Any new files created
10. README file with the following information in the given order
a. ID and names of all team members
b. Full path of new files created
Teams:
You are advised, but not required, to work in a team of two members. Teams of more than 2 students are not allowed. It is
preferable that you find a partner in your tutorial. If this is not possible, partners from outside your tutorial are allowed as long
as you and your partner have the same TA
Academic misconduct:
Any similarities between assignments will be further investigated for academic misconduct. While you are encouraged to
discuss the assignment with your colleagues, your final submission must be your own original work. Any re-used code of excess
of 20 lines must be cited and have its source acknowledged. Failure to credit the source will also result in a misconduct
investigation.

You might also like