Tuesday, 10 May 2016

Parallel Programming

Introduction To Parallel Programming
Parallel programming is a programming model wherein the execution flow of the application is broken up into pieces that will be done at the same time (concurrently) by multiple cores, processors, or computers for the sake of better performance. Spreading these pieces across them can reduce the overall time needed to complete the work and/or improve the user's experience. However, this is not always the case as there are several pitfalls you need to be aware of and we will certainly discuss them through the series.

Task Class

Task class Represents an asynchronous operation.

A Simple Example is below:

using System.Threading.Tasks;
class Program
    {
    static void Main(string[] args)
        {

            var arrTask = new List<Task>();

            Task taskShowDate = Task.Run(() =>
            {
                ShowDate();
            });
            arrTask.Add(taskShowDate);

            Task taskShowTime = Task.Run(() =>
            {
                ShowTime();
            });
            arrTask.Add(taskShowTime);


            Task.WaitAll(arrTask.ToArray(), 10000000);
            //Parallel.Invoke(ShowDate, ShowTime);
            Console.ReadLine();
        }
        public static void ShowDate()
        {
            Console.WriteLine(DateTime.Now.ToLongDateString());
        }

        public static void ShowTime()
        {
            Console.WriteLine(DateTime.Now.ToLocalTime());
        }
      }

here is another important link Introducing-task-programming

2 comments:

  1. These provided information was really so nice,thanks for giving that post and the more skills to develop after refer that post. Your articles really impressed for me,because of all information so nice.

    SAP training in Chennai

    ReplyDelete

  2. Great Article I love to read your articles because your writing style is too good, its is very very helpful for all of us and I never get bored while reading your article because it becomes more and more interesting from the starting lines until the end. So Thank you for sharing a COOL Meaningful stuff with us Keep it up..!

    SAP training in Chennai

    ReplyDelete

Topics

ADO .Net (2) Ajax (1) Angular Js (17) Angular2 (24) ASP .Net (14) Azure (1) Breeze.js (1) C# (49) CloudComputing (1) CMS (1) CSS (2) Design_Pattern (3) DI (3) Dotnet (21) Entity Framework (3) ExpressJS (4) Html (3) IIS (1) Javascript (6) Jquery (9) Lamda (3) Linq (11) Mongodb (1) MVC (48) NodeJS (7) RDLC (1) Report (1) Sql Server (29) SSIS (3) SSRS (2) UI (1) WCF (12) Web Api (10) Web Service (1) XMl (1)