I am writing a Multi-threaded web server with 1 scheduling thread,1 queuing thread and n execution thread in C++ and it is a homework problem. I am not asking the code. I have created a flow for the server. Can you tell me if the flow is correct or not ?
main() //queuing thread
{
define sockets
create scheduling thread
create queue of n execution threads //n execution threads
accpet connection infinetly
{
insert the request in a queue
}
}
scheduling thread // scheduling thread
{
job = take each request from queue ( FCFS or SJF)
take 1 thread from queue of execution threads and assign the job request
}
Is this flow for the problem correct? I just need the direction.Thanks in advance.
Your pseudo-code looks reasonable to me.