Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Project 4 FAQ

0 views
Skip to first unread message

Robert Bosch

unread,
Dec 2, 1996, 3:00:00 AM12/2/96
to

Folks--

There have been a number of recurring questions regarding the last
homework. Hopefully this will clear up several of the confusing
points. These will be added to the HW4 FAQ shortly.

Problem 2
---------
Forget the "not necessarily" part. This implementation WILL require
doubly indirect blocks.

Problem 4
---------
In UNIX, the notion of a current working directory is kept at user
level. Each user process has an environment variable called $PWD,
which is used by user programs to convert a relative pathname into an
absolute pathname before it is passed to the kernel. User programs
can inherit environment variables from their parents, so when you run
a program like 'cp' or 'ls', it can simply use the inherited PWD to
convert any relative pathname arguments into absolute pathnames. As a
result, the kernel has no knowledge of working directories and deals
only with absolute pathnames.

This is problematic in Nachos for two reasons. First, user programs
in Nachos don't have access to any of the standard C libraries, so
doing the necessary string manipulations would be painful. Second,
Nachos currently has no notion of environment variables; so even if we
set a working directory for the shell, we have no way of passing this
information down to a child process.

So for this assignment, you should simply keep the current working
directory in the AddrSpace of each user process. Since the kernel is
keeping track of the PWD, you'll need to make the 'cd' command into a
system call (this is not necessary in UNIX, where the shell uses cd to
change its PWD). When you Exec a new process, it should inherit the
PWD from its parent. You're welcome to do it the other way if you
like, but be aware that it adds a fair amount of complexity.

In addition to adding a system call for "cd", you'll also need to add
"ls" and "mkdir" to allow you to access directory state. You'll need
to create new system call numbers and handle them explicitly. We've
created a new syscall.h with these system calls present. YOU MUST USE
OUR SYSTEM CALL NUMBERS. Our testing programs will be using them and
you don't want these tests to fail. If you haven't modified your
syscall.h, just copy ours from /usr/class/cs240a/userprog/syscall.h
and you'll have the numbers. Otherwise you'll need to do a merge.

You'll also need to add the procedures that use these system call
numbers to the start.s file in your tests directory -- this file is
also available in /usr/class/cs240a. This will allow you to call these
system calls just as they are called in the "halt" program. Once
you've done this, "ls" and "mkdir" then become simple user programs to
write. Of course the implementation has to be done...

Finally, we are not requiring you to implement rm/rmdir applications
and their associated system calls, nor are we requiring you to include
UNIX-style '.' and '..' entries in your directories. However, if you
do we'll be suitably impressed.

Testing
-------
For simplicity, please name your shell "shell.c" in your test
directory -- we will use your shell in our test scripts, and having a
consistent name scheme will make things much easier for us.

Good luck!

Robert and Steve

0 new messages