Difference between revisions of "Operating Systems 2014F: Assignment 4"

From Soma-notes
Jump to navigation Jump to search
Line 1: Line 1:
Please submit the answers to the following questions via CULearn by midnight on Wednesday, October 1, 2014.  There 10 points in 4 questions.
Please submit the answers to the following questions via CULearn by midnight on Saturday, October 4, 2014 (extended from October 1st).  There 10 points in 4 questions.


Submit your answers as a single text file named "<username>-comp3000-assign4.txt" (where username is your MyCarletonOne username).  The first four lines of this file should be "COMP 3000 Assignment 4", your name, student number, and the date of submission.  You may wish to format your answers in [http://en.wikipedia.org/wiki/Markdown Markdown] to improve their appearance.
Submit your answers as a single text file named "<username>-comp3000-assign4.txt" (where username is your MyCarletonOne username).  The first four lines of this file should be "COMP 3000 Assignment 4", your name, student number, and the date of submission.  You may wish to format your answers in [http://en.wikipedia.org/wiki/Markdown Markdown] to improve their appearance.

Revision as of 10:16, 1 October 2014

Please submit the answers to the following questions via CULearn by midnight on Saturday, October 4, 2014 (extended from October 1st). There 10 points in 4 questions.

Submit your answers as a single text file named "<username>-comp3000-assign4.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 4", your name, student number, and the date of submission. You may wish to format your answers in Markdown to improve their appearance.

No other formats will be accepted. Submitting in another format will likely result in your assignment not being graded and you receiving no marks for this assignment. In particular do not submit an MS Word or OpenOffice file as your answers document!

Don't forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resources. You do not need to list help from the instructor, TA, or information found in the textbook.

Questions

  1. [1] What is the difference between function calls and library calls (as reported by ltrace)?
  2. [2] In assembly, how does a program make a function call (using C semantics)? Describe the process and state the specific instructions used in x86 assembly code.
  3. [3] Write a program "syscall-hello-pid.c" that is based on syscall-hello.c but outputs "Hello, I am process 417!" (assuming the PID of the process running it is 417). Note that you will have to get the current process ID, convert it to a string, and combine it with the "Hello" string. USE NO LIBRARY FUNCTIONS except syscall().
  4. [4] Add a comment to every line of the assembly code version of your syscall-hello-pid.c code, as produced by gcc -s, explaining the purpose of each line. Explain with reference to the C code, not the assembly code. For example, a change in the stack pointer should be notated as "allocate space for local variables x and pid" not "changed the stack pointer". You may want to add in flags such as "-O2" and "-g" to get easier to interpret assembly code. You may ignore/delete all lines that start with a period, as those do not generate code directly. If you had trouble with the previous question, you may instead comment the assembly from syscall-hello.c, but at the loss of one point (out of 10).