The University has specific recommendations on how to deal with students who copy code from other students for assignments, and for the students who allow the code to be copied. And we have automatic tools that detect copying, so you will be caught. Students have gotten F in the course in the past, so DON'T DO IT.
If you have trouble submitting, DO NOT EMAIL CODE TO THE TAs. You MUST wait for your disk partition to be cleared and then use the 402submit program again. This means you should PLAN YOUR WORK ACCORDINGLY - do not work right up until the deadline!
Much more recommended is to use the code browsing facility in Emacs enabled by creating tags as described below.
If you really want to print the code, first, go into the Makefile and find the line that says "LPR = lpr", and change it to read "LPR = lpr -Pxxxx", replacing "xxxx" with the name of the printer you want to use. Then type
cd nachos-csci402/code gmake print
cd nachos-csci402/code etags -t `find . \( -name '*.c' -o -name '*.cc' -o -name '*.h' \)`In Emacs, you can then use M-. to find the highlighted symbol's definitions. This is very cool, since it allows you, while reading the code to jump into the definition of a subroutine from the place where it is used.
ld.so.1: nachos: fatal: libucb.so.1: can't open file: errno=2
#!/bin/csh
#
if ( ${?LD_LIBRARY_PATH} ) then
setenv LD_LIBRARY_PATH /usr/ucblib:$LD_LIBRARY_PATH
else
setenv LD_LIBRARY_PATH /usr/ucblib
endif
It's a known limitation of our configuration. It's actually the
linker that's screwed up.
Have him put the following in his test directory, called nachos.ld and
change -T script to -T ./nachos.ld to his LDFLAGS. Works like a
charm, and took me forever to find. :-) (Most people don't have the
problem, so I didn't put the code in the tarball.)
SEARCH_DIR(/vex/gnu/decstation-ultrix/lib);
ENTRY(__start)
SECTIONS
{
.text : {
_ftext = . ;
*(.init)
*(.text)
etext = .;
_etext = .;
}
.data : {
*(.rdata)
*(.data)
*(.sdata)
*(.scommon)
}
.bss : {
*(.bss)
*(.sbss)
*(COMMON)
}
end = .;
_end = .;
}
Broadcast() signals ALL of the processes waiting on a condition variable.
However, note that in no case should a process actually be allowed to release a lock that it isn't holding!
You should be able to get allocate() and release() to break with appropriate insertions of Yield statements.
That said, here are some suggestions. One is you can have one thread exist for each Missionary or Cannibal that is there -- in other words, if you have 10 missionaries and 5 cannibals waiting for a boat, there would be 15 threads. Another way you can do it is have a Missionary thread and Cannibal thread; and each one keeps track of how many of its kind of people are waiting -- in this case, there would be 2 threads no matter how many missionaries and cannibals there are.
These are just two suggestions. You can do something else if you have a better idea, as long as it inolves multiple threads that are communicating via locks and condition variables. (Well, I should say you can do ALMOST anything else... silly solutions will not get points.)
legal: nachos -x noff_filname // defualt NRU nachos -P LRU -x filename // LRU -- NRU, RAND, FIFO also okay illegal: nachos -P filename // **ILLEGAL** nachos -P LRU noff_filename // **ILLEGAL** nachos -P -x noff_filename // **ILLEGAL
Assuming your memory is larger than 3 physical pages, this should never be a problem with with LRU, will usually not happen with NRU, and should never happen with FIFO. With Random, if you are very unlucky this might keep happening over and over again, leading to "livelock" (starvation), so if you like you may explicitly remove the pages involved in the current instruction from the list of candidate pages for ejection from physical memory. However this check is not required by the assignment.
Most implementations don't have these types of page faults, so this statistic will most likely simply be 0.
From the spring 2006 semester is a very good thread on this. Here it is.