[RESOLVED]parallel code execution

Is it possible to separate code in two parallel tasks, one that needs to be executed to maintain the workflow for the user, and one that can run in the background while the user is still doing something unrelated to the second task?

In my application the second task could be running on the server.

Hi,

According to your description above, you want to use parallel in asp.net. I read relevant articles about using Parallel in ASP.NET apps,

In most cases, and in particular for Web applications with heavy usage, it is probably not necessary to introduce extra parallelism since adding more work items will only result in competition for CPU time and ultimately reduce request throughput.

Web applications that need to perform expensive computations may still benefit from parallelism if the latency of an individual request is more important than overall request throughput. See: http://blogs.msdn.com/b/pfxteam/archive/2010/02/08/9960003.aspx

Best regards,

Angie

Thanks.

You might find that it would be reasonably easy to do this with SignalR

Just to answer the possibility, that is called Threading in .NET Framework. You can use multiple threads in your application, each thread working out for each process. 

However, as already said. This would just slow down the processes so it is not a good way of doing this. But still there are options to put the thread to sleep and more. You can read those from the MSDN document and see whether they fit your purpose or not. 

http://msdn.microsoft.com/en-us/library/system.threading.thread(v=vs.110).aspx

Leave a Reply