Menu

Skip to content
  • Home
  • About
  • Color Coder
Hamid Mosalla
Twitter Email LinkedIn GitHub Stack Overflow RSS

Hamid Mosalla

Programming Adventures

Asynchronous And Parallel Programming

November 25, 2023 by Hamid Mosalla on .Net, .Net Core, Asynchronous And Parallel Programming, Best Practices, C#, Programming

C# Asynchronous and Parallel Programming Best Practices

I’ve already written about Asynchronous and Parallel programming before here and here. This is one of those subjects that can be tricky and is the source of a lot of bugs. But I feel the posts that I’ve written before might be too long or they are too specialized, hence not very approchable. In this … →

 
April 29, 2023 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Thread Affinity in Parallel Programming Using TPL

Thread affinity refers to the assignment of threads to specific processors or cores on a multi-core CPU. When a thread is bound to a specific processor or core, it is said to have affinity to that processor or core. This is in contrast to thread migration, where a thread can move between different processors or … →

 
September 18, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

TPL Dataflow Blocks: Post vs SendAsync

I was reading an excellent series of articles about TPL Dataflow from Jack Vanlightly the other day. He draw my attention to the difference between Post and SendAsync when we want to post something to a block. I wasn’t thinking about it much at the time. But as I progressed through my readings, I saw … →

 
August 24, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

More Robust Asynchrony and Parallelism With TPL Dataflow ActionBlock

.In my previous post, I explained what TPL Dataflow is and when we should and shouldn’t use it. But I haven’t got into much detail about how it can help us solve real world scenarios. Since my last post, thanks to a comment on my previous post, I went though different Stackoverflow questions. I saw … →

 
August 4, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

What is TPL Dataflow in .Net and When Should We Use It

There are various ways to write a concurrent or parallel program in .Net but they’re often don’t have the flexibility and robustness needed. That’s where TPL Dataflow comes in, it helps us build a more robust concurrent program and it can helps us reduce a lot of complexity. For example when we use other paradigms … →

 
July 17, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Asynchronous Programming Series

Recently I wrote a series of posts regarding asynchronous programming. You can find the links to this series down below. In these series of posts I started from the definition of concurrency and how it’s different with parallelism. Then I moved on deeper into the subject by each post. My 10th post in this series … →

 
July 9, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Thread Safety

There a lot of things that can go wrong in our code. But when we introduce concurrency or parallelism in our code, we potentially could experience different set of bugs. These are race conditions, deadlocks and data corruption to name a few. This happens because there might be a share piece of data between different … →

 
June 24, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

What Is SynchronizationContext

SynchronizationContext is one of those topics that deserves a better understanding if we want to fully know how asynchorony works in .Net. It’s true that most of these concerns handled behind the scene. But we can benefit by understanding what exactly happens when we offload a task to a worker thread or release the thread … →

 
June 19, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Exception Handling In Asynchronous Code

It is important to know how exceptions are handled in an asynchronous program. Partly because these subtle points can sometime become a headache. When exception are thrown in a code that runs inside a task, all the exceptions are placed on the task object and returned to the calling thread. When exceptions happen, all the … →

 
May 27, 2018 by Hamid Mosalla on .Net, Asynchronous And Parallel Programming, C#

Task.Run Vs TaskCompletionSource Vs Task.Factory.FromAsync

There’s a lot of small intricate details that one can miss when we deal asynchronous programs. Even though these days far more superior APIs exist that make things a lot easier. For example a lot of people think if we want to call any synchronous code asynchronously, we just simply  wrap it in Task.Run. It’s … →

 
Older Posts →
Page 1 of 2

Archives

Categories

 
Subscribe!
Copyright © 2022 Hamid Mosalla
Casper Theme By Lacy Morrow