Skip to content

Concurrent Trie Data Structure using Single Locking, Reader Writer's Locking and Hand over Hand Locking.

Notifications You must be signed in to change notification settings

antimattercorrade/Concurrent_Trie

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Concurrent Trie Data Structure ⭐

Implementation of Concurrent Trie Data Structure using Single Locking, Reader Writer's Locking and Hand over Hand Locking.

Directory Structure πŸ“

concurrent_trie
β”œβ”€ concurrent_threads
β”‚  β”œβ”€ 50-50.png
β”‚  β”œβ”€ 50-50_final.png
β”‚  β”œβ”€ CSV
β”‚  β”‚  β”œβ”€ hoh_lock.csv
β”‚  β”‚  β”œβ”€ rw_lock.csv
β”‚  β”‚  └─ s_lock.csv
β”‚  β”œβ”€ data
β”‚  β”‚  β”œβ”€ find
β”‚  β”‚  β”‚  └─ work.txt
β”‚  β”‚  β”œβ”€ initial
β”‚  β”‚  β”‚  └─ work.txt
β”‚  β”‚  β”œβ”€ pref
β”‚  β”‚  β”‚  └─ work.txt
β”‚  β”‚  └─ rem
β”‚  β”‚     └─ work.txt
β”‚  β”œβ”€ generate.h
β”‚  β”œβ”€ hoh_lock_trie.c
β”‚  β”œβ”€ Makefile
β”‚  β”œβ”€ plot.py
β”‚  β”œβ”€ Read_Intensive.png
β”‚  β”œβ”€ Read_Intensive_final.png
β”‚  β”œβ”€ rw_lock_trie.c
β”‚  β”œβ”€ s_lock_trie.c
β”‚  β”œβ”€ workload.py
β”‚  β”œβ”€ Write_Intensive.png
β”‚  └─ Write_Intensive_final.png
β”œβ”€ Makefile
β”œβ”€ README.md
β”œβ”€ tests
β”‚  β”œβ”€ multi_thread
β”‚  β”‚  β”œβ”€ find
β”‚  β”‚  β”‚  β”œβ”€ 1.txt
β”‚  β”‚  β”‚  β”œβ”€ 2.txt
β”‚  β”‚  β”‚  β”œβ”€ 3.txt
β”‚  β”‚  β”‚  β”œβ”€ exp_find_1.txt
β”‚  β”‚  β”‚  β”œβ”€ exp_find_2.txt
β”‚  β”‚  β”‚  └─ exp_find_3.txt
β”‚  β”‚  β”œβ”€ initial
β”‚  β”‚  β”‚  β”œβ”€ 1.txt
β”‚  β”‚  β”‚  β”œβ”€ 2.txt
β”‚  β”‚  β”‚  β”œβ”€ 3.txt
β”‚  β”‚  β”‚  └─ exp_ins.txt
β”‚  β”‚  β”œβ”€ pref
β”‚  β”‚  β”‚  β”œβ”€ 1.txt
β”‚  β”‚  β”‚  β”œβ”€ 2.txt
β”‚  β”‚  β”‚  β”œβ”€ 3.txt
β”‚  β”‚  β”‚  β”œβ”€ exp_1.txt
β”‚  β”‚  β”‚  β”œβ”€ exp_2.txt
β”‚  β”‚  β”‚  └─ exp_3.txt
β”‚  β”‚  └─ rem
β”‚  β”‚     β”œβ”€ 1.txt
β”‚  β”‚     β”œβ”€ 2.txt
β”‚  β”‚     β”œβ”€ 3.txt
β”‚  β”‚     └─ exp.txt
β”‚  └─ single_thread
β”‚     β”œβ”€ exp_ins.txt
β”‚     β”œβ”€ exp_rem.txt
β”‚     β”œβ”€ find_test.txt
β”‚     β”œβ”€ find_test_exp.txt
β”‚     β”œβ”€ initial.txt
β”‚     β”œβ”€ pref_text.txt
β”‚     β”œβ”€ pref_text_exp.txt
β”‚     └─ rem_list.txt
β”œβ”€ trie.c
β”œβ”€ trie.h
└─ trie_size
   β”œβ”€ 50-50.png
   β”œβ”€ 50-50_final.png
   β”œβ”€ CSV
   β”‚  β”œβ”€ hoh_lock.csv
   β”‚  β”œβ”€ rw_lock.csv
   β”‚  └─ s_lock.csv
   β”œβ”€ data
   β”‚  β”œβ”€ find
   β”‚  β”‚  └─ 1.txt
   β”‚  β”œβ”€ initial
   β”‚  β”‚  └─ 1.txt
   β”‚  β”œβ”€ pref
   β”‚  β”‚  └─ 1.txt
   β”‚  └─ rem
   β”‚     └─ 1.txt
   β”œβ”€ generate.h
   β”œβ”€ hoh_lock_trie.c
   β”œβ”€ Makefile
   β”œβ”€ plot.py
   β”œβ”€ Read_Intensive.png
   β”œβ”€ Read_Intensive_final.png
   β”œβ”€ rw_lock_trie.c
   β”œβ”€ s_lock_trie.c
   β”œβ”€ workload.py
   β”œβ”€ Write_Intensive.png
   └─ Write_Intensive_final.png

Feature Checklist βœ…

βœ… Concurreny
βœ… Autocompletion, Insert, Find, Delete Key and Delete Trie
βœ… Single Locking
βœ… Hand Over Hand Locking
βœ… Reader-Writer's Locking 

Instructions to Run πŸƒ

  • Run make to run all the tests. For specific tests, follow the instructions below:

Compiling the test code:

  • Single Threaded: make test_trie_single_threaded
  • Multi Threaded (Single Locking): make test_trie_s_lock
  • Multi Threaded (R/W Lock): make test_trie_rw_lock
  • Multi Threaded (Hand on Hand Lock): make test_trie_hoh_lock

Compiling and running the tests:

  • Single Threaded: make single_threaded
  • Multi Threaded (Single Locking): make s_lock
  • Multi Threaded (R/W Lock): make rw_lock
  • Multi Threaded (Hand on Hand Lock): make hoh_lock

Load Testing 🚦

  • Install numpy using pip install numpy
  • Install scipy using pip install scipy
  • Install matplotlib using pip install matplotlib

Concurrent Threads

In the concurrent_threads folder:

  • Run make workload to generate the workload.
  • Run make to compile and execute the files as well as create the plots.

Trie Size

In the trie_size folder:

  • Run make workload to generate the workload.
  • Run make to compile and execute the files as well as create the plots.

Results and Conclusions πŸ“Š

For plotting insert and find have been used for 50-50 workload, while only insert and find are used in write intensive case and read intensive case respectively.

Concurrent Threads

  • Varying the number of concurrent threads from 1 to 100

  • Workload with 100000 entries per file

  • Plot for 50-50 workload

50-50 Workload 50-50 Workload Averaged
alt text alt text
  • Plot for Read Intensive workload
Read Intensive Workload Read Intensive Workload Averaged
alt text alt text
  • Plot for Write Intensive workload
Write Intensive Workload Write Intensive Workload Averaged
alt text alt text

Trie Size

  • Varying the trie size from 1 to 100

  • Taking 100 concurrent threads

  • Workload with 15000 entries per file

  • Plot for 50-50 workload

50-50 Workload 50-50 Workload Averaged
alt text alt text
  • Plot for Read Intensive workload
Read Intensive Workload Read Intensive Workload Averaged
alt text alt text
  • Plot for Write Intensive workload
Write Intensive Workload Write Intensive Workload Averaged
alt text alt text

About

Concurrent Trie Data Structure using Single Locking, Reader Writer's Locking and Hand over Hand Locking.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published