CPSC503 Operating Systems Fall 2017 Project 2 – A Portable File System using Contiguous Allocation

CPSC503 Operating Systems Fall 2017 Project 2 – A Portable File System using Contiguous Allocation

Method for GCP VM Due: Friday, December 1, 2017. 11:59:59 PM (EST) Objective:

1. Practical experience with the problems of file systems. 2. Experience with the Windows or Unix/Linux operating system. 3. Keep the definition simple. Don’t read things into the problem that aren’t there.

These will be individual projects. For Project 2 you will use any operating system under Google Cloud Platform (GCP) VM. You may write the program in any language that is supported under any Integrated Development Environment (IDE) that runs on your selected OS on VM. Keep in mind that more help may be available to you in some languages than in others. Furthermore, available controls, etc. may make some of these tasks easier in one language than in another. Problem Statement: Implement a Portable File System (PFS) with Contiguous Allocation Method, which can perform “Allocate a file”, and “Move files from the Windows file system into your file.” You should have your own directory structure, allocation table, etc. inside your file. Move files back out of your file to the Windows file system or Linux/Unix file system. When your program is running it should somehow accept the following commands: open PFSfile Allocate a new 10 KByte “PFS” file if it does not already exist. If it does exist, begin using it for further commands. put myfile Copy the Windows (or Unix/Linux) file “myfile” into your PFS file. get myfile Extract file “myfile” from your PFS file and copy it to the current Windows (or Unix/Linux) directory. rm myfile Delete “myfile” from your PFS file. dir List the files in your PFS file. putr myfile “Remarks” Append remarks to the directory entry for myfile in your PFS file. kill PFSfile Delete the PFSfile from the Windows file system.

quit Exit PFS. You can provide those commands through command line interface ONLY (No GUI will be accepted). Limits:

1. PFS is NOT a memory based file system, but based on the existing file system on your OS, such as Windows or Linux/Unix.

2. Command-Line Interface (CLI) Only, i.e., cmd.exe (in Windows) or shell interface (in Unix/Linux). When PFS is executed, it will show the prompt as: C:\> pfs.exe PFS> open pfs

3. Filenames are a maximum of 20 bytes. And, file extension is optional like Unix/Linux.

4. The directory need handle only Name, Size, Time and Date. For example, PFS> dir Test1.txt 128 bytes 12:30 PM September 2 Test2.txt 512 bytes 11:00 AM November 11 Lee.exe 1k bytes 08:52 PM September 1 . . .

5. If the original PFS file fills up then you should create a new PFS “volume” with the same name but a different suffix – e.g., pfs.1, pfs.2, etc., each the same size as the first “volume”.

6. Your file system should use Contiguous Allocation for an allocation scheme where “disk block” size is 256 bytes.

7. In your files system, each file has one File Control Block (FCB) that includes file name, file size, create time, create date, starting block ID, ending block ID and more (if needed).

8. Your file system should consist of two main parts, i) Directory Structure and ii) Data Blocks. Therefore, you need to define the directory data structure that includes File Control Block (FCB) for each file.

9. In addition, your files system should be able to manage free blocks. You can use any techniques that you learned in the classroom, such as bit map (vector) or linked free space management. Free block management should be part of directory structure.

10. You should handle unusual conditions such as trying to put a file into the PFS when a file with that name is already there, file too large to fit into one “volume”, etc.

If you need to make assumptions, do so. Make a “reasonable” choice & include it in the write-up. Reasonable means that you can explain the logic behind your choice. These problems change each semester and it is difficult to imagine every question that might come up. When in doubt, ask to Professor Lee or the GA. Write-up You should submit a write-up as well as your program. Your write-up should include any known bugs, limitations, and assumptions in your program. This write-up should be in text-format and titled as ‘README’. It should be submitted along with your code. GA will use the ‘README’ file to compile (or install) and run your program. If the GA has trouble with your program then he will contact you to makeup it. Submission You will submit your program using Canvas Assignment (https://bridgeport.instructure.com/login ). If you have any trouble to use Canvas, you can contact GA or instructor. You should zip your source files and write-up (README) into a single file and submit it. Be sure that you include everything necessary to unzip this file on another machine and compile and run it. This might includes forms, modules, classes, configuration file, etc. DO NOT include the executable file itself, we will recompile it. The name of your submitted zip file should be your “UB account”_”ID”_”Project2”. For example, “jelee_000000_Project2.zip”. Make sure your name and UB ID are listed in both your write-up and source code. You may resubmit your program at any time. However, please do not ask the GA to grade your program and then resubmit it. The submission time of the latest submission will be used for determining whether the assignment is on time or not. Late submissions will be accepted at a penalty of 10 points per day. In other words, it may pay you to do this project early on the off chance that something prohibits your submitting it in a timely way. If your program is not working by the deadline, submit it anyway and review it together with GA for partial credit. Do not take a zero on any lab just because the program isn’t working yet. If you have trouble getting started, ask the professor or the GA. Grading points element

10 Defined Data Structure for FCB, Directory, File Block

https://bridgeport.instructure.com/login

(should be presented during a presentation and writing-up) 10 Allocate new PFS file 10 Copy file into PFS 10 Extract file from PFS 10 Handle second PFS Extent when full 10 Kill PFS file 10 Delete file from PFS 10 Add remarks to a file 10 DIRectory listing 05 Writeup 05 Comments in code Extra credit (maximum 15) Encrypt the PFS Associate a program with a PFS file & launch it putc myfile runcommand Associate a program to be run against this file. run myfile Extract “myfile” from the PFS and run it with the associated command.

To receive full credit for comments in the code you should have headers at the start of every module, subroutine, or function explaining the inputs, outputs and function of the module. You should have a comment on every data item explaining what it is about. (Almost) every line of code should have a comment explaining what is going on. A comment such as /* add 1 to counter */ will not be sufficient. The comment should explain what is being counted.