CodeCanyon Pipeline.NET Limited concurrency Task Scheduler 4923910

CodeCanyon Pipeline.NET Limited concurrency Task Scheduler 4923910

CodeCanyon Pipeline.NET Limited concurrency Task Scheduler 4923910
.NET Script \ Miscellaneous
Concurrency \ Scheduling \ Limit \ Maximum \ Scheduler \ Priority \ Task \ Usage

.NET Script - Pipeline.NET Limited concurrency Task Scheduler 4923910 by @ CodeCanyon

.NET Script \ Miscellaneous

Last Update: 11 June 13; Compatible Browsers: IE6, IE7, IE8, IE9, IE10, Firefox, Safari, Opera, Chrome; Software Version: .NET 3.5, .NET 3.7, .NET 4.0, .NET 4.5, Other; Files Included: C# CS.

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 N 1 number of tasks on N 2 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.

- Number of pipelines to use for executing tasks – Funnel any number of tasks/work into a fixed number of pipelines

- Use of ThreadPool or non-ThreadPool threads

- Backup auto-wakeup event with configurable executed interval mechanism for waking persistent sleeping tasks (normally not needed, but good to have)

- 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

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);
}
/// <summary>
/// Gets or sets the date and time the task was added to the queue.
/// </summary>
public DateTime ArrivalTime { get; set; }
/// <summary>
/// Gets or sets the scheduling priority of a task.
/// </summary>
public TaskPriority Priority { get; set; }
/// <summary>
/// Gets or sets the details of the task execution.
/// </summary>
public TaskExecutionResult ExecutionResult { get; set; }
/// <summary>
/// Gets or sets the original scheduling priority of a task.
/// </summary>
public TaskPriority OriginalPriority { get; set; }
/// <summary>
/// Gets or sets the last date and time the priority
/// was boosted.
/// </summary>
public DateTime PriorityBoostTime { get; set; }
#endregion
}
}
}

Output.

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.

Technologies
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 !

AspectV - .NET Data Validation; Fluent.NET Mail; One Gallery; CacheFabric; GoSearch.NET; Event Log Writer - High Performance Event Logging; Parallel.NET - Background Task Scheduler.

Keywords: No locking, background work, concurrency, high performance scheduling, job scheduler, limit concurrency, limit concurrent tasks, limit thread usage, maximum concurrency, maximum concurrency level, priority, priority based scheduling, scheduling, sempahoreslim, task scheduler.



Tags: Concurrency, Scheduler, Scheduling, Limit, Maximum

Premium CodeCanyon Pipeline.NET Limited concurrency Task Scheduler 4923910 WordPress Themes, Website Templates, Mobile Themes, Flash Templates & Scripts from creative professional designers. Full details of CodeCanyon Pipeline.NET Limited concurrency Task Scheduler 4923910 for digital design and education. CodeCanyon Pipeline.NET Limited concurrency Task Scheduler 4923910 desigen style information or anything related.

Comments:

Name:*
E-Mail:*
Add Comments:
Enter Code: *