Multi-thread
Currently Nachos does not support multi-thread (or multi-process), so we need a pid
to note the process.
Actually, we only need to modify the addrspace
code, but it cannot be tested directly, so there is an Exec
system call.
有点晕,先记录一下。
One of the flaws in Nachos is that you cannot expand a file in the Nachos File System. So this is what experiment 5 does.
We need to do the append and half append, both from UNIX file to Nachos file and from Nachos file to Nachos file.
We define two separate implementations of the file system.
The “STUB” version just re-defines the Nachos file system operations as operations on the native UNIX file system on the machine running the Nachos simulation. This is provided in case the multiprogramming and virtual memory assignments (which make use of the file system) are done before the file system assignment.
The other version is a “real” file system, built on top of a disk simulator. The disk is simulated using the native UNIX file system (in a file named “DISK”).
In the “real” implementation, there are two key data structures used in the file system. There is a single “root” directory, listing all of the files in the file system; unlike UNIX, the baseline system does not provide a hierarchical directory structure. In addition, there is a bitmap for allocating disk sectors. Both the root directory and the bitmap are themselves stored as files in the Nachos file system — this causes an interesting bootstrap problem when the simulated disk is initialized.