Giter VIP home page Giter VIP logo

hash_table's Introduction

Hash_Table

The purpose of this project is to implement a simple hash-table using various IPC techniques.

The server process creates/add/delete/update/find and flush the table, and other client processes' hash-table are synchronized with that of server. The approach of table synchronization among server and clients is by using UNIX domain socket and Shared Memory.

  • Unix Domain Socket: server informs clients of specified operation(op-code) via socket.
  • POSIX Shared Memory: server shares the content with clients via shared memory.

picture

The server receives op-code and data via console in form of following format:

< op-code > < data >

op-code: ADD/DELETE/FIND/SHOW/FLUSH

for example, when the server gets ADD benyamin from console, the server parses the input string and figures out that benyamin should be added to the local table. After that, the server should inform connected clients of updating their corresponding table thereby adding new item benyamin. So, the server sends op-code and a key of shared memory region to where it maps benyamin. So, the following format is sent via socket to clients:

< loop > < sync_msg > < key >

loop: An integer which indicate that the server wants to keep its connection with corresponding client or wants to disconnect (1 for keep connection and 0 for disconnection).

sync_msg: ADD/DELETE/FIND/SHOW/FLUSH

key: The key for shared memory region. In this implementation, for simplicity, I just assign data to key. ( key = benyamin, although this is quite insane, but work in progress to improve )

On other side, the client receives a control message from server, parses it and figures out that there is a data in a shared memory region with key value. So, it collects the data and according to parsed control message, it adds the data to its local table.

Note that, only ADD op-code needs shared memory region, because the table is synchronized at the beginning of running the client.

It is also worth mentioning that while the client only prints data just for demonstration purposes, the concept of data synchronization using IPC mechanisms can easily be extended to real-life systems.

Regarding benchmarking, the evaluation process is provided in another branch (benchmarking). The first observation is done with 50 inputs. Raw data is processed via a python script which can be found in statistics/plot.py. The first result is as below. picture

For further evaluation, I provided 100 input data and the result of this is as below:

picture

According to above plot, the diagram is quite similar to the first one. I personally assume that if I choose the number of input data close to infinity (very very big), the output diagram will look like right skewed Gaussian Distribution (just like below diagram).

picture

hash_table's People

Contributors

beneslami avatar

Watchers

 avatar  avatar

hash_table's Issues

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.