Question 1 -- 10 points


Behold the following C program:
main()
{
  int i;
  int *ip;
  char s[100];

  i = 100;
  write(i, &i, 4);
  ip = (&i) + 1000000;
  write(1, ip, 4);
  *ip = i;
  sprintf(s, "%d\n", *ip);
  write(1, s, strlen(s));
}

Suppose this program is running in JOS. Explain in detail exactly what happens from the time that the program begins executing until it finishes. This should include all interactions between the program and the operating system, and what the result of these interactions is. You should also include what the output of the program should be.