Pipeline.NET – Limited concurrency Task Scheduler (Miscellaneous) | CodeCanyon

Download Pipeline.NET – Limited concurrency Task Scheduler (Miscellaneous) | CodeCanyon From Ariyan.org

The Pipeline.NET component provides you with a simple but powerful and robust way of funnelling tasks through a fixed number of pipelines (threads) in your .NET applications. Funnelling means to executing N1 number of tasks on N2 number of threads. Tasks will queue until a pipeline is available and then the scheduler will determine which the next task to execute is.

Simply running 100 tasks on 6 pipelines (threads) is now very simple. All the multi-threading difficulties have been taken out of managing this process and works perfectly with the default settings. There are also various configuration options that can be adjusted to suit most needs.

  1. Number of pipelines to use for executing tasks – Funnel any number of tasks/work into a fixed number of pipelines
  2. Use of ThreadPool or non-ThreadPool threads
  3. Backup auto-wakeup event with configurable executed interval mechanism for waking persistent sleeping tasks (normally not needed, but good to have)
  4. First Come First Serve (FCFS) and Priority (with aging) scheduling

When would I use this?

  • Uploading files via FTP, REST or another API
  • High performance computing with limited number of calculators
  • Sending emails for marketing campaigns
  • Handling UI driven workload
  • Centralized workload manager with multiple client on varying platforms
  • Performing an unknown number of tasks

What are the advantages?

  • Very high performance
  • Simple to use
  • Extendable task scheduling with pre-built FCFS & Priority scheduling
  • Uses logical processor count for number of pipelines unless explicitly configured
  • Documented API
  • Support provided at support.avantprime.com

What do you get in the package?

  • .NET 3.5 Assemblies
  • Debug files (PDB)
  • Xml comments (Intellisense)
  • Usage documentation
  • Documented API
  • Console demo application
  • C# Source Code
  • Visual Studio 2010 SP1 & 2012 Solution

How would I use this component?

Example of how to use the PipelineScheduler with priority scheduling (with aging), boosting priority every 500ms (1/2 second). This demo runs 10 tasks using 6 pipelines (threads) with each task randomly delayed for up to 3000ms (3 seconds).

 using System; using System.Threading; using AvantPrime.Pipeline;  namespace AvantPrime.PipelineNET.ConsoleDemo3 {     class Program     {         private static readonly Random Randomizer;         private static int _activeTasks;          static Program()         {             Randomizer = new Random((int)DateTime.Now.Ticks);         }          static void Main(string[] args)         {             var scheduler = new PipelineScheduler(6, scheduler: new PriorityScheduler(TimeSpan.FromMilliseconds(500)));             const int taskCount = 10;              // Priority scheduling             Console.WriteLine("Running {0} tasks using default settings with priority scheduling.n", taskCount);             for (int i = 0; i < taskCount; i++)             {                 scheduler.Push(new CustomTask(i));             }              Console.WriteLine("Application/Process (main thread) finished. Press any key to exit...n");             Console.ReadKey();         }          private class CustomTask : IPipelineTask         {             private readonly int _id;              public CustomTask(int id)             {                 _id = id;             }              #region Implementation of IPipelineTask              public void Execute()             {                 Interlocked.Increment(ref _activeTasks);                 var delay = Randomizer.Next(3000);                 Console.WriteLine("Starting task {0}, {1} with duration of {2}ms. Thread: {3}. Priority: {4}. Active: {5}.", _id, DateTime.Now.ToString("hh:mm:ss.fff"), delay, Thread.CurrentThread.ManagedThreadId, Priority, _activeTasks);                 Thread.Sleep(delay);                 Console.ForegroundColor = ConsoleColor.Yellow;                 Console.WriteLine("Task {0} finished at {1} with priority {2}.", _id, DateTime.Now.ToString("hh:mm:ss.fff"), Priority);                 Console.ResetColor();                 Interlocked.Decrement(ref _activeTasks);             }              ///              /// Gets or sets the date and time the task was added to the queue.             ///              public DateTime ArrivalTime { get; set; }              ///              /// Gets or sets the scheduling priority of a task.             ///              public TaskPriority Priority { get; set; }              ///              /// Gets or sets the details of the task execution.             ///              public TaskExecutionResult ExecutionResult { get; set; }              ///              /// Gets or sets the original scheduling priority of a task.             ///              public TaskPriority OriginalPriority { get; set; }              ///              /// Gets or sets the last date and time the priority             /// was boosted.             ///              public DateTime PriorityBoostTime { get; set; }              #endregion         }     } } 


 Running 10 tasks using default settings with priority scheduling.  Starting task 2, 01:42:18.193 with duration of 2877ms. Thread: 13. Priority: Normal. Active: 3. Starting task 3, 01:42:18.193 with duration of 1709ms. Thread: 14. Priority: Normal. Active: 3. Starting task 1, 01:42:18.193 with duration of 2183ms. Thread: 12. Priority: Normal. Active: 3. Application/Process (main thread) finished. Press any key to exit...  Starting task 5, 01:42:18.216 with duration of 1924ms. Thread: 16. Priority: Normal. Active: 6. Starting task 0, 01:42:18.216 with duration of 1199ms. Thread: 11. Priority: Normal. Active: 4. Starting task 4, 01:42:18.216 with duration of 2425ms. Thread: 15. Priority: Normal. Active: 6. Task 0 finished at 01:42:19.417 with priority Normal. Starting task 6, 01:42:19.423 with duration of 280ms. Thread: 17. Priority: AboveNormal. Active: 6. Task 6 finished at 01:42:19.704 with priority AboveNormal. Starting task 7, 01:42:19.708 with duration of 2692ms. Thread: 18. Priority: Highest. Active: 6. Task 3 finished at 01:42:19.927 with priority Normal. Starting task 8, 01:42:19.930 with duration of 2480ms. Thread: 19. Priority: Highest. Active: 6. Task 5 finished at 01:42:20.143 with priority Normal. Starting task 9, 01:42:20.147 with duration of 885ms. Thread: 20. Priority: Highest. Active: 6. Task 1 finished at 01:42:20.401 with priority Normal. Task 4 finished at 01:42:20.644 with priority Normal. Task 9 finished at 01:42:21.033 with priority Highest. Task 2 finished at 01:42:21.095 with priority Normal. Task 7 finished at 01:42:22.402 with priority Highest. Task 8 finished at 01:42:22.411 with priority Highest. 


This component is built using the .NET 3.5 Framework which means in can be used in all .NET applications that are using the 3.5 framework or newer. This includes .NET 3.5, 4.0, & 4.5+.

You can immediately use this within your application and is very simple. Ask any questions or suggest features at support.avantprime.com!

Purchase Now

Pipeline.NET – Limited concurrency Task Scheduler (Miscellaneous) | CodeCanyon

Purchase Now

Item Detail:

ID Price Total Sales Rating
4923910 $10.00 11 0.0

0.0 out of 5.0 based on 1211 ratings.