I am having a Windows Service that needs to pick the jobs from database and needs to process it.

Here, each job is a scanning process that would take approx 10 mins to complete.

I am very new to Task Parallel Library. I have implemented in the following way as sample logic:

```
Queue queue = new Queue();

for (int i = 0; i < 10000; i++)
{
    queue.Enqueue(i);
}

for (int i = 0; i < 100; i++)
{
    Task.Factory.StartNew((Object data ) =>
    {
        var Objdata = (Queue)data;
        Console.WriteLine(Objdata.Dequeue());
        Console.WriteLine(
            "The current thread is " + Thread.CurrentThread.ManagedThreadId);
    }, queue, TaskCreationOptions.LongRunning);
}

Console.ReadLine();

```

But, this is creating lot of threads. *Since loop is repeating 100 times, it is creating 100 threads.*

**Is it right approach to create that many number of parallel threads ?**

**Is there any way to limit the number of threads to 10 (concurrency level)?**