Lab 9: The /proc Filesystem

In this lab, we will learn about the /proc filesystem. We will use the /proc filesystem to detect deadlock in an instance of the dining philosopher's problem.

Issues addressed by this lab include:

 

Lab Materials
  1. Slides
  2. Lab Files
Assignment

For this lab, you need to complete the implementation of the dine program. This program behaves identically to the program we saw in Dining Philosophers lab, but instead of using global state to detect deadlock, we will use information from the /proc filesystem.

We should be able to build the program using a Makefile submitted with your solution. An example output of running dine is shown below:

	 [gumapath-$] ./dine 

	 User time:	169 / 169	178 / 178	210 / 210	191 / 191	201 / 201	
	 System time:	5 / 5		5 / 5		8 / 8		7 / 7		5 / 5		
	 
	 User time:	156 / 325	125 / 303	170 / 380	166 / 357	178 / 379	
	 System time:	9 / 14		7 / 12		6 / 14		6 / 13		7 / 12		

	 User time:	146 / 471	171 / 474	192 / 572	155 / 512	171 / 550	
	 System time:	8 / 22		8 / 20		7 / 21		5 / 18		5 / 17		
	 
	 User time:	152 / 623	187 / 661	199 / 771	155 / 667	174 / 724	
	 System time:	4 / 26		7 / 27		7 / 28		5 / 23		5 / 22	

 

Submission

After you have finished your implementation, you need to complete a short report that answers the following questions:

  1. Is lack of change in system and user time in between sampling periods a guarantee that deadlock has occurred? Explain briefly.
  2. What aspects of the system conditions would affect how long the sampling period should be to ensure a reliable assessment of whether deadlock has occurred or not.
  3. Informal experimentation tends to show that larger values of ACTIVE_DURATION make deadlock less likely, as indicated by how many sampling periods it takes to occur, and that smaller values make it more likely. Try a few different values yourself and then discuss whether you think this is true, and why you think it might have the influence you observe.
You also need to tar up your lab for submission. For this step, you should use the 'tar' target included in the lab's Makefile. Change the STUDENT_ID variable in the Makefile to your student ID and type:
    make tar
	  

Finally, submit the tar file containing your lab directory as well an electronic copy of your report (pdf please).

< Back to the Lab Home Page