Question: Part I: Virtual Memory Questions 1 . A certain computer provides its users with a virtual - memory space of 2 3 2 bytes. The

Part I: Virtual Memory Questions
1. A certain computer provides its users with a virtual-memory space of 232 bytes. The
computer has 218 bytes of physical memory. The virtual memory is implemented by
paging, and the page size is 4096 bytes. A user process generates the virtual address
11123456(this is in hexadecimal (base 16)). Explain how the system establishes the
corresponding physical location. Distinguish between software and hardware
operations. Feel free to use a diagram (simple ASCII is fine) if you wish, but thats
not required.
2. Assume we have a demand-paged memory. The page table is held in registers. It takes
8 milliseconds to service a page fault if an empty page is available or if the replaced
page is not modified, but 20 milliseconds if the replaced page was modified. Memory
access time is 100 nanoseconds.
Assume that the page to be replaced is modified 70% of the time. What is the
maximum acceptable page-fault rate for an effective access time of no more than 200
nanoseconds? Show your work
Coding:
Write UnixLs, a program that emulates ls, in UnixLs.c
Implement only the following options:
1.-i
2.-l
Testing:
To test the program simply run the program and specify the options the same way
you would for the ls command. Be sure to test every option you have
implemented and all the permutations of the various options (e.g.-il,-i,-li,-l,
etc.) Of course, don't forget the most obvious test of all, no options. You can
determine if your output is correct by observing what ls with similar options
produces.
The output of your program should mimic the standard ls command with the following
exceptions:
1. You should require that any options (-l -il -i) to your command come before any
directory names. The standard ls command allows options to appear between and
after directory arguments.
2. File listing order does not have to be identical to ls. You may list the files in whatever
order is convenient for you rather than sorted alphabetically as ls normally does.
3. To simplify the printing of dates, you are to use the format
mmm dd yyyy hh:mm
regardless of the date. An example date would look like:
Oct 2201913:32
The real ls command omits the year if the date is less than a year in the past and
replaces the minutes and seconds with the year if the date is more than a year in the
past.
4. When performing a long listing (-l) there is no need to print the line that begins with
"total".
5. You should print the files one per line (as ls -1 does, rather than attempting to format
the list of files into multiple columns.
Here are a few other test cases you should try:
% ls -i ~/
% ls -l
% ls -i -l .. ~
% ls -li ... ~
Then replace "ls" with "UnixLs". The output should be very similar to the original ls
command; however the order with which you list the entries is allowed to be different.
Also note that you may have an alias for ls that provides some arguments all the time. To
see if you have an alias for ls, type alias ls, and to make the alias go away (for the
duration of the life of your current shell) type unalias ls.
Hints
Focus on extracting the proper information and just printing it. Once you have
that all done work on making the format match the ls command.
Consult the the provided file infodemo.c to see what calls to use to get actual
group and user names.
Consult the provided tutorials in the assignments section of the course webpage
for information on UNIX file system structure.
Don't forget to test your code on directories with symbolic links in them.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!