Suppose we want to program a Web server; we could easily do so without using concurrency, as follows:
while(true)wait connectionread from socket and parse urllook up url contents in cacheif (!in cache)fetch from diskput in cachesend data to client
How do we make this codework for lots and lots of clients? Since there are a lot of slowoperations being performed (e.g. connecting to the networking, accessing the disk, etc), processing only one client at a time clearly is not scalable. Our goal then is to build a concurrent application that both minimizes latency and maximizes parallelism.