CS 162 - Nachos Operating System

Although it was the toughest project I did (for class, not including research), I really enjoyed doing it. The goal of this project is to build an operating system with virtual memory, network layer, a terminal and many more.

Lecture Notes
Lecture
Matt Welsh Discussion Notes
Mike Chen Discussion Notes

Phases

Project 1
Simulation on many riders and many elevators with threads

Project 2
We implemented file IO system call, lottery Scheduler
Project 3
A program has infinite virtual memory provided by nachos, we can run c program from our nachos shell

Project 4
We implement TCP like network transport Layer and we write a chat program on top of that

Autograder

There is an invicible Autograder. I don't know how many times we submit.. All we hoped for is this
From cs162-ra@pasteur.EECS.Berkeley.EDU Wed May 15 05:00:20 2002
Received: from pulsar.CS.Berkeley.EDU (pulsar.CS.Berkeley.EDU [128.32.42.24])
	by pasteur.EECS.Berkeley.EDU (8.9.3+Sun/8.9.1) with ESMTP id FAA12337;
	Wed, 15 May 2002 05:00:19 -0700 (PDT)
Received: (from cs162-ra@localhost)
	by pulsar.CS.Berkeley.EDU (8.10.2+Sun/8.10.2) id g4FC0KO11629;
	Wed, 15 May 2002 05:00:20 -0700 (PDT)
Date: Wed, 15 May 2002 05:00:20 -0700 (PDT)
From: Grader 
Message-Id: <200205151200.g4FC0KO11629@pulsar.CS.Berkeley.EDU>
To: cs162-bn@pulsar.CS.Berkeley.EDU, cs162-bp@pulsar.CS.Berkeley.EDU,
        cs162-ez@pulsar.CS.Berkeley.EDU, cs162-gh@pulsar.CS.Berkeley.EDU,
        cs162-nx@pulsar.CS.Berkeley.EDU
Subject: Successful test for submission of assignment proj4-code on Tue May 14 22:42:00 2002
Content-Length: 5979
Status: RO
X-Status: 
X-Keywords:                 

Your submission of assignment proj4-code at Tue May 14 22:42:00 2002 successfully
compiled and passed our tests.  The log is appended.

This is an automated account; please do not respond to it.


Log:
--------------------------------------------------
--PARTNERS: cs162-bn cs162-bp cs162-ez cs162-gh cs162-nx

--PARTNERS: -bn -ez -bp -nx -gh

gmake[1]: Entering directory `/tmp/grdtst20000'
javac -classpath /home/ff/cs162/autograder/proj4-code/classes:./classes -d ./classes -sourcepath . nachos/threads/ThreadedKernel.java
javac -classpath /home/ff/cs162/autograder/proj4-code/classes:./classes -d ./classes -sourcepath . nachos/threads/SynchList.java
javac -classpath /home/ff/cs162/autograder/proj4-code/classes:./classes -d ./classes -sourcepath . nachos/userprog/UserKernel.java
javac -classpath /home/ff/cs162/autograder/proj4-code/classes:./classes -d ./classes -sourcepath . nachos/vm/VMKernel.java
javac -classpath /home/ff/cs162/autograder/proj4-code/classes:./classes -d ./classes -sourcepath . nachos/network/NetKernel.java
javac -classpath /home/ff/cs162/autograder/proj4-code/classes:./classes -d ./classes -sourcepath . nachos/network/PostOffice.java
gmake[1]: Leaving directory `/tmp/grdtst20000'
starting test net-101 23
starting test net-102 22
finished test net-101
starting test net-103 21
finished test net-102
starting test net-104 20
finished test net-103
starting test net-105 19
finished test net-104
starting test net-106 18
finished test net-105
starting test net-107 17
finished test net-107
starting test net-108 16
finished test net-108
starting test net-109 15
finished test net-109
starting test net-110 14
finished test net-110
starting test net-201 13
finished test net-106
starting test net-202 12
finished test net-202
starting test net-203 11
finished test net-201
starting test net-204 10
finished test net-204
starting test net-205 9
finished test net-203
starting test net-206 8
finished test net-205
starting test net-301 7
finished test net-206
starting test net-302 6
finished test net-301
starting test net-303 5
finished test net-302
starting test net-401 4
finished test net-303
starting test net-402 3
finished test net-401
starting test net-405 2
finished test net-402
starting test net-408 1
finished test net-405
starting test net-501 0
finished test net-501
finished test net-408
------------------------------------------------------------

Running test net-101...
connect/accept

Test net-101 succeeds.
------------------------------------------------------------

Running test net-102...
connect/accept, then close

Test net-102 succeeds.
------------------------------------------------------------

Running test net-103...
connect blocks until connected

Test net-103 succeeds.
------------------------------------------------------------

Running test net-104...
can make multiple connections to same remote host/port

Test net-104 succeeds.
------------------------------------------------------------

Running test net-105...
can make multiple simultaneous connections to same remote

Test net-105 succeeds.
------------------------------------------------------------

Running test net-106...
can reconnect to same remote host/port many times

Test net-106 succeeds.
------------------------------------------------------------

Running test net-107...
try to connect to invalid host

Test net-107 succeeds.
------------------------------------------------------------

Running test net-108...
connect to port on local host

Test net-108 succeeds.
------------------------------------------------------------

Running test net-109...
accept does not block

Test net-109 succeeds.
------------------------------------------------------------

Running test net-110...
close does not block

Test net-110 succeeds.
------------------------------------------------------------

Running test net-201...
read/write work

Test net-201 succeeds.
------------------------------------------------------------

Running test net-202...
read returns -1 once connection closed by remote host

Test net-202 succeeds.
------------------------------------------------------------

Running test net-203...
read returns queued data even after connection closed by remote

Test net-203 succeeds.
------------------------------------------------------------

Running test net-204...
read does not block

Test net-204 succeeds.
------------------------------------------------------------

Running test net-205...
small write does not block

Test net-205 succeeds.
------------------------------------------------------------

Running test net-206...
read treats queued data as byte stream

Test net-206 succeeds.
------------------------------------------------------------

Running test net-301...
dropping packets during connection establishment

Test net-301 succeeds.
------------------------------------------------------------

Running test net-302...
dropping packets during connection establishment

Test net-302 succeeds.
------------------------------------------------------------

Running test net-303...
dropping packets during connection establishment

Test net-303 succeeds.
------------------------------------------------------------

Running test net-401...
one-way bulk data transfer

Test net-401 succeeds.
------------------------------------------------------------

Running test net-402...
two-way bulk data transfer

Test net-402 succeeds.
------------------------------------------------------------

Running test net-405...
make sure send window size is 16 packets per connection

Test net-405 succeeds.
------------------------------------------------------------

Running test net-408...
transfer one byte at very low network reliability

Test net-408 succeeds.
------------------------------------------------------------

Running test net-501...
dropping packets during connection termination

Test net-501 succeeds.
--------------------------------------------------
24/24 tests passed


All tests passed.

Submission

This is a submission script I wrote to keep track of everyone submission and autograder result. Here is the log

cs162-nx's Submission

Date: Tue Apr 23 21:44:33 PDT 2002
Code: proj3-code
Description: terence: first try!
AutoGrader Result: Result



cs162-nx's Submission

Date: Tue Apr 23 22:19:03 PDT 2002
Code: proj3-code
Description: terence: without the true flag
AutoGrader Result: Result



cs162-nx's Submission

Date: Tue Apr 23 22:40:13 PDT 2002
Code: proj3-code
Description: terence: with the lock in rwhelper fix
AutoGrader Result: Result



cs162-nx's Submission

Date: Wed Apr 24 00:15:21 PDT 2002
Code: proj3-code
Description: terence: my mother fucking fix on save tlb, Be ARCH
AutoGrader Result: Result



cs162-nx's Submission

Date: Wed Apr 24 00:42:56 PDT 2002
Code: proj3-code
Description: terence: fix minor error
AutoGrader Result: Result



cs162-nx's Submission

Date: Wed Apr 24 01:11:19 PDT 2002
Code: proj3-code
Description: terence: fix on save to tlb functions
AutoGrader Result: Result



cs162-nx's Submission

Date: Thu Apr 25 15:08:01 PDT 2002
Code: proj3-code
Description: terence: last relieve .. i am going to sleep now
AutoGrader Result: Result



cs162-nx's Submission

Date: Fri Apr 26 11:21:41 PDT 2002
Code: proj3-code
Description: terence: fix bug in usingmem
AutoGrader Result: Result



cs162-nx's Submission

Date: Fri Apr 26 11:36:10 PDT 2002
Code: proj3-code
Description: terence: final submit
AutoGrader Result: Result



cs162-nx's Submission

Date: Wed May 8 01:03:59 PDT 2002
Code: proj4-code
Description: terence: code done, lots to be done
AutoGrader Result: Result



cs162-nx's Submission

Date: Wed May 8 04:33:16 PDT 2002
Code: proj4-code
Description: terence: not infinite loop in checkifstuffexit,
AutoGrader Result: Result



cs162-ez's Submission

Date: Wed May 8 12:01:33 PDT 2002
Code: proj4-code
Description: tried to fix accept - EL
AutoGrader Result: Result



cs162-ez's Submission

Date: Wed May 8 15:54:21 PDT 2002
Code: proj4-code
Description: tried to fix close
AutoGrader Result: Result



cs162-ez's Submission

Date: Wed May 8 22:51:30 PDT 2002
Code: proj4-code
Description: thried to fix close - EL
AutoGrader Result: Result



cs162-ez's Submission

Date: Wed May 8 23:40:09 PDT 2002
Code: proj4-code
Description: wondering why connection fails
AutoGrader Result: Result



cs162-ez's Submission

Date: Thu May 9 10:14:00 PDT 2002
Code: proj4-code
Description: tried to fix read/write - EL
AutoGrader Result: Result



cs162-ez's Submission

Date: Thu May 9 13:59:08 PDT 2002
Code: proj4-code
Description: tried to fix bulk data transfer
AutoGrader Result: Result



cs162-ez's Submission

Date: Thu May 9 15:09:05 PDT 2002
Code: proj4-code
Description: trying to fix multiple connections
AutoGrader Result: Result



cs162-nx's Submission

Date: Thu May 9 19:31:32 PDT 2002
Code: proj4-code
Description: terence: timeout: 1000, 500, 500
AutoGrader Result: Result



cs162-ez's Submission

Date: Fri May 10 05:31:57 PDT 2002
Code: proj4-code
Description: please work!
AutoGrader Result: Result



cs162-ez's Submission

Date: Fri May 10 06:04:32 PDT 2002
Code: proj4-code
Description: changed timeouts to 20000, NetProcess to use NetKernel.ConnectTimeOut
AutoGrader Result: Result



cs162-ez's Submission

Date: Fri May 10 09:59:30 PDT 2002
Code: proj4-code
Description: timeouts = 20000, connecttimeout = 20
AutoGrader Result: Result



cs162-nx's Submission

Date: Sun May 12 04:30:43 PDT 2002
Code: proj4-code
Description: terence: fin timeoutconnection implemented
AutoGrader Result: Result



cs162-nx's Submission

Date: Sun May 12 05:15:10 PDT 2002
Code: proj4-code
Description: terence: connect timeout 20
AutoGrader Result: Result



cs162-nx's Submission

Date: Sun May 12 14:38:00 PDT 2002
Code: proj4-code
Description: terence: 24 tests ALL PASSED without fin implementation
AutoGrader Result: Result



cs162-ez's Submission

Date: Tue May 14 01:23:18 PDT 2002
Code: proj4-code
Description: new NetKernel
AutoGrader Result: Result



cs162-bn's Submission

Date: Tue May 14 22:44:30 PDT 2002
Code: proj4-code
Description: final final submission
AutoGrader Result: Result



Log File

This is how we communicate. Instead of email back and forth, We use cvs and this log file to communicate. We do everything entirely online.
****************************************************
Terence May 17 12:04 PM
The page has moved. if you still want to edit the file
go to ~terence/cs162/log.html
the code in result.html will not work any more. i delete them all to
save space.

****************************************************
Terence May 16 2:07 PM
i am going to back up my account now, so i won't forget. 
if you care, the nachos backup will be in www.inst.eecs/~terence/cs162
thanks a lot for everything. good luck on your finals

if you want to backup your file do
tar cpvf ~/`whoami`.tar ~

****************************************************
Amy May 16 1:14 AM

i submitted final design doc.
remember to do ur evaluation too.

****************************************************
Amy May 15 3:19 PM

is part 1 design doc finished?

****************************************************
Amy May 14 7:21 AM

if anyone wants to submit plz update ur nachos/test dir first
(Makefile, get.c, chat.c, chatserver.c, movearray.c,
readlinefrombuffer.c, make sure u have the newest of those)

****************************************************
Terence May 13 5:44 PM
let's get the design doc done tongiht, people! i have no time to
spend on this anymore. so yea. be online around 9?
I will keep on try to solve that last test, k?
micheal: could you do the destroy fd thing? maybe that is related to
test 106.
elaine: could you start writing design doc?

anyways, be online at 9 k?

amy and katherine: would be nice if you could tell us what's going
on..


here is the result of having timeout and different test result

http://www-inst.eecs/~cs162-nx/weird.txt

****************************************************
Terence May 12 5:02 PM
we do need to take care of that because of the timer speicfied in the
specs. but by doing this we failed two test. the autograded is loaded
right now. so let's plan to work at 2 am again, k? get some sleep
before we start work
elaine, if you want to join us...

****************************************************
Michael May 12 1:10 PM

Emil responded and said if the Fin or FinAck packet get lost it's ok.
For our first example, if A and B are established, A close and the fin
packet is lost, A is closing and B is in established. If B write, it
won't return -1 and that is correct because it still thinks he is in
the established state and the data was successfully enqueued.

I'm going to work on destroy FD right now.
****************************************************
Terence May 11 6:37 PM
one more thing to do
destroy fd
test fin/finack when there is actually data. and become -1?
micheal could you do that?

****************************************************
Michael May 11 7:20 PM

Terence: I was trying to track amy's problem. I think it might be
doSendAck. Does doSendAck really keep sending Acks if there is no
data? It might possibly speed things up, but it isn't in the protocol.
The biggest problem is, after the sendqueue on the serverside is
closed, it sends a FIN. But if doSendAck keeps sending data, you'll
get a violation. I see two possible fixes to this, don't know which
one you'll want. First possible fix is to only sendack when you get
data. So if packets are dropped, you might recover a little bit slower
because only the side sending data can keep resending. Second solution
is more complicated. We can do what we're doing for now, and then turn
dosendack off when an STP is sent/recieved. There are more little
details in the second one that I haven't completely sorted out
yet. Personally I prefer the first one because it is simpler and
follows the protocol, although we might get slightly better
performance if we try the second one.

Next question: When I clear the sendbuffer. Does this clear
everything? Or will resend data still send Data that has timed out? 
****************************************************
Amy May 11 2:45 PM

ok i m having some technical difficulties now...
i was wondering for dataack....it seems like it is sent no matter what
state it is in? what i mean right here is that it seems like it is
sending an DATA_ACK even right after FIN is sent....and this gives me
a violation...
i will work on this later tonight...this is just going way to slow...

****************************************************
Terence May 11 11:27 AM
 if you are suspecting there is a bug in vm stuff, change network to
extend user ... i am not really sure. (which i do agreed that vm is
buggy) could you give the vaddr that cause that? it is also possible
that it is a 'seg fault' in the c program. happen to me before (right?)
 
****************************************************
Amy May 11 11:02 AM

I just want to check if all the files in cvs up to date...just
checking...cuz need the latest to run against part 2...
i m getting this really weird bugs right now...not sure if it is my
implementation for part 2 or not yet...still checking right now:
java.lang.NullPointerException
	at nachos.userprog.UserKernel.isEntryValid(UserKernel.java:73)
	at nachos.vm.VMProcess.rwHelper(VMProcess.java:143)
	at nachos.userprog.UserProcess.readVirtualMemory(UserProcess.java:249)
	at nachos.userprog.UserProcess.handleWrite(UserProcess.java:938)
	at nachos.userprog.UserProcess.handleSyscall(UserProcess.java:1038)
	at nachos.network.NetProcess.handleSyscall(NetProcess.java:92)
	at nachos.vm.VMProcess.handleException(VMProcess.java:344)
	at nachos.userprog.UserKernel.exceptionHandler(UserKernel.java:231)
	at nachos.userprog.UserKernel$1.run(UserKernel.java:178)
	at nachos.machine.Processor$MipsException.handle(Processor.java:603)
	at nachos.machine.Processor.run(Processor.java:101)
	at nachos.userprog.UThread.runProgram(UThread.java:32)
	at nachos.userprog.UThread.access$0(UThread.java:28)
	at nachos.userprog.UThread$1.run(UThread.java:20)
	at nachos.threads.KThread.runThread(KThread.java:160)
	at nachos.threads.KThread.access$0(KThread.java:158)
	at nachos.threads.KThread$1.run(KThread.java:151)
	at nachos.machine.TCB.threadroot(TCB.java:204)
	at nachos.machine.TCB.access$0(TCB.java:181)
	at nachos.machine.TCB$1.run(TCB.java:71)
	at java.lang.Thread.run(Thread.java:484)
****************************************************
Elaine May 11 12:31 AM

Test cases for tests 207,208, 406, 407 in nachos/test.
Could someone make sure the tests are sufficient?

****************************************************
Terence May 10 2:43 PM
i find a bug
so we need to finish up. tests throughtly the autograder doesn't
have. ask if amy need help

****************************************************
Elaine May 10 10:51 AM

Okay. We now pass 23/24 tests. I have submitted the same
code a couple of times to make sure the results are 
consistent. The test we are not passing is "read queued
data after close."

I believe the problem was in lookAndGet in VMProcess,
I didn't return a te if I found a pageFault besides the 
first page fault, so please update that too.

There is still a assertion error in VM, but increasing
physical pages to 32 should take care of that, not sure
why that appears.

****************************************************
Elaine May 9 9:30 PM

Sorry. A lot of my fixes are little hacks, so it is not
modular or neat. When I submit and it is trying to tar up the file,
it gives a segmentation fault, I am not sure why.

Sorry for not indenting.

I am also confused by apparently non-deterministic errors.
Emil says we should submit the same code a couple of times
and see if any fail sometimes.

The reason I put TLBMiss lookAndGet is because when we
call openFile.read(), it will sometimes go to another page
and then since the next entry is not in the table, it returns
invalid entry, and returns right away without reading the
rest of the data.

The reason I call handleRead first, is because I want to 
return -1 right away if the connection is closed, otherwise
it tries to read some data. I wouldn't do that, but I can't
distinguish files from connections. 

****************************************************
Terence May 9 7:10 PM
i noticed that elaine. all your submission's tarfile has 0 bytes. is
there anything wrong with your submission?

will be back aroun 12.. let's do big debug

we passed 21 tests.. sometimes....

let's get dis done !!! WE CAN DO IT! i will work on it very seriouysly!

****************************************************
Terence May 9 4:21 PM
why in the cleanupLoop became cleanUpSemaphore.P() again?
did it work without it? if so, i am very surprise. it passed all the
test.. may be that's why it did not passed the reliaability test
because the timeout thing doesn't work anymore.

don't forget to clean up the total thing after we are done debuging

elaine: please please please indent your code before you put it in
cvs. it gives a lot a lot of conflicts. there is a indent thing in the
emacs menu

elaine: good job on that finding seqno bug. let me fix it, k?

the method handlerRead.. should it be handleRead?

i fix seqNo

elaine: why did you put TLBMiss in lookatget? it is just not the right
place to put that k? track where that come from and put it there
instead.
... well, i don't care
anymore since we are not going to build anything on top of anything
anymore. but just a general advise. method is just supposed to do what
it is supposed to do. i expect you know from code compelte right?

elaine: but good job on finding that seqno bug though

so look at the stuff i mentioned about.. i didn't realy change it
except for the stuff in mailmessage

for you handleread. is it right to do if openfile.read(temp....) == -1
return -1
else super.handleRead? that sounds weird. because super.handleread
will call openfile.read again... really doubt...

****************************************************
Elaine May 9 2:53 PM

Nevermind, does not work for reliabilty < 1.0. Also,
there are random assertion errors when running test cases
like netTest15, netTest3, that come every once in a while.

****************************************************
Elaine May 9 2:00 PM

Okay, I think I fix the seqNo problem, someone please
check, just run selfTestSeq in NetKernel, with some
numbers. Also, it will now run netTest15 (bulk transfer
of 6000 bytes to completion) I will work on it more
tonight.

****************************************************
Elaine May 9 1:15 PM

I changed VMProcess.lookAndGet b/c there is was an
error when you try to read/write from more than one
page. Someone please check to see if it is right.

****************************************************
Elaine May 9 11:40 AM

I don't think that is the main problem. Actually it is 
hard to tell right because

On further testing,
I discover that the seqNo are set wrong. There are sign
errors in setSeqNo, and getSeqNo so that after you go
past 127, the seqNo are screwed up! It starts going negative,
then postive after another 127, so that in receiveData
we continually drop packets 128-256 b/c they are negative
and under the receiveWindow...then once the numbers are positive
again, the packets are beyond the receive windows, so we
drop everything.

Could someone take a look at it? I will try to fix after
discussion.

****************************************************
Terence May 9 11:30 AM
good! micheal. let's talk about it tonight

****************************************************
Elaine May 9 9:05 AM

Processor.pagesize is 1024 bytes.

I will take a look at read/write.

****************************************************
Michael May 9 2:46 AM

How big is Processor.pagesize? The reason I'm asking
is because that's the size of the buffer that's passed
to write each time. I'm assuming it is going to be smaller
than 7000.

See if this makes sense to you guys. If I call write(7000)
handleWrite breaks it into 7000/Processor.pagesize writes.
Then connection.write breaks this down into 
Processor.pagesize/packetpayloadsize number of packets. Except,
I really doubt they divide evenly so every single iteration of
Connection.write will have a packet at the end with missing stuff.
This is normally fine because the length is included as the first
byte of the payload.

However, if someone calls read(7000) at the other end, it's going to
expect 7000 seemingly consecutive bytes. But the way the window
shifts/calculates number of packets recieved, is by dividing
totalbytesrecieved by the number of bytes per packet. Because of these
packets which aren't completely filled, the window slowly shifts less
and less. Anyone see what I mean?

Another possible error is where it calculates current packet index
because it just takes poswhereleftoff and divides by payload size
except not all packets are garunteed to have a payload of the same size.

I'm actually oversimplifying because I'm looking at doCopy right now
and am not absolutely certain how endofpacket, restofpacket, and
poswhereweleftoff all relate to each other. If elaine or terence could
take a look it would be great.
****************************************************
Elaine May 9 12:56 AM

Very weird....I fail the first test, then when I submit
I include the swapfile and pass that test. This is so
non-deterministic! 

I changed part of handleRead/Write in userprog, so please
update there too.

Still failing bulk transfer...not sure why.
The read after close and read byte at low reliability.

****************************************************
Elaine May 8 8:27 PM

I believe accept is ok now. I am not sure why we are
failing the test that says can't read after the connection
is closed, any ideas?

****************************************************
Terence May 8 6:15 PM


you got to copy to your own directory first. of course it is not going
to work if you untar in my directory. in the worse cases, copy it to
you computer, and use winzip to open it k?
i don't know what else i can tell you

could you produce a test cases that will have that situation: cannot
accept.... blah..


****************************************************
Elaine May 8 3:11 PM

This is what it says when i try tar -xvf 
"tar: cannot open
/home/cc/cs162/sp02/class/cs162-nx/public_html/be_arch/.. Permission
denied..."

i will change the order in fd.setClose() in UserProcess to set the
fileDescriptor to false first before calling openFile.close()

It seems to work okay for all cases i run on 1.0 reliability, i 
will test with less reliability...i am not sure why we keep
running out of time for the autograder.

I was testing simple connect/accept read/write. It does go pretty
slow for many processes trying to connect to one server.

Actually, can someone run netTest14 (only Network(0)) and see
if they get garbage? Try it a couple of times. I am trying
to close the fileDescriptor and still read from the not closed
end. Tell me if the behavior is correct.

It is like netTest13 (which works correctly) except in netTest13,
I wait until everything is written until I start reading.

****************************************************
Terence May 8 12:40 AM
don't undrestnad why you are the one who create the file (when you
download it) why would it say permission denied

again download the file
gunzip file.tar.gz
tar xvf file.tar

elaine, is there any tests cases that does not work?

hey guess what? just an idea when you are close, better remove that file
descriptor! so no one could read or write to it


****************************************************
Elaine May 8 12:19 PM

I tried to fix handleAccept....I found that the equals
function for Connection was not right. Could someone check
that I changed it correctly?

Terence: I download the tar file from the webpage, but when
I tried to un-tar? it says permission denied.
Or could you update your latest version...I fail connecting
to local host test, but yours passed.

****************************************************
Terence May 7 7:23 PM
no, that's not what i mean. if you don't sleep, doesn;t mean you need
to busy wait, right? as i said use the timeoutconnection class. you
cannot sleep in the receiver thread!

there are still some bugs in getackbitmap, setackbitmap, someone fix
it please!

****************************************************
Michael May 7 6:08 PM

Errr, close cannot start destroying things until all the messages are
sent. So are you saying instead of having it sleep/alarm, I should
have it busy wait? Sounds a lil inefficient, but just want to make
sure that's what you mean before I do it.

Unless someone else sees another solutoin, I'd be glad to hear it.
****************************************************
Terence May 7 5:15 PM
I read what micheal wrote about close. i looks good, BUT PLEASE PLEASE
do not sleep or use alarm because this is the receiving thread. if you
sleep, it will not get any messages. 
the reason why i have the timeoutconnection module is to do such
thing. it 'post' an event and some thread will pick it up after
certainly period of time
more bugs in mailmessage, bitmap.. it involved in extending

****************************************************
Amy May 7 5:05 PM

terence: well i guess it is the same idea...the prob was it didn't
really catch that null pointer bug b/c u r only using 1 link address
(0)...and i think elaine said she fixed it...anyways...will work on it
later tonight

****************************************************
Terence May 6 12:40 PM

I put an lock around the sendData stuff
if i get an ack of seqno 2, remove everything before it
why is cpDataFromMessage (at the end, it has the amound you copied)
when is the cases that we need a offset from the mailmessage

elaine: could you either explaine why you need that extra offset at
the end or remove that line. if you have a reasonable explanation,
remove my line in read.

amy: i shouldn't make much different whether using one nachos w/ 2
process or two nachos w/ 1 process.

so how is close? I will work on this unil four and i have to do
something else..

Please do update before you commit!

why do you need a seqno in a stp?

i rewrite mailmessage decode for dataack. it did not work at all for
the original version

****************************************************
Elaine May 6 11:05 AM

Was the null pointer in handleDataAck or handlePacket? If so,
I think I fixed it, it was in Connection class. I notice that
for sendStp, we do not put a seqNo in, I will add that.

****************************************************
Amy May 6 7:57 AM

terence: remember i was saying there's a null pointer, that is b/c i
was actually running two different nachos (so 2 netkernels), and u r
running 1 nachos w/ 2 processes, so u r not really doing remote
connect...(seems like the sender has sent a dataack after it sends data)

****************************************************
Elaine May 6 8:36 PM

I don't see what is wrong with the old handleClose. It
does the same thing as the new one, someone correct me
if I'm wrong. In the new handleClose, freeFD needs to be
updated along with openFileNames array, but that is 
already done in original handleClose. 

****************************************************
Michael May 6 7:55 PM

Looked at read again, made one small change.

Made some large changes to stop/finish module, I'm not sure
how "safe" these changes are.

First, I wrote a new handleClose in NetProcess.java because I
do'nt think the old one will work in this case. Then I took 
the handleClose in NetKernel and copied most of it into
Connection.close and threw in a few lines to destroy + free port.
Elaine if you could take a look to see what other resources can be
freed it would be great.

****************************************************
Elaine May 6 5:54 PM

Yeah...it should just be currentPacketIndex for doCopy,
and cpData should be amtCopied...sorry, i was confused.
I just notice we don't ever use the offset passed into
read. I will fix that after finish debugging read for
offset of 0.

****************************************************
Ternce May 6 3:52 PM
why is in docopy
the endofpacket is = max(0, currentPacketIndex - 1)
why is that? why not just currentPacketIndex?
explain....

elaine: why is in cpData the offset is posWhereWeLeft off shouldn't be
amtCopied? i put your test cases at the end, because it gave me
compile errors... i see you in lecture

micheal: the makeData, shouldn't set payload directly like that?
because again data abstraction. all the formate stuff should be in
mailmessage....  let me change it for you I correct something so could
you read 'write' again?

hey, if write return -1, do the message will get send or not. just curious

****************************************************
Amy May 6 11:15 AM

oops sorry, i mean it is an instance vars, but shouldn't pass it in
function as a parameter.

****************************************************
Terence May 6 10:49 AM
yup yup yup. the code is very very buggy now because i didn't work on
it yesterday (typing my paper) i am sure there will be inconsistency
the way we write the code, duplicate funcation, false assumption and
all those stuff....

i agree with amy's poswhereweleftoff should not be global. it should be
a instance variable withing connectoin. 

elaine: could you please mentally run througth read couples of times?
also, did you fixed, handleconnect, handleaccept?

micheal and amy: i didn't look at close module in depth yet,
so.... BUT is it possilbe to leave close/fin module to you? or you
want me to work with you... i just want to make sure datatransmission
work first, then i work on next one

i will work on testing/debugging datatransmission tonight....

oh also, when people say 'fix something' i am sometimes confused with
what they actually fixed (that apply to me too) so yeah it would be
nice to be specific

****************************************************
Michael May 6 9:26 AM

Fixed seqNo again. Yeah, I keep changing it =T. My latest version is
now in network.

Terence: The reason I asked was I want to know is it possible for one
side to do a write(100) and the other side to do a close() just a tiny
bit afterwards and when close check send buffer the send buffer is
empty? We can discuss this after the meeting.
****************************************************
Elaine May 6 9:23 AM

Thanks for the debugging, Amy. I will work on fixing
read now.

****************************************************
Amy May 6 7:05 AM

some things i see when i read (sorry not finish reading yet):

handleSyn didn't take care of the case connection.CLOSED? 
minor access thingie: Connection constructor should be private b/c u
don't want anyone to make a new Connection w/o calling
makeNewConnection.
shiftWindow, right here u try to pass in the global variable
posWhereWeLeftOff, i guess that's ok...but not necessary, but the prob
happen at the end, when u try to decrement posWhereWeLeftOff, it is
trying to decrement the local variable, not the global one

i didn't want to cvs commit anything b/c i m not sure if anyone of u
have modified stuff and the one on cvs may not be the newest version.

****************************************************
Terence May 6 4:10 AM
all you question is kinda related to close/fin module which i did not
pay a lot of attention to yet... to give you a temporary answer...

for your first question
i do think both side need to do close.
for your second question about the sendbuffer
isn't when sendbuffer is empty == all data sent?

i am not talking about the global send buffer.

don't forget the meeting tomorrow at 12:30

****************************************************
Michael May 6 12:30 AM

I think Elaine did a preliminary test of Connect/Accept.

A couple things: Can both sides close? or only the side
that sends? Also, is it sufficient to just check if the sendbuffer
is empty? or is it possible that the send buffer be empty
yet not all data sent yet?

****************************************************
Terence May 5 11:30 PM
Micheal: equals method is for method contains (of some class, don't
remember) there are a lot of java build in class that use a Object
equals method which is not what we want... so.... hashtable,
linkedlist... blah...

close is not equals to handleclose.  go to userprocess. you will see
openfile.close is used.  basically, it should destory the connection
(already implemented) and.... free the port (if
possible).. errr... check each invariants. just maintain each
variable's invariant... if you know what i mean...

elaine and micheal: good job!

does anyone try to test it?
i am very sure there are a lot of bugs

****************************************************
Elaine May 5 6:15 PM

version able to compile in network. Write needs to
take care of seqNo. Fixed read, shiftWindow to
return int.

****************************************************
Michael May 5 3:00 PM

Elaine: Read, Shiftwindow, and DoCopy didn't return anything althought
they're supposed to return an int. For now I've temporarily had them
replace 0.

Terence: I'm not exactly sure what you're trying to do with your
equals method so I've left it alone for now.

Close isn't done yet, and I'm not sure what it is supposed to do. I
don't think Close equals handleClose or how they're related. If
someone can clarify these for me, I can start working on close.
****************************************************
Elaine May 5 2:14 PM

Yes, all the files are in network. The basic structure
is in place and it needs to be compiled and tested,
and debugged.

****************************************************
Amy May 5 1:34 PM

ok what is going on right now? i m almost done w/ my essay...so i will
be coming back to join u guys/gals soon.  sorry about being away for
so long. can anyone tell me what has been done now? all the files in
nachos/network right?

****************************************************
Amy May 4 4:19 PM

kat: if u can, can u code in chatserver.c when u r done w/ chat.c? it
shouldn't be that bad for u since all the pdl are there....
well just try....i will work w/ u after i m done w/ this
essay...hopefully very soon....sorry about that...

****************************************************
Amy May 4 10:09 AM

kat: i write 2 functions for u, movearray.c and readlinefrombuffer.c,
they should be helpful for u, they are in nachos/test also, and
remember to add these 2 files in the LIB in ur Makefile
anything just ask me ok?

also can other people add that in too? thanks!

****************************************************
Amy May 4 8:41 AM

huh??? kat, what do u mean? it is in nachos/test....cvs update in that
directory? 

****************************************************
Katherine May 4 6:47am

Amy, did you write the comments in chatserver.c and chat.c?

****************************************************
Terence May 4 6:30 AM
Me and elaine worked on cleanup and data transmission module. it is
not done yet.  elaine, i got a question for you for handleaccept if
something give you a negative port.  will the number of free FD will
be the same after?  i am not sure what getFreeFD does. could you make
sure if connect and accept fail the number of fd, free port,
connections will be the same as before? i don't think it is doing that
right, right now. so...

micheal
i think it does not really make sense to wait until saturday which i
expect mailmessage to be done by thursday because everything depend
on it. it is not even possible to compile without that. so are we
going to wait for extra two days for not doing anything?

for proj3, part3, i did looked at what you have in junk backthen. it
was not until amy told me so. it will be better if you write in the
log that there is such a thing. also, it was far from
complete. everything is like 'yah, not sure how to do this yet' so
should we wait for you and do nothing? if that was so, we would not
for sure finished proj3 on time. when something need to be done, it
need to be done otherwise, that person are dragging down the rest of
the group. same thing for connection class, i asked you to do
connection and i think there was only a constructor and nothing
else. i am not sure if i give you enough direction or i expect too
much from you. Also, i could count how many times you post on the
log. if you have nothing to do, you could at least concern or ask
right? instaed of coming back after the project is done and ask to
help in the final design doc.

okay, enough of this... you know what to do from now on. people would
just know how much a person contribute without telling everyone that
he/she did someting.

back to part 1,
the send, recieve, connect, cleanup, connection module are done. there
are more left. that is closefinish, datatransmission module and that
is quite a big part of the project too. so if someone want to
contribute, this will be a good starting point. it is strongly
recommend to read what is already there, since there are almost 1000
lines there already and the design doc. if you have questions, ask! it
is better to ask than write something that does not work. me and
elaine are working on datatranmission. we could finish coding that
part by tomorrow.

the files are in junk
there are no need to test mailmessage because it is just way too simple

I will be online at ten tomorrow

****************************************************
Michael May 4 12:36 AM

I've been a major flake, especially on this phase and
the first phase. I know everyone has a heavy load and I don't intend
on screwing anyone. I am indeed ashamed of having you guys do more
work than me. I don't have any excuse such as not reading the logs as
I have been monitoring them quite closely since the second phase, and
I've put all other stuff ahead of this one. I thank Elaine for writing
mailmessage on Thursday while I was gone, and Terence for cleaning it
up. My last point though, I would ask you all read and think a little
before responding. I don't intend to offend anyone, but I believe we
do have a communication issue to work out.

1st, Terence sorry for falling asleep on Wednesday, I believe I was up
until around 2-3 before I nodded off. I know you said lets get 2
things done, but apparently I didn't even do 1. My lack of efficiency
that night was unexcusable.

2nd, This is the touchy one. I believe we may have communication
issues here. The understanding I got from Terrence was that MailMessage
needed to be done by Saturday, yet when I looked this morning (Friday)
it looked done. Terence, I have no problem when you say you aren't
going to help because you've given me the easiest part. I actually
appreciate you giving me an easier part as well as trusting me to
complete it. However, I'm at a loss when I log in and find that you
and elaine have completed it. I had every intention of working on it
Friday as I was using Thursday to run errands. 
I guess the point I'm trying to make is that I could use a
little help knowing exactly when you want it done. Of course
everything always needs to be done ASAP, but when I see a deadline, I
view it as the amount of time to complete a task. Also, I don't
intend on ever using the group as a crutch. I am indeed still ashamed
of the lack of work I did during phase one and during the group
evaluation that's turned in after, I told the TA the situation and how
the entire group was carrying my weight in the
extra comments. I don't ever intend on repeating that. While I also
have little work to show for phase 3, I did have some code in junk and
I actually spent a lot of hours doing non-productive stuff simply
staring at the code not knowing how I should fill in. This was my
fault completely and I should have asked on the log as to where I
could contribute. As of right now, I don't know what is left. I talked
to Elaine and she said quite a bit and to ask Terence, but he wasn't
on AIM. It's now 1am and I guess I spent 30 minutes writing this, but
I'm going to sleep now. I'll be up at 10am tomorrow and I will start
by testing MailMessage, if anyone has something more constructive for
me to do, I will gladly do that instead. Also, if you do think it's
necessary for me to work now, go ahead and call. I'll get up and
work. My number is on the contact and everyone is welcome to call at
any time. Once again, I am sorry. I don't intend on letting anyone
down this time.

****************************************************
Amy May 3 10:36 PM

agree terence! that's what happen to me in proj1, i was spending time
to debug the elevator the day before 2 mts, which costs me to have 2
bad mt grades (162, 188), this is not funny at all.  not to mention about
studying for 170!... hey everyone has a heavy load...if u can't handle
it should have said it earlier..like dropping the class....don't screw
us up! it is not fair for those who spent sooooo much time in the
proj..and get a bad grade b/c no time to study for finalz, while those
who doesn't spend any time in the proj, to get a good proj grade and a
good final grade, b/c they have sooo much time to study for it!  i
mean u should feel bad too, think about how u get the grade, by
sacrificing other people's grades! what a shame! and i don't like to
hear any explanation like 'oops, forgot to read the log..i didn't know
i have to do this', this is just sh*t! everything is in the log, if u
dunno ur duty, that's totally ur fault!  and not only not deserving ur
names on the project...i think we should talk to the ta or maybe prof
about it. cuz it is totally not fair!

****************************************************
Terence May 3 10:17 PM
To everyone in our group,
Due to the shortcoming of final exams, we will NOT tolerate any
slacker(s) in this part of the project. If one did not spend
sufficient time on the project or have noticably poor efficiency, we
will NOT put his/her/their name(s) in the design doc and final
submission in the project not to mention an zero in the group
evaluation form. This may sound harsh, but this is totally not fair
for other group members who devote most of their time on it. this is
the last phase of the project and there should be NO excuses, like
'forget about the project' or 'have other stuff to do' or other lame
unreasonable excuses.

****************************************************
Amy May 3 12:32 PM

submitted design doc

****************************************************
Terence May 3 10:21AM
could you try to compile your code? turn on aim
I am actually fixing your code.... go on aim

****************************************************
Elaine May 3 10:06 AM

Please ignore what I said before about toBytes. I was
using the wrong method. New version of MailMessage now
available in proj4/junk. Enjoy!

****************************************************
Elaine May 3 12:37 AM

Thanks for all your help Terence!! I will clean up
the code tomorrow. Tell me what else I should do.

Preliminary version of MailMessage in proj4/junk in CVS
The toBytes function in the Accessor section currently
converts integers to 4 byte numbers. This might have to 
changed later. 

****************************************************
Terence May 2 7:11 PM
donn't forget the design issue for design doc.. i am done with my part!

****************************************************
Katherine May 2 5:20pm

Yeah, i'll write the test cases tonight.

*****************************************************
Amy May 2 4:15 PM

kat: i put part 2 in design-draft.txt (in design directory)
can u take a look at it? and tell me if there's anything wrong w/
it..and also i didn't write test cases, u can help me write that ok?

*****************************************************
Terence May 2 12:28 PM
Thousands thanks in advance, elaine!
elaine, i put up all the skeleton for you. with all the pdl,
signature... so please please write clean code! 

Micheal, your task is way too simple, so i expect you to have high
quality, completed code.. so i am not going to help you

I rewrote connection 
the files are in junk
*****************************************************
Elaine May 2 11:03 AM

Understood. Will start coding after Discussion at 5.

*****************************************************
Terence May 2 7:15 AM
i completely rewrote it because some part does not make much sense. i
looked at the autograder test cases and it seems extremely harsh. so
could we start today?

elaine could you do the connect module part? since you are familar with file
descriptor and your own code. please write clean code k? it should not
be that hard, because i say what exactly what to be done in the design
doc. you can use what i wrote in the design doc as pdl. so...

micheal could you do mailMessage module? that's the EASIEST thing of part 1,
so could you make hundread percent sure it is done?

i will do the Send and Receive Module.

Let's get this done by today, k?

My goal is to get the code done by saturday. I am sure i cannot
accomplish this by saturday. we need to work in parallel!


*****************************************************
Terence May 1 4:45 AM
Me and Michael put up part1b in design directory. it is partially
done. i need to ask TA one question and i think i will know what exactly
is going on.

*****************************************************
Amy April 30 4:34 PM

Design Doc Review Mon 12:30 PM

*****************************************************
Terence April 27 1:00 AM
for the design, let's have something by tuesday. done with design on
wednesday, talk to emil on wednesday, start coding on thursday. 
check this out
i got ten page paper to do, 61b two projects and two home work to
grade, do 170 homework, 4 162 lectures to watch, reseach project to
finish up... so don't complain. you are not the only one who is busy

micheal, elaine. let's meet together onine on monday, be prepared. we
try to get it done by tuesday.

I just want myself to have more time, just in cases it end up as bad
as proj3
 
*****************************************************
Amy April 26 9:45 PM

i submitted the design doc, if u find anything wrong w/ it...let me
know we still have time to change it since we used a slip day..it is
officially due on sat.

Proj 4 division:

Part 1:
Terence, Elaine, Michael

Part 2:
Katherine, Amy

some kind of deadline to talk about it?

*****************************************************
Amy April 26 8:28 PM

i think the prob i m thinking of is let say process 1 tries to get a
page to do read/write, so it disabled the interrupt and it called
handlepagefault, but no page is available...then what happen is it
will yield (but still in disable interrupt mode) to let say process 2,
and process 2 will work on swap, and etc without any interrupt...so it
will not really have parallelism...(i m not so sure if this will be a
big big prob...i can't think of the real example that it will get
stuck yet...) maybe i m worrying too much?

*****************************************************
Elaine April 26 8:28 PM

Terence: You can beat me up the next time you see me...
I will also return your book.

Amy: I think it the design doc is fine. Calls to rwHelper
are much less than calls to handleTLBMiss when I counted them
since only syscalls will make read/writes to memory...I
think this is right, so since there are no interrupts disabled
in handleTLBMiss which is the majority of the cause of page
faults, it will not slow down the program much...should I
add that in? Does anyone think what I said is valid?

The only additional suggestion I would make is to attach the
original design document below the current one b/c Emil wants
it, even though the design has changed drastically.


*****************************************************
Amy April 5:52 PM

looking at design doc, i was wondering if we have probs with excessive
read/write memory b/c of the disable interrupt thingie? b/c only 1
process can do read/write at one time...well it is only a thought
right here...haven't really thought it out...

and also i added a little into design doc...Implementation of lock
vs. interrupt...can u guys/gals take a look at that...tell me if u see
anything wrong w/ it....before i submit...

*****************************************************
Terence April 12:35 PM
forget it..
download the file
it is gunzip the file
tar xvf the file
cp files to your directory

i could beat you for real? ok i am going to get strings
and stuff. when do you want me to beat you up? today?

your book is here!

*****************************************************
Elaine April 12:14 PM

Help. I can't decompress the file, I tried typing
 gzcat proj3-code.0426-1135.tar.gz | tar xf -
but it says permission denied.

Could someone tell me the correct command to unzip 
it?

I did copy the files from your home directory and 
it's working fine for all test cases I ran.


TERENCE AND AMY: I AM VERY SORRY FOR POSTING ALL THE CRAP BELOW!!!!!


I was looking at an old, incorrect version of the 
files. You may beat me now.

I misunderstood the post on 2 physical pages, I thought
they meant that we have to fix that and have one process
run to completion and then switch to another process and
give that process the 2 pages to run. 

Terence: I will go read Code Complete now, see everyone 
at 9 tonight

*****************************************************
Amy April 26 12:04 PM

ok...will look at design doc

going to be online at 9..so just im me

*****************************************************
Terence April 26 11:51 AM
did i say use the version online?
i don't think i gave amy the final final versiton either. so ...
there must be more than two physical page for two process? so if two
pages doesnot work, it is NORMAL! sigh...

i read the post, he said you can do whatever to make the code
work. but disable interrupt is not necessary if there is a better way
to do it

first of all, he is saying about the TLB handler!! ok it is TLB
handler, not rwhelper, not syscall.

secondly, is there a better way elaine? say what is in your mind to
implement the rwhelper
again
rather than saying there is a problem, it is better to have a solution.
if it is better, you can change it

*****************************************************
Elaine April 26 11:39 AM

Thanks! Amy's version doesn't work.

*****************************************************
Terence April 26 11:27 AM
cvs vm directory get fuck up
it is in the result.html
so if you want to check out the code. go there. i hope you remember
the password

*****************************************************
Elaine April 26 11:19 AM

Terence, could you pleae commit the version that passed
all the tests b/c Amy commit her version, and it's not
working! For testJoin, 2 pages, it keeps swapping, 4
pages has Assertion error. I'm sure i have the wrong
version now.

*****************************************************
Elaine April 26 9:33 AM

Also, where is the final version of the project? Is
it in vm? I think I don't have it b/c the dbflags are
not turned off in my version....maybe I am not even
looking at the right code....could someone with the 
correct version commit it again? And the correct
UserProcess and UserKernel too, please?

Of course, I don't want to change the code, I just want
to make sure it works....since the next project inherits
from proj3, but we have 16 pages so I just want
to make sure everything works using 16 physical pages.

I believe I am using a wrong
version or something b/c simple test cases are not 
working for me...If this is the case, I apologize, and
please ignore all the stuff I said below. (and you may
beat me too if you want)

I mean that testJoin didn't work for me even with 16 physical
pages....my files must be wrong.

I am very sorry...it is not violation of design specs, but 
we might lose points on the design document, unless we
say why we choose to it this way. (of course, we have a
different TA and I don't think Emil will care)

From Andrew in post "Locking TLB Handler"

*****************************************************
Terence April 26 9:30 AM
i edit part 1 and part 3 in the design doc, it is in design
directory. amy, could you spend five minutes to look if it is ok and
submit it? sorry.. i know you need to do you 188..

also, could we talked about it online to divide the work for next
project. it is due next thursday.

tonight 9:00 PM online?

this time i want to start as early as we can. i have paper and stuff
to do too... k? we could go to emil office hour on next
wednesday. talked about it and start coding on wednesday

*****************************************************
Terence April 26 8:14 AM
elaine. yes amy and i have been talked about it for a very long time.
could you give me any reason why you cannot? except of classmate or
newsgroup? if you can, please give us a counter example. it is not
violation to specs either.

userprocess vmprocess is not running in userland. you are in
Kernel. everything you write is in KERNEL. that's why there is a thing
called trap from processor to KERNEL! for handlepagefault. that's why
lyou called KERNEL for syscall. we did not disable interrupt in TLB, k?

how is that violate breaking data abstarction? where is the data?

how is that defeat parallism? test 10 proved this. the whole point is
to context switch while we are doing io. could you please read the
code again about usingFreeMem?

elaine, if you really want to change the code, go ahead... if you have
a better implementation. i will consider about it, but i am already
sick of the project.

yes, i do agreed that it is kinda cheap to do disable/enabled
interrupt. but we do it for a reason. we had lock before. but that
won't work because of our current implementatioln. using interrupt
will be a quick solution. ask yourself what happend if we use a lock?
in rwhelper. that is the main functions which make us think it is
wrong to use a lock.

that's all i am saying, it is up to you to use the slip days.

instead of saying somehting is wrong. it is better to say some other
way is better.

i don't want to be mean, but i am just too tired andl sick of this
after working on this shit for so long.. sorry for my grumppiness.


let me explain so more, before you reply.

    public int rwHelper(int vaddr, byte[] data, int offsetForData, int lengthToCopy, boolean writing) {
	
	// get the vpn
	int vpn = vmKernel.pageFromAddress(vaddr);
	TranslationEntry currentIPTE = vmKernel.getIPTEntry(pid, vpn);
	// if not valid
	if(!vmKernel.isEntryValid(vmKernel.getIPTEntry(pid, vpn))) {
	    // either not lazy load, or on disk
	    db2("page fault on rw virtual memory vpn " + vpn);
	    handlePageFault(vpn);
	}
	vmKernel.setEntryDirty(currentIPTE, true);
	// call super
	int ansOnStack = super.rwHelper(vaddr, data, offsetForData, lengthToCopy, writing);
	// context switch fine after this point
	return ansOnStack;
    }

here is our original rwhelper function
now we got to implement pinpage
handlepagfault is going to called obtainfreemem which is going to pin
the page. but you had to have certain kiind of lock around entry valid
and super.rwhelper. otherwise it will context switch right after
handlepagefault. that lock needless to say have to be something else
other than the lock in pagefault. otherwise there will be a deadlock
so let's say we are using lock for all our implemenation.
process 1 have a syscall called rwhelper, acquire rwhelperlock, went
to page fault, acquire pinlock. release pinlock after
handlpagefault. another process come grap the ppn that it not suppose
to get, do stuff with it. process 1 continue, don't know somebody is
messaround with it, continue the read. you see a problem?

what is your solution elaine?

*****************************************************
Amy April 26 8:04 AM

terence and i have talked about this for a long time...we really
cannot find a way to do it w/ lock around rwHelper (and making the
code even)...

and we r not really accessing tlb when diable interrupt right?
just handling it when there is a tlb miss...

*****************************************************
Elaine Apirl 26 8:00 AM

Actually, now I think the implementation is wrong b/c
I see a post "Locking in the TLB Handler"

that someone asks

"Why can't interrupts be disable during all TLB
accesses?"

Replyfrom Dan Hettena:
"Well UserProcess and VMProcess are running in 
userland. You're not allowed to disable interrupts in
userland, right?" 

I think we really need to change the code then, what does everybody
else think?




*****************************************************
Elaine April 26 7:44 AM

Sorry for the long post.

I don't know if this is right, but I am worried
that we disable and enable interrupts in the code. Is that
not breaking a data abstraction? And also, does it defeat
parallism b/c no other processes can run when we have a
r/w pagefault? Actually I am a little confused on why
interrupts are disabled in rwHelper, but not in 
handleTLBMiss since this transfers memory to/from disk
also. Can someone explain?

Some classmates told me that we cannot do this and I am 
worried that we might lose points for it b/c of reasons
stated above. It's easy to search and see if we disble
interrupts.

Does anyone want me to post to the newsgroup? Or ask a
TA? Did anyone see anything on the newsgroup regarding
this?

If everyone thinks it's ok, then I will not do 
anything, and apologize for wasting your time. I just
didn't want points lost b/c Amy and Terence worked so
hard on the code, it would be disappointing to lose 
points for something that we didn't know about...or
were assumed to know about.

*****************************************************
Amy April 26 7:21 AM

i put part 3 in the junk, w/ slight changes.
hmm...i m not so sure about the test cases for that...

remember to do ur group evaluation also!
and who is submitting?

*****************************************************
Elaine April 26 12:07 AM

Part 1 is up in junk
*****************************************************
Michael April 25 9:46 PM

I've put a fairly final version of part 3 in proj3-draft
under the design directory.

Personally I think it's all complete except for the test
case section. If anyone is willing to pitch in there, I'd
really appreciate it. Also, I'm fairly certain there's only
one variable, (well one important one) if anyone disagrees, let
me know and I will change it.
*****************************************************
Terence April 25 7:44 PM
i don't really wanna lose stupid points on design doc.
please have these part in design doc
1) variables
describe each variables
2) methods
please make sure you describe all the functions that is related to
your part.
HIGH level design on each functions. no pesudo code pleas
3) design decision
speed, space, simplicity, modularity, data structure
4) tests cases
describe test cases in DETAIL

*****************************************************
Elaine April 24 1:44 PM

Hey Amy! I'm thinking about unpinning pages on the 
next PageFault by the same process so the process has
a chance to use the page...what do you think?
There is a swapping problem for 2 pages like

*****************************************************
Elaine April 24 11:23 AM

Will work more after class at 1. Please ignore the
version i put in vm...it is not correctly implemented
There are synchronization errors. I overrided mine
by committing yours again.

*****************************************************
Amy April 24 6:24 AM

terence, compiled version in vm (vmprocess and vmkernel) didn't debug
yet....

i will work w/ u when i get home today, around 2.

good luck on ur mt!

*****************************************************
Amy April 24 10:50 PM

terence, and anyone who cares:

hmm...not going too well...this is more complicated than i thought..
anyways..let me explain what i did:

(in vmkernel)
i have a data structure pinPages, which holds a idPinCombo for each
entry.  so each entry holds who pinned, and what is the pinstatus.

(in vmprocess)
i acquired a lock when a process called obtainfreeppn the reason i do
this is so that no 2 processes will grant the same ppns and screwed up
everything..so then when a page is found we will pin this page..and
put the current pid there..lock releases.if we cannot find any unpin
page, we will yield...
but not where to unpin page is a little complicated...(so the code
seems to be kinda uneven, like i can't really have something like:

function(){
pin();
...
unpin();
}

we need to unpin in another function...which is not too good...but i
can't think of any other ways right now...

then now is the prob in locking and pin/unpinning in rwhelper...(we
need to lock it so that if context switch our page will not be
overwritten by another process.....still thinking about this...and
where to unpin stuff..

if u really want to look at what i have so far, it is in
nachos/proj3/junk...
but do ur stuff first..

another thing, in rwHelper, y do we have a line:
setEntryDirty(...true)??

*****************************************************
Amy April 24 7:57 PM

answers to terence's questions:

i don't think elaine is going to implement it using monitors, cuz it
gets really complicate..so don't worry about it...

and about the replacement policy, elaine told me that it was about
clock/nth chance algorithm...not the sequiential one we have...

i think we r going to use array where each entry will hold pid & pin,
but right now thinking about where i should lock stuff so that it
won't break...
well start my implementation right now..

*****************************************************
Elaine April 24 4:19 PM

sorry...i posted the wrong info about the monitor...
here is the corrected stuff:


Ex. Condition waitingThreads(pageLock)
Lock pageLock

some function like obtainPages
pageLock.acquire();
while (true){
if (numUnpinPages > 0){
findUnpinnedPage()
pinPage()
numUnPinPages -= 1;
break;
}
else
waitingThread.sleep()
}
pageLock.release()


Wake the sleepers whereever you increase numUnpinPages
*****************************************************
Katherine Apr 24 3:55 pm

the replacement policies for the page table are
working now. I'll cvs commit them after we fix the pin.


******************************************************
Amy April 24 2:57 PM

hmm...i m going to work on it when i get home...

i think a list of locks will get really complicated...b/c we need to
set up a waitingqueue that are waiting for n number of locks...i
dunno...maybe i m thinking too complicated?! anyways...let me think
about this some more...

and what if we don't use a list of locks then, how should we put
process to sleep? we don't do currentThread.sleep()/.yield(), do we?

i m still not totally sure where we should pin/unpin pages around
rwHelper for sure...but then what else, we should not pin it in loading
section right? cuz when will we unpin the pages after u load? 

elaine said something about handletlbmiss, we should
pin/unpin...explain more...y??

******************************************************
Elaine April 24 12:43 PM

Do people think then that we should have a linkedlist
of pinned pages or somthing else like that? Instead of
adding an entry to idVpnCombo? 

I was implementing it the other way...but i will stop...
it is still in junk if anyone wants to look...i put
the monitor in VMKernel.getRandomPageToReplace
but it doesn't run...will work on it after classex

Amy: if you want to put threads to sleep while waiting
for a lock...you can use Monitor with Condition variables.

Ex. Condition waitingThreads(pageLock)
Lock pageLock

some function like obtainPages
pageLock.acquire();
while (true){
if (numUnpinPages > 0){
findUnpinnedPage()
pinPage()
numUnPinPages -= 1;
waitingThread.wake();
break;
}
else
waitingThread.sleep()
}
pageLock.release()

Then, like you said, unpin the pages in handleTLBMiss and in
rwHelper.

******************************************************
Terence April 24 12:19 PM
elaine: I don't think that's the correct way to do so. put it in idvpncombo?
data abstraction violation!
amy: i mean acquire the same lock two times (same ppn). like acquire in obtain
freeppn and swapoutoldpage. you have acquire the same lock two
times. this would need to dead lock. we have exactly the same idea.
I will leave it to you, k? worse case we could use slip days

******************************************************
Elaine April 24 8:59 AM

I believe that is the correct way to do it. As others have
done...there is an extra entry in the coremap that indicates
whether a page is pinned or not. In our implementation, we
would just need to add a boolean variable to class ipnVpnCombo

*******************************************************
Amy April 24 7:56 AM

you said don't acquire more than 2 times, isn't it highly inefficient
if numPhyPages >> numofprocesses, b/c processes have to wait just b/c
they have acquired 2 pages...

i m thinking it will be ok if we have an array (size = numPhysPages)
where each entry will be a boolean indicating if the page is pin or
not...so we just unpin/pin the pages around those functions, if we
can't find a page then we just sleep, what do u guys think?

*******************************************************
Terence April 24 6:30 AM
so we got to do the synchornize part. we are having a global lock
around everyting. when we acquire something, it do a year long of
io. no one can interrupt us, then we relase it. this is heck of
slow. it is best to do everything in parallel. like swapping page in
paralllel
i read up something call pin
page it is basically obtain a lock and release a lock
i don't have time to do it. i left it to you guys to figure that out.
so you have a vector/hashtable of locks for each ppn.
pin = acquire on if input ppn match
unpin = release
make sure you don't acquire two times otherwise you deadlock yourself

pin and unpin around:
1) wherever you called
tranferPageFromDisk
tranfterPage2Disk

2) section.loadpage

3) super.rwhelper
basically anything that touch raw memory natively

for now implement it as list of locks, if it works. make pin using a
list of queue. (copy the code from lock) and implement a lock
indirectly. maybe you can find a better idea. then this.

this is just my thougths. if a ta said different thing, ignore this.


*******************************************************
Michael April 24 2:47 AM

My bad, it was my post. Elaine couldn't see the newsgroup/
see what was posted so I put it here for her. It wasn't
100% clear to me if we were using 2 or 3 at the time.
Thanks for verifying it.

*******************************************************
Terence April 24 2:21 AM
just wondering who post this....
we are using implementation 3

*******************************************************
This is Terrence's original post:
 
from what i heard from a TA. there are three implementations of swap
disk mechanism that possible.
1) swap disk is just another level of physical memeory. for anything
exist in physical memory, it must exist in swap.
2) swap and physical page is exclusive (space efficient)
3) swap and physical page is exclusive. but you can leave the page in
swap while it's in memory, so we can take advantage of paging it out
without doing any IO because it is already there (most time and space
efficient)
our implementation is the second one. so if we just replace it,
(without putting it back to swap and just kick it out) are we going
just going to lazy load it again? (from coff? and allocate a new one
for stack?)
does what you say apply to all three implementations?
tdawg
 
 
 
This is Jeryl's response:
 
What I said about picking a page to replace applies to any
of these implementations.  A dirty page can be chosen for
replacement just like any other page (except you might want
to let dirty pages stick around longer if you can). 
What I said about writing *only* dirty pages to the swap
file applies to (1) and (3).  If you are doing (2) (I didn't
know (2) was allowed because it's very time inefficient,
and may not meet the spec) then yes you'll have to
write even non-dirty page to the swap file if you're replacing
it.  But when I posted, I assumed everyone was doing (3).
-Jeryl C.


*******************************************************
Katherine Apr 23 6:15pm
i added a line in saveTLB(int processId) in VMKernel.java
after setEntryDirty(iptTE, true);
i added
setEntryUsed(iptTE, true);

that seems to fix the testJoin.coff, testJoin2.coff problems.
also, for both testJoin.coff and testJoin2.coff, it seems
like the first line of printf("ABCDEFGHIJK") is not printing 
out the whole sentence inside printf(). for example, it's only
printing ABC but not DEFGHIJK. 
I'm not sure why, but that only happens to the first call to
printf(".....") in a function.

Also, in testJoin.c, i commented out the line
printf("about to join"); (located in teh middle of the function)
because it won't run otherwise....
strange though

so i guess the testJoinx.coff's work now.... 
********************************************************
Terence April 23 5:46 PM
me and amy going to debug tonight around ten. we are going to have a
chat room.. so if anyone want to join, please do!! i got midterm on
thursday, so maybe today is my last day of working on nachos.. sorry..

********************************************************
Terence April 23 15:15 PM
elaine and all: i got a task for you to do
i know there there is an errror about dirty bit and stuff. the reason
why we get null pointer exception on isEntryValid, the reason why we
get unhandled exception, the rason why it print garbage is all becuase
of this error..... i sat around for too long, but cannot find it. it
will be nice if someone could do that...
it is something like either we just throw away written pages (not
putting on the disk) incorrectly, or either we write the wrong stuff
to physical memory. that's why it is junk.
to test it easier, set numphyspage to 2, do echo.coff. and in
processor translate functioin add if (writing) sys.out.print("dirty
bit of tlb of vpn " + vpn)...

********************************************************
Elaine April 23 11:55 AM

Seems to work fine for big read/write and multiple-joins.
Passed 9/10 tests. I'm assuming we run out of time on the
last test b/c of the page replacement policy which is right
now, replace any page sequentially. If that is fixed, I think
we will pass the test.

There is a little problem with running in the background...it
does not print out exit code.
********************************************************
Elaine April 23 9:25 AM

I will do more testing.

********************************************************
Terence April 23 5:00 AM
fix growswap file bug
fix read invalid vm, it can be on disk too!
something wrong with the dirty bit.. if i just copy everyback to disk,
this will work.


********************************************************
Terence April 22 12:54 PM
Elaine. are you talking about the stuff in vm directory or in junk
directory. i am kind of confused with what you say

elaine: what exactly did you fix in clearTLB? is writeTLBEntry necessary? 

please do 
prompt> ln -s ~cs162-nx/public_html/log.html ~/where/to/put/it/log.html
you know what to do with /where/to/pu/it.. i guess

rm the original log.txt file

********************************************************
Elaine April 22 12:42 PM

Amy fixed get sequential page to be replaced...inifinte
loop now.

********************************************************
Elaine April 22 11:16 AM

Ooohhhh! It seems to work now...maybe, at least for 
testJoin4.c - more testing to be done...Echo works too!
I am happy! ^_^

Nevermind...there are some errors, either infinite loop
or assertion error... I am sad now... :(

Try running sh.coff, and typing sh twice...infinite loop
Try running sh.coff, then echo , then sh again...error

It is only allowing one join...i think.

********************************************************
Elaine April 22 11:12 AM

Fixed problem in clearTLB, not clearing entries before.
Am confused as to why exec doesn't work...-_-
which is where unhandled exception is coming from, it
says that there is an unimplemented instruction in MIPS
processor.

********************************************************
Amy April 22 5:35 AM

a thought:

the way we implemented the IPT is all entries of the possible vpn for
each process is in the IPT when we do load section, but in the spec
part 2, it said:

The inverted page table must *only* contain entries for pages that are
actually in physical memory.

so is there a prob w/ our implementation?! or an valid=false
entry can be consider as non-exist in the IPT??

also terence: in loadsection, when we put those invalid entry in IPT,
should we change the ppn to -1 instead of 0 (but i try to do it, it
gives me an assertion error in processor.makeAddress or something
(haven't throughly trace), but probably doesn't matter i guess, can
leave it to 0?

if no page is modified, we need to find a page that is not used by
current process (which should mean this is an unpinned page) and we
can use that for replacement, so we just add something in those
replacement policy.
 
********************************************************
Amy April 22 3:23 AM

terence...i m sooooooooooooooooo sorry....i keep doing this to you...
anyways..i will talk to u in person...:( very very sorry...

********************************************************
Terence April 22 3:00 AM
amy. i fixed the unload section. so you can called thousands echo and
it won't crash. i also modify the islazyload too. it does not use th
used bit anymore. i am surprise the ta didn't stop me doing that. the
thing that stuck me is the ppntoBereplaced. because what if there are
no dirty page at all. that's why it goes into infinite loop now.. i
got to talk to ta or smething.

********************************************************
Terence April 21 4:18 AM
Amy and I put everything together. it can runs sh now.. but somehow it
has some mysterious unhanled exception. i found out that it actaully
come from sh.c.. join return 0 or something like that... or well

things that is not done
close the swapfile
tlb and pagetable lock
policies

********************************************************
Amy Apr 20 9:16 PM

all modifier/accessor for TranslationEntry can be found in
UserKernel.java

********************************************************
Katherine Apr 20 8:20pm

does anyone know how to clear the used bit of a page?
(this is for part2)

********************************************************
Terence April 20 5:42 PM
part 2 done handle page fault is working..after some cracy testing
elaine cvs commit what you have now
amy and i going to work on load section
going to meet tomorrow at 12.. k? make sure you have stuff written

********************************************************
Katherine Apr 20 12:35pm

Yeah, i'm working on the policy thing....

********************************************************
Terence April 19 12:37 PM
Let's get the code done by sunday. at least have all the code
written.. please.. could katherine do the policy thing?
i am seriously think we need to hurry up

********************************************************
Elaine April 19 11:16 PM

Sorry. Terence. I wasn't thinking. Thank you for the
cleaned up code.

********************************************************
Terence April 18 10:48 PM
did you forget to turn off db flag?
amy and elaine ane katerine. could you guys start working on part 3? i
don't think micheal have that much time this time. also, i am going to
have midterm on thursday... so....
i added some more stuff to junk. update and test it...

********************************************************
Elaine April 19 7:30 PM

We got an infinite loop when we ran nachos in proj2
directory, trying to get the shell to work.

********************************************************
Terence April 19 5:33 PM
i would say fix the one in cvs unless you want to do all my parts
over... i cahnged userprocess and user kernel to sync with vmprocess
and vmkernel. you change one, you change all. if this is so, go ahead.
i would not stop you. where is the
infinite loop? how do you know it is userprocess?

********************************************************
Amy April 19 4:55 PM

haha terence u spelled ur name wrong, anyways haha

we put part 1 in junk/vmppart1.java, we have some trouble running and
merging everything, b/c userprocess doesn't run properly (infinite
loop)...

should we go back to original userprocess, or fix that one in cvs
right now?

********************************************************
Ternce April 19 13:01 PM
update a more update version in junk. elaine. i alrelady wrote the
interface4 part for you. all you need to do is to change the internal
so that it will use a global inverted page table

********************************************************
Terence April 19 4:15 PM
Major design changed.
I talked to emil today and discuss some design issues i have. here are
some changes

michael: there are three ways to implement the question we talked
about int he meeting. the first way is you can as you say can put do
the hiearchy thingy. for all address exist in physical memory, it have
to exist in harddrive. this is the easiest way (he said). then we can
do it in a mutually exclusive way. which is my implementation
now. that is more space efficient. the third way is kind of
complicated. it is the second way building up... if the swap on the
disk is not overwritten, we can use that directly without wirting to
the disk...

instead of having anohter data structure to keep track of what is need
to be lazy loaded. we can use the used bit in the page table.

We got raped by the design doc in project 1. we need to raise our
quality for design doc a little bit

also, i changed the template.java.

did you check out the new look of this project group page
http://www-inst.eecs/~cs162-nx/

i am working on style.java.. which is my philosophy on
programming... i will put that up as soon as i am done


********************************************************
Terence April 18 5:05 AM
the new vmKernel, vmProcess, UserProcess, UserKernel is up. basic
stuff of part 2 is working. I changed so many things that i don't even
remember which is which. micheal you can use the swapOldPageOut
function. that function is working.. for now, i am trying to work on
part2 without using 1 and 3. I am using without TLB with the pagetable
from proj2, i write individual test cases to simulate lazy load. so
micheal, it would be really nice if you can get your lazy load done,
so we could both test out stuff

could i call for next meeting? 
think about thursday, friday or saturday?
Please reply!

********************************************************
Amy April 16 5:06 PM

design doc review friday 12:30 PM, be there!
michael submitted design doc.....

********************************************************
Terence April 15 12:25 PM
micheal is going to submit the design after he is done with his design

********************************************************
Terence April 15 2:07 PM
Michael guess what? you can use the use bit to keep track of your
stuff!
tell me if you are using that.... i am just going to use your "ghost"
isLazyLoad for now..

********************************************************
Terence April 13 6:18 PM
actaully, eliane, i take that back. the most ideal solution is to
overwrite use the varialbe pageTable as your pageTable. overwrite this
functions. makeNewPageTable(int size), setPTEntry(int processId, int
vpn, Translation content), getPTEntry(int processId, int vpn),
getPTSize().. the rest stays the same.. ignore what i told you before

also, i think either part 3 and part 1 provide me a function called
boolean checkvpn(int processid, int vpn)

part 3, i need a function called
boolean isLazyLoad(int processid, int vpn)

i guess everyone is working on 170 now... 
********************************************************
Terence April 12 7:31 PM
I figure it will be really confusing if five of us all want to say
something at the same time. let's do it this way. say x present the
stuff. he/she starts with what he/she repsonsible for. no one should
interrupt him/her until he/she is
done. he/she could pause on some points to answer some questions. then
he/she can continue...

********************************************************
Elaine April 11 9:20 AM

The preliminary design for Part 1 is in CVS.

********************************************************
Terence April 11 4:57 AM
awww forget ta mention about dis here. ah changed userProcess ta be
extremly modulized. so idealy, fo' part 1, ya do not need ta change
read/write virtual memory. just change da accessor/modifier an' it
should werk... ah also, make some changed on vmKernel/vmProcess ta
gots db funcitons an' all those sheeit. Peace

********************************************************
Terence April 11 10:26 PM
acutally no everyone can meet together tomorrow. so we are planning to
have a meething entirely on aim. at 8:30 pm tomorrow. be online!

********************************************************
Elaine April 11 3:44

To everyone: Please finish design doc by tomorrow. 
Meeting at 4 at Soda (of course).
Be there! (Please)

********************************************************
Terence April 11 11:10 PM
i did my part in design doc, waiting for katherine to fill her
part. it is VERY fucking long. It is strongly recomend you read how
part 2 is implemented, especailly michael!

********************************************************
Elaine April 10 11:20 AM

Haha. I almost had a heart attack! 0_0

I thought I found a weird bug in proj2...I tried to join many,many
times, but it would only go up to 4 and I thought we implemented
join wrong, but then I turned on the debugging flags and it
said "insufficient physical memory". Whew.

That's all the news I have for today. ^_^

********************************************************
Terence April 10 7:33 AM
Katherine, look at design/part2. before i worked with you tonight... i
am going to sleep now...

********************************************************
Elaine April 9 7:53 PM

Okay. Here's the division of work:
Part 1: Amy and Elaine
Part 2: Katherine and Terence
Part 3: Michael 

Post if you have any changes or suggestions. 
Preliminary design doc due on Friday. Shall we discuss
it at 4? 

********************************************************
Terence April 9 12:46 PM
the autograder is not working. the time is from unix command "date" so
i guess their clock is wrong..

let's divide up the project today! and you know what we just have one
week to code, not two weeks... 

********************************************************
Elaine April 9 9:40 AM

Terence: tsubmit works fine. I got an e-mail 
saying it received the proj3 code. I don't think the autograder
is working though b/c when I checked the queue, I see mine
and your submission from ~9:00 last night! -_-
Actually I think the time of submission is wrong too. It's an
hour early.

Are we going to divide the project in section today?

*******************************************************Xf*
Terence April 8 2:14 AM
i don't notice that this file was read only for a while until amy told
me.. could somebody other than myself test if tsubmit works for proj3? i am not
sure if all the files, directories permission are right.. (i cannot check
that myself..)

********************************************************
Terence April 8 3:00 AM
if you use the .emacs compile thingy i had, remember to change it to
proj3 otherwise it would not compile the right code

********************************************************
Terence April 6 5:33 PM

Seems like this never stop..! 
project design due next week
tuesday. 170 midterm next week wednesday. let's meet this week tuesday
after section or wednesday after lecture to divide the part up. finish
it before friday? i really want to do well in this midterm..
what do you guys think?

take a look at this

java class template 
www-inst.eecs/~cs162-nx/template.java


********************************************************
Elaine April 5 5:17 PM

Submitted final design. It's in proj2/design/proj2-design.ps.

********************************************************
Amy April 5 4:51 PM

remember to do the group evaluation!!

********************************************************
Terence April 5 12:45 PM
aiyah.. didn't check the log for three days .. miss out so much
stuff...
amy, it works for me.. talk to me in real life, let me try to fix it
for you.
does it compile for you when you do f10?

when is the design due?

oh well, i am going to see in lecture

********************************************************
Elaine April 4 7:37 PM

I didn't change part I. I asked Emil and he said he wants
the changes to the design doc and any additional test cases
on the top and the old design doc on the bottom. 

********************************************************
Amy April 4 6:14 PM

what do u mean?...u mean it is done?

terence: what u told us to add in the .emacs file...is the syntax
right..i dunno...every time i open emacs it gives me this in the
minibuffer: error in init file: symbol's value as variable is void:
command

********************************************************
Katherine April 4

someone changed the design for #1?
it seemed like someone changed it....

********************************************************
Amy April 4 5:51 PM

the savestate is empty b/c in the spec or somewhere...it said that
everything will be taken care by UThread, so we do not need to save
any states....

also...for lotteryScheduler, r we suppose to do donation across
process, what i mean is that if one process is waiting for another to
finish and stuff....and how should that be done? do we need to worry??

kat..yea...still sick...fever again...
********************************************************
katherine April 4 

the saveState() inside UserProcess.java is empty. 
someone in lab told me/asked me if there should be something
inside....
is amy still sick?

********************************************************
Elaine April 4 9:35 AM

Okay Part 3 is updated. It's also in proj2-draft. I deleted
the old part3 and put the updated changes in. I think Emil
only wants changes from the original design doc. I did put
all the test cases (new and old) in though. I'm not sure
about that. I will ask in office hours about what he wants.

PS - What about a lock on remaining? It's static and all the
threads have access to it, so does anyone think there might
be a conflict? Or is it okay since each process has its own
address space and there's only one thread per process?

Thank you to everyone for doing a wonderful job on this 
project!

********************************************************
Amy April 4 9:01 AM

i put #4 in proj2-draft.txt...is completely different from the one
that was in there....so might give u a conflict..

is #1, #3 done? just wondering....not trying to hurry u guys...take ur
time...and also who is going to submit?

********************************************************
Terence April 3 2:00 AM
Didn't start working until ten minutes ago. i feel like to talk today!
anyways... so what is going on?
yes i put final-design in proj2-draft as elaine say
for the diff? i dont know... sorry not really helping..

********************************************************
Amy April 3 12:04 AM

sorry...dunno what i did...can someone submit for me (grab the PS and
LS from nachos/threads....

also...ain't we suppose to do the diff for the final-design...not
adding to the old proj2-draft?

********************************************************
Elaine April 3 10:25 PM

Amy: I think the design is still in proj2-draft in the
proj2/design directory.

Terence: No need to apologize. After all, you helped fix
so many problems. :)

********************************************************
Amy April 3 8:58 PM

i just submitted proj2code again...so that it has a little more test
case (1 more haha) in the LotteryScheduler

and also..terence, where did u put the final-design doc?

********************************************************
Terence April 3 7:08 PM
Sorry elaine....

********************************************************
Elaine April 3:57 PM

I put that line there b/c in the spec it says that write
returns an error if the amount requested is less than the
amount actually written. For read, that's okay. Err,
someone correct it if it's wrong. 

********************************************************
Terence April 3 3:39 AM
just wondering why you put this

	if (amountCopied != count)
	    return -1;
	else
	    return amountCopied;


shouldn't it should return the amount of stuff copied NOT -1 ....
elaine, please explain



********************************************************
Terence April 3 12:24 PM
yah, should probably change read too. actually i didn't think about
we need to handle read. maybe you could do something like
what i did in readVM and writeVM. becaues their code is almost the
same.. (i assume)
for the lock, errr.. i guess so. i wouldn't hurt to have one

actually talking about modularity, yours is more modular then mine. do
whatever you want to.

elaine, i highly recomment that book called code complete.

i read a chapter about procedure writing

they write somethign called PSL first. which is like "pure english"
code (non-language specific, no any kind of syntax at all) 
like. the point is you can use this PSL to write any code like c, or
even scheme.

initially the max is 0
for every single integer in the array
  compare the integer with the max
  if max is smaller, set max to that integer
return max

then they write code on top of it, PSL become comment

// initially the max is 0
int max = 0;
//for every single integer in the array
for (int i = 0; i < intArray.length; i++) {
  //  compare the integer with the max
  //  if max is smaller, set max to that integer
  if (max < intArray[i])
     max = intArray[i]
// return max
return max


i thought this is reallyl cool.



********************************************************
Elaine April 3 12:04 PM

Cleaned up UserProcess. It's in CVS. Changed handleRead
to read incrementally just in case. Will work on design doc
in the evening.

********************************************************
Elaine April 3 9:28 AM

Yeah! I just knew that if I went to sleep, something good would
happen. If you don't mind Terence, I'll just use yours b/c mine
is not modular and wouldn't work for part3.

Do we also need to change read? Since someone could pass in a
really long count for that also. 

What about locks? Do we need them to protect the incrementing
and/or  decrmenting of remaining and pid?

Will work on cleaning UserProcess.java today. 

********************************************************
Terence April 3 3:00 AM
bad news: proj3 will VERY depends on proj2. VMKernel exterm UserKernel
and VMProcess extends UserProcess..
so we better make UserProcess and UserKernel as clean as possible. as
moduler as possilbe, as DA as possible.

i think we need to clean up our own code, comment the code, put the right
functions in the right place, like accessor in accessor section and
stuff.. besides, style == points for proj2 too.. so...

i modify the design doc for part 2..


********************************************************
Terence April 3 2:00 AM
this log file is getting huge! i think we need a new one for proj3
i add the results to the results.html already, so elaine, you don't need to do taddResult

We both passed the tests
here is my implementation. if you want it. just use it. either way. i
don't care....

    /**
     * Attempt to write from the buffer to a file. It is an error
     * if the bytes writeen is less than count
     *
     * @param  fileDescriptor fd of file to write to
     * @param  vaddr  virtual address to read from
     * @param  count  number of bytest to write
     * @return number of bytes successfully written, -1 if and error occurs
     * @author KC - last modified: 03/21/02
     */
    private int handleWrite(int fileDescriptor, int vaddr, int count) {
	OpenFile openFile;
	// check if the fd is valid
	if (fileDescriptor < 0 || fileDescriptor >= maxFiles)
	    return -1;
	// check if the count is negative
	if (count < 0)
	    return -1;
	// try to get a filedescript, if invalid, return -1
	openFile = fd.getOpenFile(fileDescriptor);
	if (openFile == null)
	    return -1;
	// allocating a temperatory buffer

	byte[] tempBuff = new byte[Processor.pageSize];
	// number of bytes copied
	int amountCopied = 0;
	int currentLength, bytesread = 0;
	// while there are still stuff remaining
	while(count - amountCopied > 0) {
	    db1("handleWrite vaddr 0x" + Integer.toHexString(vaddr) 
	        + " amountCopied " + amountCopied + " bytesread " + bytesread);
	    // the first case is we have the whole section to read, or we have the tiny little bit left
	    // so we are going to take the minium of it and copy for this iteration
	    currentLength = Math.min(count - amountCopied, tempBuff.length);
	    // then we are going to read fromt he memory to the tempbuffer
	    bytesread = readVirtualMemory(vaddr, tempBuff, 0, currentLength);
	    // tranfer the data in tempbuffer to openfile
	    openFile.write(tempBuff, 0, bytesread);
	    // increment all those counter;
	    amountCopied += bytesread;
	    vaddr += bytesread;
	    // if the amount you read from the memory is different from what we intend, break
	    if (bytesread < currentLength) {
	      db1("handleWrite: something wrong terminating bytesread " + bytesread
		  + " currentLength " + currentLength + " vaddr 0x" + Integer.toHexString(vaddr));
		break;
	    }
	}
	db1("handlewrite terminating amountCopied " + amountCopied);
	// after all this is done, return the amound we copied
	return amountCopied;

    }




********************************************************
Terence April 10:00 PM
I guess everybody just felt asleep
here is what i think when i was dreaming.... i submit to autograder and find that
the count is 2147483647.. this is just ridicuriously high.. wehn we
allocated a array that is that big. i think that's where the out of
memory is.
solution: have an array set to a certain size, x. do a for loop and copy
x bytes at one time

********************************************************
Terence April 2 6:45 PM

more goodies
put this in .emacs file.. 
press f10 to compile, shift f10 to run

;; set default directory
(setq compile-directory "~/nachos/proj2")
(setq home-directory (getenv "HOME"))

;; unset teh default f10, f11
(global-unset-key [f10])

;; set f10 to run nachos in shell rather than in gjdb, uncomment it
;;(global-set-key [f10] '(lambda () (interactive) (cd compile-directory) (shell-command "nachos")))

;; set f10 to do gmake
(global-set-key [f10] '(lambda () (interactive) (cd compile-directory) (compile "gmake")))

;; set shift f10 to run gjdb
(global-set-key [\S-f10] '(lambda () 
		     (interactive)
		     (cd compile-directory)
		     ;; gjdb -soucepath homedirectory nachos.machine.Machine
		     (gjdb (concat "gjdb -sourcepath " 
			   (concat home-directory " nachos.machine.Machine")))))


********************************************************
Elaine April 2 5:11 PM

Terence: I think I fixed the error, it was b/c if the child
failed to execute, I don't decrement the remaining processes
by one, so halt is never called. 

I'm not sure if I have to free up all the processes mem or
anything though.

********************************************************
Elaine April 2 12:29 PM

Newest results posted, exit now passes. The problem was that
in exit, coff.close was not called. The Null Pointer Exception
is still present in sh.coff which bothers me. Any ideas?

Write is still not faling gracefully. I'm thinking maybe it's
a read-only problem. Other people on the newsgroup have been
asking about that.

Matrix multiplication now works. Haven't tested the other programs.
Will work on it after discussion.

Also, running programs from nachos -x .coff is not working,
as in not executing the program. Any ideas? I know I can remove the
assertion, but that wouldn't fix the problem. Is this okay?

Michael: I will submit your version, but it will take some
time to get the result.
********************************************************
Michael April 2 noon

Elaine's submission is still on the queue, and I don't have
her latest code, nor do I want to kill her job. 

I stuck a lock in exit so the function
can't be called by several things at once. I believe the
problem we had may have been a concurrency issue, with 
many processes decrementing the total process count causing
the system to halt early. I may be wrong. If anyone reads
this, please check ethe autograder queue for elaine's submission.
If it is gone, grab the new UserProcess from CVS (it's in
userprog) and submit. I need to go to class now. Sorry
for all the problems with exit, I can't believe I didn't
stick a lock on there earlier. Hopefully this will allow
us to run some of their test programs like matrix multiply.
*********************************************************
Elaine April 2 8:51 AM

Thank you Terence, the script is perfectly fine now. 

Yeah! We're passing more tests again! Anyone have any clue
on the write not failing gracefully error? I'm sort of 
stumped. 

For the exit one, maybe it has something to do with a
NullPointerException that I'm getting when exec fails. If
you run sh.coff, and type some bogus arguments, and then
try to exit, there's an exception. 

*********************************************************
Terence April 2 1:05 AM
unloadsections seems to be too simple to be wrong... i am still in a
spring break mode.. too tire to look at code in the morning...

*********************************************************
Michael March 31 Midnight
Exit test doesn't pass at the moment. Exit should do the
following things:
Close Files
Free Memory
Orphan Children
Tell parent that it's dead
Decrement number of processes
If last one, halt.

I've looked quite a few times, and I belive it does these.
I can't be certain, but I suspect the problem lies in either
the closing of file descriptors (which doesn't seem to pass
the AG test atm) or the freeing of memory. Those are the 
two areas I would check out first.

**********************************************************
Terence March 31 11:20 AM
did the script not work, elaine?
oh sorry.. it should be a txt file instead of html....
tell me if anything goes wrong

**********************************************************
Terence March 31 11:50 AM
sorry that was my fault. i forget to uncomment the submit program.. i
was trying to test
the script (you know when i test the script, i better comment out the
grading program) and i forget to comment that out... i will clean the
thing up for you ...
when you get back the autograder result. just do taddResult as usual...
the timestamp is 0401-1918

**********************************************************
Elaine April 1 7:20 PM

Thanks for all your tips. We tried to fix up some things.
Thanks for making a new script for submitting too. It's very
easy now!

Do I have to add anything to my .cshrc besides 
"set path = ( /home/bb/users/terence/myscript/shell $path )"
to make it work? I tried submitting, but the autograder didn't
respond, after a waited a while.  

**********************************************************
Terence March 31 11:50 AM
just some thoughts.. maybe i am being retarded... but this are some
possible bug....

in exec, check file it it is null terminating and end with .coff
agc is non negative

how do you do with framentation? in fd? say you open 7 file
descriptor, then it close the one at 3. do the next one open at 3 or
open at 8?

quote from syscall.h
if anyprocess still have file open, the file will remain in exsitence
until the last file descriptor referring to it is closed. create and
open will not be able to return new file descriptor for the file until
it is deleted? <-- is this handle by stubfile system?

check file descriptor is negative?

not quite sure about these two
what is the difference between status and exit status? could we do it
in one variable? or i am just being stupid.

in write, is it true that bytesread != bytewrite, then it is an error?
shouldn't it return number of bytes sucessfully written? -1 if and
error occurs? but if they are not equal, is that necessary an error?

**********************************************************
Amy March 30 10:26 AM

cleaned PS and LS is in nachos/threads/ so get that updated version
before u submit, thanx :)

 **********************************************************
Terence March 29 11:30 PM
i completely rewrite the tsubmit script
- make it even easier for you, you don't even need to touch the result
file
- change the questions slightly
- just backup the file we need instead of the whole nachos directory,
because i am running out of diskspace!
- you do tsubmit as usual. it will give you a timeStamp. write it
donw
- so when you get the autograder result, you save it down as
whatever-you-want
- then run taddResult whatever-you-want time-stamp-from-tsubmit
- that's it!

**********************************************************
Terence March 29 10:30 PM
i clean up the result.html a little bit because my account exist
quota! so i delete those submissions with 0 tests passed.. so don't be
alarm that your submission entry is gone.. i removed them...
also, i notice that some submissions entry are actually pointing to
missing tar files.. i am just wondering how that happen? did my script
fail to function? tell me if anything wrong with tsubmit, k?
just a reminder, when you are editing result.html, you do not need to
change that tar file link. the script should do the reference
automatically for you.

**********************************************************
Terence March 29 6:45 PM
All right! all my tests (my part) works! bahaha! we are doing good! 4
more tests to go! 

**********************************************************
Amy March 29 4:34 PM

finally...PS/LS working.......
it is in nachos/proj2/junk....a little bit messy....will fix it
soon...if u want it, they are there...:)

**********************************************************
Amy March 28 12:30 PM

ok...i fix one of the bug in PS/LS...it was b/c of my code...(my
nextThread())...but now i run into another infinite loop...this
time...i m not really sure if it is my code...so this is the prob:
so...in KThread.yield(), it tries to call currentThread.ready()...and
by doing this...in ready(), it does not do a check if this
currentThread is running (what i meant is it has acquired the
readyQueue...so it will just put the thread in the readyQueue even
though it is already running...and this is also due to not calling
nextThread before doing this ready)....so i m not sure i know how to
solve it....so...anyone help?

**********************************************************
Terence March 27 9:21 PM
ah strongly recomment uh book called "code complete" sheeit! dis here
book iz da sheeit, nig! pimp-tight book! ax me if ya wants ta borrow
it.

**********************************************************
Amy March 27 8:35 PM

terence help me, i need help! im me ok

**********************************************************
Michael and Elaine (also know as ME) March27 7:55 PM

Known problems: 
part 1: stdin, write does not die gracefully
part 3: join doesn't work (bad exit code), exit has problems

The error messages for ag for part 2 seem to all depend on
join. We will work on it on Fri, if anyone wants to take a
look , it's in CVS in userprog  (update UserProcess/UThread/UserKernel)

**********************************************************
Terence March 27 7:04 PM
i just found out that declaring accessor/modifer private and final is
a good thing. the compiler will treat that as a inline function!
wow!!! (at least i think it is cool... don't know about you)
declaring final to debug flag.. will actually do not compile the
debugging code (if false)... wowo!!!
anyways...

**********************************************************
Terence March 27 6:27 PM

sorry.. that was my fault... maybe i should put think of some way
putting test function in other file.. cannot think of any ways yet... 

anyone need help? writing test cases? i am bored!

**********************************************************
Elaine and Michael March 27 5:07 PM

Yay, Elaine found a big problem. Someone changed run, it's 
now changed back to the version in the reader. We pass
9/31 tests. Yay us.
**********************************************************
Elaine March 26 9:15 PM

Michael: I'll be at school tomorrow at 3 in the afternoon.
I'll turn on AIM.

**********************************************************
Amy March 26 2:00 PM

tried submitted...stack overflow again...hmm..........

**********************************************************
Amy March 26 12:05 PM

ok...for the lotteryScheduler...i got a stackoverflowerror...so i use
gjdb to trace...it happens when we are initializing the 64 phys
page...i mean when we put it as free pages in the linked list...
so right now i took out the lock at that place it passes that part...

but now i run into another prob...nullpointerexception....this is
caused by the semaphore, where it called waitforaccess when there's no
resourcesholder...i mean...we can do that? call waitforaccess when no
resourcesholder?

**********************************************************
Elaine March 26 9:31 AM

Michael: When do you want to meet tomorrow?

**********************************************************
Amy March 26 12:53 AM

what i mean is the thread called main (when i get the name of the
current thread?)  not exactly sure yet...i will look at gjdb tomorrow.

**********************************************************
Terence March 25 12:25 AM

errr.. not really sure either... make sure the selftest in userkernel
is what you want... otherwise not sure. was it running any user
program?
what do you mean 'keeps calling setEffectiveprioiroty in the thread
called main'? fire up gjdb. set a break point in seteffectivepriority
and do "where" try that to see if that helps


**********************************************************
Amy March 24 9:47 PM

i added priorityscheduler.java and lotteryscheduler.java in junk (no
comment yet...) 
i try to test it using threadedKernel....it seems to work...but when i
try to do it in UserKernel...it goes through an infinite loops...

do anyone know y? m i missing something that i don't really know?
i will look at it a bit later....it seems like it keeps calling
setEffectivePriority in the thread called main?! anyone knows??

i try to submit the proj...we passed 0/31 tests :)

**********************************************************
Michael and Elaine March 22 9:18 PM

Finished exit, join, exec. No error checking, or testing yet.
Will work on it Wed. 

Located in proj2/junk/UserProcess.java

**********************************************************
Elaine March 22 2:23 PM

Terence: Apologies. I commented out selfTest2 which made 
everything not work. *Must beat head against wall now.*

Okay, will work on it now.

**********************************************************
Terence March 22 12:21 PM
oh course i know how to run the -x thingy. i think it will be really
nice at least we can gave teh shell running then we can run a whole
bunch of crap.

i think the reason why it halt is because i forget to check selftest
to point back to the original function.. this is what i can think of
right now.. i don't think there is anything wrong.. oh well, i will
talk to you after lecture

**********************************************************
Elaine March 22 10:01 PM

Terence: Thank you for merging everything together. We've
tried to be more modular, and appreciate your complements. 

I think there's something wrong with UserKernel or something else 
b/c it doesn't load in and run the program I pass into the nachos cmd line.
Or maybe I'm just not using the program correctly, someone tell me.
I typed "nachos -x createFile.coff" and it just halts the machine.
The same for "stdout.coff"
I commented out the selfTest method.
This will work on our old UserProcess(Ver 1.7) and UserKernel (Ver 1.1). 
I'll put a more detailed description of FileDescriptor class in
the next update.

The reason filedescriptor is null is b/c I initialized it in the
constructor for UserProcess, so in the constructor, 
fd = new FileDescriptor() needs to be added.

I uploaded some simple filetests (createFile.c, stdout.c) into
nachos/proj2/junk. Still need some help on how to test stdin.
If you want to run the test programs, just put them in nachos/test,
run "make .coff" and then from proj2/nachos type
"nachos -x .coff"

**********************************************************
Terence March 21 6:30 PM

I merged 1 and 2 together. rename your own file. (Elaine and
Catherine: if you did not modify it since you last update it) then 
cvs update it, otherwise you need to merge it yourself... 
guess what? you show GREAT improvement on how you write the code! GOOD
JOB!!! 

oh yeah. since we had two different db functions. i changed the
db function for part 1 to db1 and db function for part 2 to db2 and so
is part 3... 

let's have function "spo" as a tester print out function. i will add
this to the style file.

katherine: the fd is never instantianted, it give me a null pointer
when i try to write.

you guys really did a good job in writing the code!!!

Michael: i think we do need your part because the whole thing cannot
really run as a "whole" if part 3 is not done. so...

elaine + katherine: it would be nice to tell me what is a file
descriptor, detail of your implementation. see it is already too
"early"... cannot think well.....

i wrote some tests case (like a draft) in design directory

**********************************************************
Terence March 21 9:10 PM
From what i heard from people, people don't passed a lot of
tests. i actually i expect a relative high score for project 1. I am
going to work on it whole night... i am not sure my part is done
yet.. so far it passed all the test i made.. anyone want some tests
cases? i could write some for you...

**********************************************************
Elaine March 21 8:55 PM

Fixed up read/write filesystem calls. Will work on exec,join,
exit tomorrow. We'll need Part 2 to test those calls.

The current version of UserProcess in CVS will do all the
filesystem calls. I'd appreciate if someone made up some 
tests for them, to make sure that we're not crashing the kernel.

Amy: Thanks for telling us about the proj1 scores. I think we
all did a good job.

**********************************************************
Amy March 21 7:17PM

wow, 57/60 on proj1-code....so i guess emil didn't take off points for
our priority scheduler?

**********************************************************
Elaine March 21 10:47

Am testing file System calls. Will finish that today and add
error-checking. Hopefully, exec, join, exit will be finished
on Friday. The current version of UserProcess.java  is in CVS. 
It compiles and creat, close, read, unlink, work ,but no 
error-checking yet.

Amy: I think that's right, we can ask in the design review.
 
**********************************************************
Amy March 21 7:57 AM

for lotteryscheduler....so priority is now:
1<=priority<=Integer.MAX_VALUE?
no matter if it is donating or not right? just making sure...

and kat: i put the LS in junk (nachos/proj2/junk)...so if u want to
look at it...go for it...very messy and buggy tho...will look at it
again on fri....

**********************************************************
Terence March 20 10:16 PM

Just wondering if any of us are going to at least look at the code
after this friday.... (i am not implying anything, just a stragith question)

I got a problem. i could not fully test my question until the file sys
call is implement... so.... yeah...

**********************************************************
Elaine March 20 9:03 AM

Michael: Friday is fine for me. Good luck on your midterm.

Katherine: Haha. I'm very stupid. When you create a file, you're
actually calling open, so you can't create a file without opening
it. I think open doesn't change files, while create kills them.
(The TA was nice enough to answer my question
anyway.)

**********************************************************
Michael March 29 3:16 AM

Elaine: Friday afternoon ok? I have a midterm Thursday that
I need to prepare for.

**********************************************************
Katherine & Elaine March 19 8:47 PM

Final design doc submitted. It's located in 
proj2/design/proj2-design.ps

Also submitted File System calls implementations in
UserProcess.java. Will add error checking and test implementation
after part 3 is done.

**********************************************************
Elaine March 19 3:47

Sorry Katherine. I was wrong about the read/write. Thanks
for telling me! 

Michael: When would you like to meet to do part 3? I'm 
available any day in the afternoon or evening.

**********************************************************
Amy March 19 03:03 PM

Design Meeting w/ Emil on Thursday 12:30PM 411 Soda!
Be there!

 
**********************************************************
Terence March 18 12:55 PM
i don't think this is it... i just think the autograder has something
wrong with it... it just sound too good to be true. let's talk to the
TA in office hour


**********************************************************
Elaine March 19 9:14 AM

Congratulations Terence! You are so fast! But I'm sort of
confused about how it passes the file and lottery scheduler
tests when they haven't been implemented yet?

Katherine: What do you mean? For write, I thought you wanted
to write from a buffer to a file where the file is referenced
by a vaddr from a process.

**********************************************************
Terence March 18 4:08 AM
i did my part! i passed all my tests! look at results.html

anyone need help?

**********************************************************
Katherine March 19 2:44 AM

Elaine: 
 for read: we should use writeVitrualMemory instead of
 readVirtualMemory
 for write, we should use readVirtualMemory instead of
 writeVirtualMemory
 because a write to file is reading from the process memory

**********************************************************
Terence March 18 2:15 AM
so what happen? did we finish doing our stuff? are we ready to submit?
so when should we set "our done compiling deadline"?
the test caese are up... so it is possible to finish before break...

**********************************************************
Terence March 15 15:33
Here is the design we responsible for

Elaine: 1 & 3
Katherine: 1 & 4
Amy: 2 & 4
Micheal: 3
Terence: 2

meet together on sunday noon

**********************************************************
Amy March 15 11:33 AM

Terence I can really tell that u r excited....

so WHO CHANGED LOCK.JAVA?! and also do we count as passing the tests 6
or not...in terms of grade i meant.

**********************************************************
Elaine March 15 9:08 AM

I will try to be more modular this time. To confirm Terence's
comment, Emil did say that parts I(File System Calls) and 
III (syscalls) were easy to implement while the hard parts
are II(multiprogramming) and IV (LotteryScheduler).

At least we know that the priority schduler is working (I
can't believe that Lock.java had the bug) Did you know that
Emil can look at all of our accounts anytime he wants? Okay,
I know everyone else knows, but it was a surprise to me!

Ranjit is in Seattle (Microsoft interview maybe?) so no
OH today. I will see everyone at 3 then. Maybe someone wants
to help me with CS170 HW after? :)

Maybe we can finish early and have a fun spring break? I know,
it's wishful thinking, but you never know.

**********************************************************
Terence March 14 6:03 AM
This time PLEEEEAASSE USE FUNCTIONS for PART I AND III.
example 
case(syscallHalt):
	processHalt();
	break;
case(syscallExit):
	processExit();
	break;

this is reall important..... 60% of the points of the porject is in
this functions (handleSyscall, page 293... so dont screw it up!

i wrote a file with all the class i should know... if you want to
check it out, it is in the design directory.

**********************************************************
Terence March 14 4:00 AM
I added a design directory to store our design-stuff
I added a junk directory so we could share buggy code.... Don't need
to copy to my temp anymore and set chmod... all those crap....
i started proj2-draft.txt in design directory

do cvs update -d
k?

again design is due next week tuesday AND the sad thing is the project
is due four days after the spring break... that mean.... sigh...

Here is some lessons we learn from project 1:
1) clean and glean (please make sure you check out
http://www-inst.eecs/~cs162-nx/programSeg.txt &&
http://www-inst.eecs/~cs162-nx/programStyle.txt

should discuss if we want to add more stuff to it and should we
enforce the style

2) do frequent backup
3) make sure to tar && gunzip before we submit... (if you use the
script, it make it a lot easier...)

4) deliever work randomly is bad idea....
 
ALLRIGHT, i feel elaine is getting EXCITED about this... ME
too.... This is so much more interesting than the first one... 

To answer elain's question today. the process execute TAL
instructions.. not MAL...

anyone want to add to this. feel free to bring it up.

so just in case you miss out, here are some goodies we have for now
http://www-inst.eecs/~cs162-nx/log.txt - This log!

http://www-inst.eecs/~cs162-nx/result.txt - tsubmit would put result
to this log
you can change it by emacs ~cs162-nx/results.txt

http://www-inst.eecs/~cs162-nx/autograder - directory where to store
autograder result

http://www-inst.eecs/~cs162-nx/be_arch - password protected directory
where we put our code.. (can be access throught the net) tsubmit is
going to tar && gunzip it to this directory..

http://www-inst.eecs/~cs162-nx/contact.htm - all our contact. 

http://www-inst.eecs/~cs162-nx/doc - java doc of nachos


**********************************************************
Terence March 14 12:42 AM
This is what Emil told me. The syscall functions for proj2 is
ridiculously easy. The hard part would be multiprogramming. Lottery
scheduler will be a moderately subproject... (Elaine: please confirm
me for this... )

**********************************************************
Terence March 14 8:31 PM

guess what? the project design is due next week tuesday!!!!!!
we better guess our ass starting

This is what emil says!!!!

I found the problem that you were having and it appears that your 
PriorityScheduler works fine.  The problem was that you changed 
Lock.java to use a non-donating queue.  When I changed it back, your 
scheduler passed both ThreadGrader6a.a and ThreadGrader6a.b.

Cheers,
Emil


sigh.... this is pretty sad man....

**********************************************************
Elaine March 14 10:00 AM

Friday at 3 is fine, unless Ranjit says he's going to have
OH tomorrow at 3. Then I'd like to go to OH, b/c I really 
don't understand the HW or dynamic programming. :(

Oh, yeah, I forgot to say that I CVS committed the final
version of ElevatorController and Rider, not that anyone is
going to be looking at them anymore. :)

*************************