Skip to content

Assignment for the course Implementation and Design of Databases

Notifications You must be signed in to change notification settings

Tsili123/FileSystem

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 

Repository files navigation

FileSystem

Assignment for the course Implementation and Design of Databases

1st assignment

My task was to implement a HeapFile and HashFile in order to store records.For the first one, I filled each one block of memory with records using InsertEntry .At the start of the block I store a counter for my records at the specific block .Same work for GetAllEntries ,where I traverse each block of memory record by record.For the function DeleteEntry ,I created an offset number , so as to reduce the block counter properly when a whole block is empty.My concept for the delete function was to find and erase the record from the block .Then I replace that empty place with the last record ,that is stored at the last block.In that way ,I use my memory effiecienty,beacuse there are no holes at my file system.

The hash functions manipulates memory in a little bit different way.In the hashfile ,block zero was purposed for storing metadata.I just added another integer variable at the end of every block.If one block is not yet filled, that integer stays zero.But when it is filled with records, I allocate another block and I store the current block counter value at that integer in InsertEntry.Also when we have one bucket overflowed, that one is extended with another block , so at to store more records.The difference from the previous implementation is that now we have grouped blocks by bucket.Depending on the hash of its record, it is getting inserted at the proper bucket .If the bucket is overflowed, we traverse the blocks of the bucket , to place the record at the correct position.Same situation for theGetallEntries ,where we traverse every bucket accordingly.The DeleteEntry here works fine .The record gets deleted but the memory isn't used efficiently.(I don't fill the deleted space with another record).

Finally , I created a function HashStatistics to get statistics from the whole procedure.It concerns the follow:(Only for HashFile)

  1. the number of blocks in current file
  2. the minimum and the maximum number of records that a bucket has
  3. the mean number of records in buckets
  4. the mean number of blocks that a bucket has
  5. the number of buckets that have overflowed blocks.

Run

Just type make in the main directory of each assignment, because makefile is included .Then ./my_hp and ./my_ht respectively

2nd assignment

Typing... :)

About

Assignment for the course Implementation and Design of Databases

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published