Section notes for 16 January 2007
Sections 101/102/103
GSI: Thomas Kho <cs162-ta@inst.eecs.berkeley.edu> /
<tkho@eecs>
Based on notes by Hakim Weatherspoon and Karl Chen
Agenda
Class logistics
Projects Comments
Project Phases
CVS (CVS overview below)
What is an OS?
• Coordinator
• Resource allocation & management => concurrency
(CPU, I/O)
• Sharing & protection
• Extended machine
• "Nice interface"
• Standard functions - POSIX
• File system
• VM
• Etc.
Program vs Process
------------------
• Play vs Script
Homework 1
==========
Event-driven simulation
• Event list
• Events: start job, stop job
• Each event on event list contains event time
• Advance clock to next event -- don't "tick"
• Get started on RR
• Will go over other scheduling algorithms (overview)
• Order: SRPT, SJF, SET, RR, FCFS
Generating hyperexponential random numbers
• R = new java.util.Random()
• U = R.nextDouble()
• exprand = (0.20)(-ln(U))
• U = R.nextDouble()
• if U < .8: exprand(0.20) else if U < .95 ...
Quick CVS Primer (also see http://inst.eecs.berkeley.edu/~cs162/fa06/Nachos/cvs.html)
Basic CVS usage
1) Set your CVSROOT environment variable to point to the repository:
setenv CVSROOT <repository dir>
If you want to check the files out from a remote machine (say, over
ssh), then you would use the following instead:
setenv CVSROOT cs162@torus:/home/ff/cs162/repository
setenv CVS_RSH ssh
2) Check out a local copy of the files you want to edit. For example, to
modify your project's Nachos code, you might do:
cvs co nachos
This will create a "nachos" directory with all of the Nachos code
in it.
3) Edit your local copy of the files.
4) Commit the changes back to the repository:
cvs commit
This will start up an editor for you to enter a log entry describing
your changes. PLEASE enter a descriptive entry of the changes you
made -- this will make tracking changes a lot easier.
Note that you cannot commit changes unless your local files are
up to date: that is, that you have been editing the most recent copy.
See next step...
5) For other users to see the changes, they need to do:
cvs update -d
which will update their local files to be in sync with the repository.
If there are conflicts (that is, someone else edited the same file
while you were in the process of editing it), you will be notified at
this point and given a chance to fix the conflict.
To add a file or directory to the repository, just do:
cvs add filenames...
After 'cvs add' you need to 'cvs commit' for the addition to take
effect.
Also: 'cvs import' to add a whole tree (e.g. the nachos code for the first
time):
cvs import <tree-root> <placeholder> <placeholder>
To remove a file, first remove it from your local copy:
rm filename
Then remove it from the CVS repository:
cvs remove filename
cvs commit
Other features:
- Can check out copy of code as it looked at a given time
cvs co -D "yesterday" nachos
cvs co -D "02/03/03 8:00" nachos
- Can tag a version of the file for later use:
cvs tag working1
cvs co -r working1 nachos
- Can look at changes:
cvs log
cvs diff -D "yesterday"
cvs diff -r 1.3 foo.java
IMPORTANT CAVEATS:
Note that CVS does not allow you to rename files - you need to "remove"
the file and then "add" the file under the new name. In general it's
best not to rename files, since this loses all of the editing history
for that file.
Also note that CVS does not allow you to remove or rename directories
once they have been added to the repository. THIS IS VERY IMPORTANT!! Do
not add directories to the repository temporarily - you can never get
rid of them. This is a real drawback to CVS, but it's something you just
have to live with.