magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2001 > 08 > At Your Server  

The Threadmaster

By Jim Jagielski

After several years of design and development, Apache 2.0 is ready for prime time. The most visible—and perhaps most awaited—change is native support for Unix threads. The proper use of threads can greatly improve the performance of most applications, so it's not surprising that threads generate a lot of discussion in development circles.

The Windows port of Apache 1.3 is, in fact, threaded. But most people use Apache with Unix-based systems, so the thread support in Apache 2.0 is a big step forward. At their most basic, threads are lightweight processes. In Unix, each application runs as a separate process. The operating system starts a new process whenever a user launches a new application. In many cases, the application itself can "fork" a new process to complete some tasks. But forking new processes is expensive: Creating them costs an appreciable amount of server memory and time. If your server is creating a lot of processes, the end result will be very slow response times to requests and actions.

Threads were designed to avoid this bottleneck. Using threads drains fewer server resources than forking a new process. One process can create many threads, all sharing the same memory space. This, too, saves time. For these reasons, it's preferable to use threads when an application needs to perform several tasks, each with the same priority.

Caveats

Threads are great, but it was obvious early in the Apache 2.0 design cycle that restricting all operations to threads was shortsighted.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2