I am making a simple program which suppose to accept txt file data from clients. (not very big files..)
I was wondering, if it is okay to create the threads using pthread instead of creating another process using fork.
My plan is to create threads for every connection that I get to process the data and store it in a shared queue, which I can use mutex or semaphore to protect any race condition.
Yes, it is perfectly fine to use separate threads to process client connections. It will be faster compared to forking new processes. There is a drawback though in terms of isolation: because all clients are handled within the same process if this process goes down the server will not be able to serve other clients.