Describe how new processes come into being: how do existing processes make new ones, and what is the operating system's role? You only need a few sentences.
This is a brief C exercise. (The labs will require comfort and fluency in C.) Below is a snippet of code:
void op1(int a, int b) { a = a + b; } void op2(int* a, int* b) { *a = *a + *b; } int main() { int a = 1, b = 1, c = 1, d = 1; op1(a, b); op2(&c, &d); return 0; }
What are the values of a
, b
,
c
, and d
right before the program exits?
Since the purpose of this exercise is to build your skills, you should
do this problem without compiling and running the program.
Operations on files, such as read, write, and close, are typically implemented as system calls. Describe two of the benefits of having these operations managed by the operating system instead of individual processes.
Below is another snippet of C code:
int a[5]; a[0] = 0; a[1] = 10; a[2] = 100; //COMMENT 1 a[3] = *a + 2; a[4] = *(a + 2); //COMMENT 2
What are the values stored in the array a
when the program reaches COMMENT 1? (Do we know all
of the values?) What about when the program reaches COMMENT 2?
Write your answers in a text file. Name the file answers.txt and upload it on GauchoSpace.
Last updated: 2020-03-30 11:00:17 -0700 [validate xhtml]