Concurrency in IO-Intensive Apps
An IO-intensive application has a large blocking coefficient and will benefit from more threads than the number of available cores.
Let’s build the financial application I mentioned earlier. The (rich) users of the application want to determine the total net asset value of their shares at any given time. Let’s work with one user who has shares in forty stocks. We are given the ticker symbols and the number of shares for each stock. From the Web, we need to fetch the price of each share for each symbol. Let’s take a look at writing the code for calculating the net asset value.
Sequential Computation of Net Asset Value
As the first order of business, we need the price for ticker symbols. Thankfully, Yahoo provides ...