Giter Club home page Giter Club logo

filesystem's Introduction

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... :)

filesystem's People

Contributors

tsili123 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.