COMP1521 18s1 COMP1521 18s1 Final Exam Comp Sys Fundamentals
[Instructions] [Documentation]
[Q1] [Q2] [Q3] [Q4] [Q5] [Q6] [Q7] [Q8] [Q9] [Q10]

Question 8 (4 marks)

Answer the following in at most one or two short, clear sentences.

  1. At the C program level, system calls look like regular function calls. What is the critical difference between a regular function call and a system call?

  2. In the C language, as implemented on Linux/Unix ...

    1. What pair of functions are used to create and destroy dynamic data objects (i.e. objects in the heap)?

    2. What is the lifetime of a dynamic data object (i.e. how long does it persist in memory)?

  3. Consider the following C program:

    int main()
    {
       fork();
       fork();
       printf("Hello\n");
       return 0;
    }
    

    How many times will the word "Hello" be printed?

    You can assume that the program compiles and runs without any errors.

  4. What is/are the possible return value(s) from ...

    1. the fork() system call?

    2. the execve() system call?

Type your answers to this question into the appropriate place in the q8.txt file, and submit it using the command:

submit q8

This will make a copy of the q8.txt file as your answer for this question. You can run the submit command as many times as you like, but only the most recent submission will be marked.