CSE 451
Operating Systems
Spring 1998
Quiz #2
Distributed : 4/14/98 (Tuesday)
Due
: 4/16/98 (Thurday -- in the begining of the Section)
Consider the following C program:
-----------------------------------
static int someData[100];
main(int argc, char ** argv)
{
int x = 0;
foo(argc, argv[1]);
x = 23;
exit(0);
}
void
foo(int p, char *q)
{
someData[0] = p;
}
------------------------------------
-
For the above program, indicate where each variable is allocated (stack,
heap or static data)
-
Show the contents of memory (ie the text, static data and stack)
for each of the following points in the execution of this program:
-
After the process has been spawned (execed) but before main()
has started
-
Right before the call to foo()
-
After the assignment of 23 to x
-
After the call to exit()