CS307 Assignment, due on paper at class time, Friday, 4/28/00

You may talk to other students about this assignment, but I want each of you to write your own code and hand in your own write-up.

  1. Describe in as much detail as you can the layout of the virtual address space as it is used by the versions of Linux and gcc/g++ in our labs. You can print out addresses:

    
    	#include 
    	...
    	cout << "0x" << hex << (unsigned int)(ptrofsomekind) << endl;
    
    or
    
    	#include 
    	...
    	printf( "0x%x\n", (unsigned int)(&i) );
    

    You can also use the gnu debugger gdb to get a better look at where the stack pointer points, where global variables are located, etc.

    I'm particularly interested in knowing

    But please tell me about anything else you learn.

  2. If a Linux process is blocked and it receives a signal for which it has registered a handler, does the handler get called? If so, does the process return to blocked state after the handler is done, or does the signal unblock the process permanently? Give me a printout of the code you used to answer this question (make it as simple as you can).

  3. Do the semaphores available with our version of Linux collect blocked processes in a first-in-first-out fashion, first-in-last-out, or some other more random way?

  4. Using what you learned in the previous question, write the simplest program you can that will do the following:

    You may use the Up and Down functions from norace.c if you wish.

    Hand this program in via HSP.





Jeff Ondich, Department of Mathematics and Computer Science, Carleton College, Northfield, MN 55057, (507) 646-4364, jondich@carleton.edu