C# Task thread pool - Running 100 tasks across only 10 threads
<p>I'm just wondering if someone can point me in the right direction about the async/await framework and thread pools?</p>

<p>Basically, what I'm trying to do is have x number of operations executed in a separate thread/async, but across a maximum of y threads. </p>

<p>For example, let's say that I have 100 database operations: 
<code>await _repository.WriteData(someData);</code></p>

<p>What I'd like to do is have some method of running 10 of those operations at a time (ideally in a separate thread each, so 10 threads), and as each one is finished, the next is kicked off on the thread that then becomes available. We then wait for all operations to complete and all threads to finish... </p>

<p>Is this something that is readily achievable without too much effort or adding huge amounts of complexity?</p>