Quiz#5: Nachos

1. Why does Nachos have two modes of execution?



2. I want the current thread to run a user program. What is wrong with the following code?
        Thread *t = new Thread("userthread");
        OpenFile *executable = fileSystem->Open();
        AddrSpace *space;

        if (executable == NULL) {
	   printf("Unable to open file %s\n", filename);
           return;
        }
        space = new AddrSpace(executable);
        space->InitRegisters();
        space->RestoreState();
        machine->Run();




3. All files created by user programs running on Nachos have the Noff format.

True
False

4. I want to run the program "myprog" on Nachos. What is wrong with the following instructions for compiling "myprog.c"? Assume all macros such as CC and CFLAGS have been previously defined.
   1     myprog.o: myprog.c
   2     $(CC) $(CFLAGS) -c myprog.c
   3     $(LD) $(LDFLAGS) myprog.o start.o -o myprog.coff
   4     ../bin/coff2noff myprog.coff myprog



The name of the program that runs on Nachos should be "myprog.noff" and not "myprog".
"myprog" is a silly name.
While making the executable "myprog.coff" in line 3, "start.o" should go before "myprog.o".