Get Instant Help From 5000+ Experts For
question

Writing: Get your essay and assignment written from scratch by PhD expert

Rewriting: Paraphrase or rewrite your friend's essay with similar meaning at reduced cost

Editing:Proofread your work by experts and improve grade at Lowest cost

And Improve Your Grades
myassignmenthelp.com
loader
Phone no. Missing!

Enter phone no. to receive critical updates and urgent messages !

Attach file

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Guaranteed Higher Grade!
Free Quote
wave
Operating System Concepts: Simple File System Assignment

Goal of the Programming Assignment

1. The goal of this programming assignment.

This lab aims to enhance your understanding of a file system based on the topics discussed in class.

2. Lab Assignment Description.

a. Architecture of your file system:

You will create a Unix-like simple file system as follows:
• The file system resides on a disk that is 128KByes in size.
• There is only one root directory. No subdirectories are allowed.
• The file system supports a maximum of 16 files.
• The maximum size of a file is 8 blocks; each block is 1KBytes in size.
• Each file has a unique name, and the file name can be no longer than 15
characters (plus a null byte).

The layout of your 128 Kbytes disk is as follows:

*The first 1KB block is called the superblock. It stores the free block list and index nodes (inode) for each file.

* The remaining 127 1KB blocks store data blocks of the files on your file system. The exact structure of the superblock is as follows.

* The first 128 bytes store the free block list. Each entry in this list indicates whether the corresponding block is free or in use (if the i-th byte is 0, it indicates that the block is free, else it is in use). Initially, all blocks except the superblock are free

*Immediately following the free block list are the 16 index nodes (inode), one for each file that is allowed in the file system. Initially, all inodes are free.

Each inode stores the following information:

struct inode {
char name[16];                 //file name
int size;                           // file size (in number of blocks)
int blockPointers[8];      // direct block pointers
int used;                       // 0 => inode is free; 1 => in use
}

b.What to implement

Please implement the following operations for your file system:

*create(char name[16], int size): create a new file with this name and with these many blocks. (We shall assume that the file size is specified at file creation time and the file does not grow or shrink from this point on)
* delete(char name[16]): delete the file with this name
* read(char name[16], int blockNum, char buf[1024]): read the specified block from this file into the specified buffer; blockNum can range from 0 to 7.
* write(char name[16], int blockNum, char buf[1024]): write the data in the buffer to the specified block in this file.
* ls(void): list the names of all files in the file system and their sizes.

Lab Assignment Description

 c.Getting started

We will use a 128KB file to act as the "disk" for your file system. You can download an executable image, “make-disk,” from the class Canvas and run it from your directory. Note – “make-disk” will run only in the ‘csegrid”.

For example:

./make-disk mydisk0

This will create a file with the name mydisk0 in your current directory.

* The program also "formats" your file system --- this is done by initializing all blocks in the superblock to be free and marking all 16 inodes to be free.

* Remember that your file system must be persistent. If you shut down your program and then restart it at a later time, all files on your file system must be untouched.

d.Hints

(1). How do I write to a specific location on the disk?

• You will need to be completely familiar with using lseek() in order to read and write to specific locations in the disk file. I strongly recommend that you read up on this before starting on this assignment. In particular, you'll need to understand how to use the seek method to move the file pointer to a specific location in the file, and then you can read/write at that location.

• Once you understand how the seek works, you need to compute the byte offset of the object you are trying to access and seek to that location before reading or writing. Remember to count from 0!

(2). Do I need to touch anything other than the superblock?

• Most file operations will only touch the superblock (the free block list and the inode). However, the read and write calls need you to actually read and write data from the specified block on the disk.

(3). What do I have to write on a disk block?

• In the case of write, you can use a dummy buffer (e.g., with all 1s) to write to disk. Remember, what you write out is what should get read in if you use "read" later.

(4). Size of file

• Our file system can support a maximum file size of 8 blocks (8KB). That does not mean that every file will be 8KB in size. In most cases, files will be smaller than the max file size. Each "create" request should check whether the disk has sufficient space for the file and, if not, return a "not enough space on disk" error message.

(5). Testing

• Your main program will interpret a given test script file as shown in the sample input file, execute each command in the given test script file, and print out the execution result of each command.

(6). Programming Requirements

(1) Programming language: You have to use either C or C++ to develop your simulator on Linux environment
(2) Running Environment: Your program should be compiled at the csegrid server and be able to be tested without errors.

(7). Deliverables

(1) Program source codes include all source program files, makefile, and Readme.
(2) Sample test output in either PDF or screen dump image.

support
Whatsapp
callback
sales
sales chat
Whatsapp
callback
sales chat
close