Rx – Window

2011/12/31

Rx - Window continuing with the Rx series, this post will discuss the Window operator. in previous post I was discussing the Buffer operator which enable buffering of Rx datum stream into chunks. has good and useful as the Buffer operator is, it doesn't nail up every single scenario. let consider a scenario of tracing the highest and lower value within a time period. for example hourly tracking of a service monitoring which produce values every second. technically we can use the Buffer operator for handling this scenario. the problem is...

the concept of async \ await

2011/12/29

the concept of async \ await in this post I will survey the new .NET 4.5 / C# 5 concept of async / await. I will focus on how to understand what is really happens behind the new async / await syntax. What's it all about? the new async / await syntax is using the C# syntactic compiler to generate async operation from code that is looking very much like a synchronous code. but before we start we should discus the new C# 5  syntax. the syntax include 2 keywords: ...

TPL – Continuation

2011/12/28

TPL - Continuation this post will discuss TPL Continuation. TPL continuation can chain task into a pipeline. when dealing with dependencies between parallel work units, like , continuation is the API for scheduling work unit upon completion of other work unit. the general idea is quit similar to the old APM pattern (BeginXxx, EndXxx) callback. basic completion the syntax of continuation: Code Snippet Task tsk = Task.Factory.StartNew(() => {/* do somethng*/}); tsk.ContinueWith(t => {/* continue when something complete*/}); ...
one comment

Rx – SP1

2011/12/25

RX - SP1 Rx release is having it first service pack. The Service Pack release doesn't include any new API-level functionality and fixes a few minor bugs (all of which were already fixed in the Experimental Releases in the v1.1 band): Scheduler.TaskPool now guarantees the use of the task pool. See this forum post for more info. SkipUntil now propagates errors of the source sequence, even when the "until" sequence hasn't fired yet. ToQbservable now accepts an IScheduler parameter, mirroring its ToObservable brother....

Rx – Buffer

2011/12/22

Rx - Buffer this post is on of a series of post about Rx (Reactive Extension). in this one I will discuss the Buffer operator. no doubt that one of the most useful Rx operator is the Buffer. the Buffer operator enable to reduce a throughput pressure and gain better utilization of our resources. let take a scenario of monitoring data stream and persist the datum into database (or send it through a network boundaries). assuming the datum rate is 1 per millisecond, databases does not typically design to work...

Tpl Dataflow (IDataflowBlock) – Part 5

2011/12/19

Tpl Dataflow (IDataflowBlock ) - Part 5 the previous post discus the concept ITargetBlock and ISourceBlock, which is the TDF consumer/Producer contract. you can find all the post in this series under the TDF tag. this post focus on the IDataflowBlock contract which is the life-time management contract for all data-flow's blocks. the IDataflowBlock define single property and 2 methods: Code Snippet public interface IDataflowBlock {     Task Completion { get; }       void Complete();     void Fault(Exception exception); } ...

Task != Thread

2011/12/18

Task != Thread whenever I teaching the Tpl Task subject I continually repeating the mantra which say that "task is a metadata/context of execution and it does not really responsible for the actual execution". Task is a data structure which hold information about code execution, it's hold the delegate which will be execute, status, state, result, exception synchronization object, ext... but the responsibility of the execution is actually belong to the Task Scheduler. in matter of fact task can be execute synchronously. Code Snippet Console.WriteLine(Thread.CurrentThread.ManagedThreadId); Task...

Tpl Dataflow (block structure) – Part 4

2011/12/16

Tpl Dataflow (block structure) - Part 4 this is the 4th post in the Tpl dataflow series, you can see other post in this series at the TDF tag. this post will discuss a general implementation of built-in Tpl dataflow block. in general built-in blocks fall into 3 categories Pure buffering blocks: present different strategy of buffering and distribution. Execution blocks: manipulate the incoming messages. Grouping blocks: ...

What is the cost of async/await?

2011/12/15

What is the cost of async/await? .NET 4.5 (C# 5) had brought the new async/await syntax. I will cover async/await syntax in more details in future post, but in the meanwhile in case that you are not yet familiar with this syntax, what's  you should have to know is that the syntactic compiler transform that syntax (and the lines that follow the await keyword) into IL, the generated IL is following the concept of the TPL ContinueWith. the syntactic compiler is actually generating fair amount of IL which represent a state-machine of the async execution. ...
no comments

Is it faster?

2011/12/11

Is it faster? does the .NET 4.5 really run faster than 4? this post will summaries TPL Performance Improvements in .NET 4.5. the TPL team has put lot of effort to dramatically improve the overall performance of .NET 4.5. the improvement was achieve both by execution and memory allocation optimization. in result .NET 4.5 parallelism is faster and more GC friendly. allocation optimization does improve the overall execution speedup, because GC collection does have significantly impact on the overall performance (thread freezing and more). the benchmarks in this post were...
3 comments