This project implements a multi-threaded proxy server using semaphores for concurrency control. It handles multiple client requests, caching using the LRU algorithm, and demonstrates proxy functionalities.
- Threading: Manages multiple client requests.
- Semaphore: Used instead of condition variables and
pthread_join()
/pthread_exit()
. Semaphores'sem_wait()
andsem_post()
do not need parameters, making them a better option. - Cache: Speeds up processing (LRU algorithm).
- Separate cache entries for URLs with multiple clients.
- Fixed cache element size.
- Multiprocessing for better performance.
- Selective website access control.
- Support for POST requests.
-
Clone the repository:
-
Navigate to the project directory:
-
Build the project:
make all
-
Run the proxy server:
./proxy <port no.>
-
Open in browser:
http://localhost:<port>/any link u want to test (eg--www.google.com)
- Linux only. Disable browser cache.
- For no-cache version, rename
proxy_server_with_cache.c
toproxy_server_without_cache.c
in the MakeFile.