Semaphore Slim and Async

Tuesday, August 16, 2016

Semaphore Slim and Async On this post I will focus on async waiting on Semaphore (using SemaphoreSlim). In general .NET is having 2 Semaphore implementations: - Semaphore which is the legacy implementation (but support cross process operations) - SemaphoreSlim which is lightweight version. It bring some performance improvements but it don’t support cross process operation. this post will focus on SemaphoreSlim WaitAsync API. Let start analyzing the following code snippet, think what’s wrong with it: Code Snippet private static SemaphoreSlim _gate = new SemaphoreSlim(4); static void Main(string args) {     for (int i = 0;...
no comments

Service Fabric Concept, Guidelines and Patterns #3 – Pool

Friday, December 25, 2015

Service Fabric Concept, Guidelines and Patterns #3 – Pool this post is part of the Service Fabric’s series which covers Service Fabric’s concept, guidelines and common patterns. at this post we will discuss the Pool pattern. there are many reasons for using pools, you may need a set of initialized resources, for boosting performance, limit memory allocations or limiting of concurrent access to resource (like connection string).  not matter what motivation you have, the pattern is quite simple to implement while using the Service Fabric Actor model.   remember that the Service Fabric’s...
no comments