When using physical addresses directly, there is no virtual to physical translation overhead. Assume it takes 100 nanoseconds to make a memory reference. If we used physical addresses directly, then all memory references will take 100 nanoseconds each.
What would the working set algorithm try to accomplish, and why? (Hint: These two cases represent extremes that could lead to problematic behavior.)
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int
main (int argc, char *argv[])
{
int fd, r;
char buf[16];
// equivalent to creat("file") in Nachos
fd = open ("file", O_RDWR | O_CREAT, S_IRUSR | S_IWUSR);
write (fd, "hello", 5);
r = read (fd, buf, 5);
buf[r] = '\0';
printf (buf);
}
a) What is the output of this program? To verify your answer, you can create a file on ieng6, copy the code into it, and then compile and execute it.
b) Why is that the output?