you are viewing a single comment's thread.

view the rest of the comments →

[–]humancorpse[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (2 children)

most web servers, upon receiving an incoming socket connection and after having accepted it, most programs will perform a "fork" which will create a separate thread that will process that page and then the primary program will resume waiting for and accepting new http connection requests..

instead of my program "forking" to create threads to receive an incoming http request headers and then responding by sending back a response that consists of html and javascript, nope, i dont wanna use threads.. i will have my software operate as a "state machine", whereby i will cycle thru all actively being processed pages AND wait for and accept new connections.

obviously my program will be operating in a "non-blocking" mode.

pseudo code:

for(socket=0;socket<MAXSOCKETS;socket++)
{
wait_for_incoming_request();

read_incoming_header();

generate_dynamic_page();
}//for loop

[–]thefirststone 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (1 child)

That's just called asyncronous event handling. It can scale very well. Not all servers are multithreaded, especially on platforms or runtimes where threads have large overhead.

[–]humancorpse[S] 1 insightful - 1 fun1 insightful - 0 fun2 insightful - 1 fun -  (0 children)

yeah, i like the state machine..