Task Parallel Library / TPL

It has been very long since my last post here – I was really busy at work. But I will try to “fix it”! :)

I don’t know where Sacha Barber finds time for all his articles and “hobby” projects, but I am glad he does! One of the latest subjects of his investigations is Task Parallel Library (or TPL in short), one of the new parts of .NET 4:

  1. Part 1: Starting Tasks / Trigger Operations / Exception Handling / Cancelling / UI Synchronization
  2. Part 2: Continuations / Cancelling Chained Tasks
  3. Part 3: Parallel For / Custom Partioner / Aggregate Operations
  4. Part 4: Parallel LINQ
  5. Part 5: Pipelines
  6. Part 6: Advanced Scenarios / v.Next for Tasks

Today’s Sites/Blogs

  • Ask the Performance Team (Thoughts from the EPS Windows Server Performance Team) – in their own words “… the Performance team covers a broad range of seemingly unrelated areas such as Core OS Performance, Printing, WMI and Terminal Services. Simply put – we’re a bit of a “catch-all” team. [...] Because we cover such a wide spectrum of technology, we see many different types of issues – some more frequently than others. So we thought we should share with the broader technical community. We’ll be sharing troubleshooting tips and technical information on areas of our specialty that we cover.”
  • 45+ Excellent Code Snippet Resources and Repositories – it is what it says it is.

.NET Events: Multithreading Issues

Threadsafe Events article at CodeProject explains problems one might encounter with .NET events in a multithreaded environment (not necessarily stating the absolute truth but still). Unfortunately, no-one has figured out the perfect solution, and we will have to choose “the best from all bad solutions” for some time still.

Asynchronous Callback Contexts article by the same author shows possible solution for event cancellation, particularly during object disposal: end-users do not expect components to raise events after they have been disposed or after they have unsubscribed from these events. The author refers to his Nito Asynchronous Library as a way to solve this issue.

Today’s Sites/Blogs

  • Started to “bump” into the Smashing Magazine quite often nowadays. Usually it collects interesting Internet resources related to web development (notably CSS, HTML, AJAX, etc.) and design (user interfaces, fonts, new ideas, etc.), and also has some tutorial-like or how-to-like posts (e.g. about PNG optimization, common mistakes, etc.). Really nice! Webdesigner Depot, Line25 Web Design Blog, and Presidia Creative all have similar concept.
  • Windows Presentation Foundation SDK by Windows Presentation Foundation SDK writers and editors. Might be more interesting, but OK nevertheless.
  • Expression Blend and Design – The team blog of the Expression Blend and Design products

Security: Banned C Functions

memcpy() Is Going to Be Banned article at InfoQ talks about dangers of memcpy (and other memory/string related functions). Microsoft has more in-depth explanations as well as the list of Security Development Lifecycle (SDL) Banned Function Calls at MSDN. Also available from Microsoft is banned.h header file that, once included, will produce warnings for all the banned functions. Alternatively one can use the /W4-C4996 compiler option.

Win32/C++ Resources

A “healthy set” of Win32 and C++-related links (related stuff, anyway):

“Bit Twiddling”

Needed to do some “weird” things recently that involved bit operations, e.g. to create masks with certain number of bits set. During my “research” I found few interesting places:

More C++ Idioms

More C++ Idioms is a Wikibook aimed toward anyone with an intermediate level of knowledge in C++ and supported language paradigms. The goal there is to first build an exhaustive catalog of modern C++ idioms, and later evolve it into an idiom language, just like a pattern language.

The thing has been started by the author of C++ Truths blog. The blog is interesting by itself, as it has really many interesting articles on advanced C++ topics.

Today’s Blogs

  • The Old New Thing by Raymond Chen – really nice blog with a lot of in-depth info, e.g. wonderful posts about The implementation of iterators in C# and its consequences (part 1, part 2, part 3), The implementation of anonymous methods in C# and its consequences (part 1, part 2, part 3), a lot of native Win32 topics (e.g. DLLs, processes, controls, etc.), etc. Probably there is no aspect of Windows that would not be covered at that blog! :)
  • jaredpar’s WebLog by Jared Parsons – blog of the author of RantPack – a library that features functional programming patterns (tuples, immutable/persistent collections), threading utils (futures, cancelable futures, active objects, various other primitives), etc. The blog is very interesting, and there are many insights into software development topics

Today’s Links

These are mostly related to systems’ programming:

Software Testing and Related Things

By accident found Google Testing Blog. Not bad.

One of the articles is called How to Write 3v1L, Untestable Code – a must-read for newbie (and not newbie too!) programmers. Not on this blog, but nevertheless related article is How To Write Unmaintainable Code by Roedy Green – very serious collection of bad things despite it is very funny to read.