Starting from:

$30

Assignment #3 - LionCloud (v 1.1)

Assignment #3 - LionCloud (v 1.1)

This next assignment will build upon your completed code for the previous assignment. You MUST use the the code turned in for the previous assignment. If you have bugs or incomplete code you have to fix it first. You are to implement new features and integrate code for the new features and workload. Unless stated otherwise, the architecture and behavior of the new system is the same as in the previous assignment.
Feature Overview
You are to extend your device driver that sits between the virtual application and virtualized hardware devices. As before, the application makes use of the abstraction you provide called the LionCloud driver. In this next assignment, you will make modifications to the code to implement the following features:
1.    The new manifest has more than one device.
2.    The new workload has more than one file (in fact it has many). Reads may also span an arbitrary number of blocks, and be performed anywhere in the file.
3.    There is a new operation that you must implement. This op code initializes the device and gets the number of blocks and sectors (which may be different for each device). The op code is called LC_DEVINIT. The frame values for b0, b1, and c0 as the same as in the previous assignment. The other frame values are:
Operation    Description    Remaining register use
LC_DEVINIT    Initialize interface to a specific device    When sending:
o    c1 - device to initialize
o    c2, d1, d0 - 0
When receiving
o    c1 - device initialized
o    c2 - 0
o    d1 - the number of sectors in this device
o    d2 - the number of blocks per/sectopr in this device
You cannot depend on the constant size of the device info:
#define LC_DEVICE_NUMBER_SECTORS 10
#define LC_DEVICE_NUMBER_BLOCKS 64    
These numbers are not even defined any more. The idea is that once you did the LC_PROBE and find that a device exists, you will have to LC_DEVINIT and learn how many sectors and blocks there are for each device. You then have to dynamically allocate memory to hold the information you had for your previous device.
4.    Implement a LRU cache that caches blocks retrieved and written to the LionCloud devices. The API for the cache is provided in lc_cache.h and the starter code for the implementation is in lc_cache.c. You will need to:
o    Implement all of the functions defined in the file.
o    Add code to call the functions from your driver implementation. In particular, any place you get a block from the driver, you should check first if it is in the cache.
o    You should collect statistics on how many hits and misses you have. Print out the values and your hit ratio when you close the cache.
The cache should be fully associative (any block can go in any cache line). It should be dynamically allocated when lcloud_initcache is called. Each line should contain the device/sector/block and data. You can use a hash table or perform a linear search over this data structure to find entries or empty lines. You may also use other data structures as you see fit.
It is recommended to implement LRU by tracking when each element was last used, and linearly searching for the oldest element as a candidate for eviction.
Instructions
1.    Login to your virtual machine. From your virtual machine, download the starter source code provided for this assignment. To do this, go to the canvas website and download the file assign3-starter.tgz (you should be able to click the link here).
2.    Create a directory for your assignments and copy the file into it. Change into that directory.
3.    % mkdir cmpsc311
4.    % cp assign3-starter.tgz cmpsc311
5.    % cd cmpsc311
6.    % tar xvzf assign3-starter.tgz
7.    % cd assign3
Once unpacked, you will have the starter files in the assign3, including the source code, libraries, some workload and manifest files and a Makefile.  Note that there is a file cmpsc311-assign3-sample-output.txt that contains sample output from my implementation of the assignment.
8.    Copy your code from the previous assignment. For most the only file you will need is the lcloud_filesys.c file. To copy, simply use the UNIX cp command. For example:
cp ../assign2/lcloud_filesys.c .
NOTE: be sure to make a copy of the original file before you start. A good way to do this is to email yourself a copy of the code before you get started.
9.    You are to complete the lcloud_cache.c functions defined above, as well as extend the functionality in the lcloud_filesys.c to meet the requirements above. Note that you may need to create additional supporting functions within the same file. Include functional prototypes for these functions at the top of the file.
10.    Add comments to all of your files stating what the code is doing. Fill out the comment function header for each function you are defining in the code. A sample header you can copy for this purpose is provided for the main function in the code.
11.    To test your program with these provided workload files, run the code specifying a workload file as follows:
./lcloud_sim -v cmpsc311-assign3-manifest.txt cmpsc311-assign3-workload.txt
Note that you don't necessarily have to use the -v option, but it provides a lot of debugging information that is helpful. If the program completes successfully, the following should be displayed as the last log entry:
LionCloud simulation completed successfully!!!
To turn in:
1.    Create a tarball file containing the assign3 directory, source code and build files as completed above. Submit the final tar file through canvas by the assignment deadline. The tarball should be named LASTNAME-PSUEMAILID-assign3.tgz, where LASTNAME is your last name in all capital letters and PSUEMAILID is your PSU email address without the "@psu.edu". For example, the professor was submitting a homework, he would call the file MCDANIEL-pdm12-assign3.tgz. Any file that is incorrectly named, has the incorrect directory structure, or has misnamed files, will be assessed a one day late penalty.
2.    Before sending the tarball, test it using the following commands (in a temporary directory -- NOT the directory you used to develop the code):
3.    % tar xvzf LASTNAME-PSUEMAILID-assign3.tgz
4.    % cd assign3
5.    % make
6.    ... (TEST THE PROGRAM ~ see above)
TO MAKE A TAR FILE USE “tar czvf UNAL-tuu2-assign3.tgz assign3”

More products