Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Programming Language Expert

add details to the design of a file system and implement it in detail. The file system uses a variant of the scheme used by UNIX in that it allows for a hierarchical file directory and uses pointers to individual blocks of data. The disk used has 100 blocks or sectors from 0-99, each contains 512 bytes of data. You don't need to worry about the placement of the blocks on the disk, so all access to the disk should be done through 2 procedures (need it written) DREAD and DWRITE. You don't have to do disk reads and writes, the entire disk can be simulated using a 50K block of memory.

The file system will be tested using a front end program that processes commands given as input data. These commands will exercise the file create, open, close, delete, read, write, and seek functions of the file system.

When the end of the input data is reached, the following information will be displayed: the directory illustrating its hierarchical structure, the length in bytes, and the number of free, directory, and user data blocks.

The file directory in this system will be hierarchically ordered, the root directory always begins in block 0 which has the following structure:

DECLARE 1 BLOCK0,

2 BACK FIXED BIN(31), /* ALWAYS ZERO IN THIS BLOCK */

2 FRWD FIXED BIN(31), /* BLOCK NUMBER OF SECOND DIRECTORY BLOCK, OR ZERO */

2 FREE FIXED BIN(31), /* BLOCK NUMBER OF FIRST UNUSED BLOCK */

2 FILLER CHARACTER(4), /* UNUSED */

2 DIR(31), /* DIRECTORY ENTRIES */

3 TYPE CHARACTER(1), /* 'F' = FREE, 'D' = DIRECTORY, 'U' = USER DATA */

3 NAME CHARACTER(9), /* FILE NAME, LEFT-JUSTIFIED, BLANK FILLED */

3 LINK FIXED BIN(31), /* BLOCK NUMBER OF FIRST BLOCK OF FILE */

3 SIZE FIXED BIN(15); /* NUMBER OF BYTES USED IN THE LAST BLOCK OF THE FILE */

 

The remaining blocks in the root file directory, if any, will be linked to blcok zero using the FRWD entry. These blocks, and blocks in the subordinate directories will have exactly the same structure as block zero, except that the FREE entry will be unused. This entry in block zero is used to point to the first unused block on the disk. The unused blocks should form a linked list which must be initially created when the file system starts execution.

 

The TYPE entry of each directory entry determines what type of file is referenced. 'F' is used to indicate that an entry in the file directory is unused. 'D' indicates that the entry points to another (subordinate) directory, while 'U' indicates that the entry points to a user data file. File names are given as strings of up to 9 alphabetic characters separated by virgules, or slashes.

 

The first file name would be located in the root directory as a user data file. The second file name would be found first in the root directory as a subordinate directory called SUB, then in the SUB directory as a user data file called SAMPLE. The third file name would involve two subordinate file directories, the first called SUB1 located in the root directory, the second called SUB2 located in the SUB1 directory, and the last called SAMPLE located in the SUB2 directory as a user data file. Each block in a data file, except the last, is considered full. The number of data bytes present in the last block of a data file is indicated by the SIZE field of the directory entry. Note that the directory blocks always have exactly 31 entries, with unused entries marked by a type field of 'F'.

 

Data files also form linked lists. The structure of a data file block is:

 

DECLARE 1 DATA_BLOCK,

2 BACK FIXED BIN(31), /* BLOCK NUMBER OF PREVIOUS BLOCK */

2 FRWD FIXED BIN(31), /* BLOCK NUMBER OF SUCCESSOR BLOCK */

2 USER_DATA CHAR(504) /* USER DATA BYTES */

 

The first and last data blocks of a file will have the BACK and FRWD fields respectively, set to zero. These will not point to block zero, since that is always the first directory block, but will rather indicate the end of the linked data block list. The maximum number of bytes in a data block is 504.

 

Each command that may be processed by the file system is matched by an input command line. The syntax of these command lines, and the processing to be performed is:

 

CREATE type name

 

"type" is either U or D, and indicates whether a User data file or a Directory file is to be created. "name" is a full file name in the form described above. Neither of these items is enclosed in quotes. The CREATE command should cause a new directory entry to be created for the type of file specified. If CREATE is given for an existing file, no error should occur, but the file should be deleted and then reCREATEd. CREATE also leaves the file in the same state as an OPEN in the output mode.

 

OPEN mode name

 

"mode" is either I, O, or U indicating the file named "name" is to be opened in the Input, Output, or Update mode. Input mode means that only READ and SEEK commands are permitted while Output mode means only WRITE commands are permitted. Update mode allows READ, WRITE, and SEEK commands. Associated with each open file is a pointer to the next byte to be read or written. Opening a file for input or update places the pointer at the first byte of the file, while opening a file for output places the pointer at the byte immediately after the last byte of the file.

 

CLOSE

 

command causes the last OPENed or CREATEd file to be closed.. No filename is given.

 

DELETE name

 

This command deletes the named file.

 

READ

 

This command may only be used between an OPEN (in input or update mode) and the corresponding CLOSE. If possible, "n" bytes of datea should be read and displayed. If fewer than "n" bytes remain before the end of the file, then those bytes should be read and displayed with a message indicating that the end of file was reached.

 

WRITE n 'data'

 

This command causes the first "n" data bytes from 'data' (actually enclosed in single quotes in the command line) to be written to the file. If fewer than "n" bytes are given, then append sufficient blanks to 'data' to make "n" bytes. If it is impossible to write "n" bytes (because the disk is full) then an appropriate message should be issued, but the command should be otherwise treated as if the largest possible value of "n" was specified. (That is, the remaining available disk space should be filled.)

 

SEEK base offset

 

"base" is either -1, 0, or +1 indicating the beginning of the file, the current position in the file, or the end of the file. "offset" is a signed integer indicating the number of bytes from the "base" that the file pointer should be moved. For example, "SEEK -1 0" is a rewind, "SEEK +1 0" is equivalent to a position to end of file, and "SEEK 0 -5" positions the file pointer backward by five bytes.

 

 

Programming Language, Programming

  • Category:- Programming Language
  • Reference No.:- M9455231

Have any Question?


Related Questions in Programming Language

Task working with arraysoverviewin this task you will

Task: Working with Arrays Overview In this task you will create a simple program which will create and work with an array of strings. This array will then be populated with values, printed out to the console, and then, w ...

Overviewthis tasks provides you an opportunity to get

Overview This tasks provides you an opportunity to get feedback on your Learning Summary Report. The Learning Summary Report outlines how the work you have completed demonstrates that you have met all of the unit's learn ...

Assignment - haskell program for regular expression

Assignment - Haskell Program for Regular Expression Matching Your assignment is to modify the slowgrep.hs Haskell program presented in class and the online notes, according to the instructions below. You may carry out th ...

Extend the adworks applicationi add dialogs to allow the

Extend the AdWorks application I. Add Dialogs to allow the user to Add, Edit, Read and Delete a Customer and refresh the view accordingly. 1. The user should be able to select a specific customer from the DataGrid and cl ...

Task - hand execution of arraysoverviewin this task you

Task - Hand Execution of Arrays Overview In this task you will demonstrate how arrays work by hand executing a number of small code snippets. Instructions Watch the Hand Execution with Arrays video, this shows how to ste ...

Php amp session managment assignment -this assignment looks

PHP & SESSION MANAGMENT ASSIGNMENT - This assignment looks at using PHP for creating cookies and session management. Class Exercise - Web Project: Member Registration/Login This exercise will cover adding data connectivi ...

Assignment task -q1 a the fibonacci numbers are the numbers

Assignment Task - Q1. (a) The Fibonacci numbers are the numbers in the following integer sequence, called the Fibonacci sequence, and are characterised by the fact that every number after the first two is the sum of the ...

Task silly name testeroverviewcontrol flow allows us to

Task: Silly Name Tester Overview Control flow allows us to alter the order in which our programs execute. Building on our knowledge of variables, we can now use control flow to create programs that perform more than just ...

Question 1 what is hadoop explaining hadoop 2 what is

Question: 1. What is Hadoop (Explaining Hadoop) ? 2. What is HDFS? 3. What is YARN (Yet Another Resource Negotiator)? The response must be typed, single spaced, must be in times new roman font (size 12) and must follow t ...

Structs and enumsoverviewin this task you will create a

Structs and Enums Overview In this task you will create a knight database to help Camelot keep track of all of their knights. Instructions Lets get started. 1. What the topic 5 videos, these will guide you through buildi ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As