Threads: Architecture of multi threaded web server

Thread: A thread is like a process in a process. Threads are used for making the programming simple. Threads run in parallel and share the same address space. Also, a thread is easy to create and destroy as compared to a process. By using thread, speed of processing an application can be increased. Threads are usually used for systems that have many CPUs. Between threads, address space, global variables, open files, child processes, alarms, signals, signal handlers and accounting information is shared. Program counter, registers, stack, and state remain private to each thread.

Architecture of multi threaded web server: The concept of threads is widely used in a multi threaded web server. Pages in the web server which are used over and over again are put in a cache, so that they can be retrieved swiftly. In a multi threaded web server, incoming requests are read by a dispatcher thread. The dispatcher thread then sends the request to a blocked worker thread. Worker thread comes in a ready state and checks if request can be fulfilled by cache. If the request can’t be handled by cache, then, it is sent to disk.

Architecture of multi threaded web server

Leave a Reply