This is an implementation of a concurrent key-value (KV) store using a client-server architecture. Both client and server are multi-threaded processes that communicate through a shared memory region. The system uses a ring buffer for inter-process communication and a thread-safe hash table to store key-value pairs.
- Thread-safe circular buffer for request submission and retrieval
- Supports concurrent access from multiple client and server threads
- Implements blocking behavior when full (client) or empty (server)
- Hash table implementation with fine-grained locking for concurrent access
- Supports
put(key, value)to insert or update values - Supports
get(key)to retrieve values
- Shared memory region for tracking request status
- Allows clients to check completion status and retrieve responses
To build the project:
make
To run the server:
./server -n <num_threads> -s <init_table_size>
Where:
-nspecifies the number of server threads-sspecifies the initial hash table size
To run the client:
./client -n <num_threads> -w <window_size> [-f] [-i workload_file]
Where:
-nspecifies the number of client threads-wspecifies the window size per client thread-fforks the server process automatically-ispecifies the input workload file
- Used fine-grained locking in the hash table to allow multiple threads to access different buckets concurrently
- Implemented efficient synchronization in the ring buffer to minimize contention
- Organized shared memory to support multiple client threads with dedicated status windows
- Multiple server threads can process requests concurrently to improve throughput
- Window size controls the maximum number of in-flight requests per client thread
- Thread-safe data structures are optimized to minimize lock contention
