Quote:
I want from my friend help me to do this program.
|
That'll not be me then...
This question does sound like homework, so you'll get the kind of answer that you'd get if it was a homework question. You may well think that unfair.
You do not ask about anything
practical. I can see no way you would use this system for anything as it is too trivial/underspecified for most practical purposes.
Quote:
writting a file system for a virtual disk that this disk has 128 blocks each 1 KB.
this file system supports 16 files/diretory that each file/directory has 8 blocks.the name of file is consist of at most 8 charachter.
|
There are many ways of starting; I would start by trying to map out the blocks. In some way, you will have to be able to think about a mapping between blocks and data structures. You would then have to work out what you would have to do to which block in order for certain operations to take place.
You mention the files having names; in some way, there must be a mapping between file names and the blocks in use on the disk. You mention 'characters'; think about what that means. ASCII characters? Unicode characters? Does this make a difference?
There will be a data structure for the filenames, and you will have to think about the operations that can occur on that data structure.
You mention writing; that's nice, but without the ability to read, it is unclear that this system can have any purpose, apart from for training (and if you don't go on to work out how to read, it might not even be particularly good for training, but I do not know where you are in your studies...but maybe your instructor has that planned as your next exercise).
The interested reader may have already though about write-only memory.
Once you have worked out how the data structures work, you can think about what is necesssary to write a new file; you would have to have a utility to which you can supply a filename and it would react by writing the header to disk and may reserve some space.
In the case of files which will use multiple blocks of data, how will that work? It looks as if you could assume that every file was of the same length, irrespective of the amount of actual data in it, although this would be horribly inefficient in real life.
If that is true, at least you don't have to deal with the problem of extending the file.
There is a case, and I'll not put it stronger than that, that you should regard these various operations on the file as 'use cases' and you should look at all of the applicable use cases.
It is also unclear to me why you should be unaware of any of the above, if your instructor has prepared you for this little problem adequately. You may want to comment on that.