When I wrote the AsyncPrioritySemaphore few months ago I quickly found how the continuations are processed once “unleashed”. Lately I was using the same class again and I was monitoring the behavior. That made me think about what could be done and how.
After measuring the
lock statement compared to naked
Monitor calls I got some remarks about my code not being equivalent. Of course it’s not. If it would be equivalent the time would be (should be) same. I wrote it as I did because I think there are some problems with the
When I’m teaching my “parallel-threading-asynchronous-locking-synchronization” course I discuss the
lock statement a lot. Not only because it’s probably the most widely used “lock”, but also because it’s pretty easy to fall into a trap if you don’t know what’s going on behind the scenes and around you.
Anyway. I often show how the
lock is translated into
finally block and that it does not come for free. And among other things I’m trying to get into the brains of the people I’m teaching is that you should spent as less time as possible inside
lock (of course, with some exceptions) - less contention equals less waiting hence more resources used for real work.
In last couple of weeks I was again confronted number of times with something “asynchronous”. In this post I don’t want to argue about CPU-bound and IO-bound operations with respect to “asynchronous” word. What I’ll talk about is the
async keyword. Because it looks like there’s still confusion.
I have to say I’m bit obsessed by writing as less code as possible and having compiler of language do the work. I don’t like cryptic code, though. It needs to read easily. My problem today was simple. I needed simplify the code that sets new value into property, does something and sets back the original value.
Maybe you remember this from good old Delphi or WinForms days. Set the title of button to “Working…”, do the work, put back whatever was on that button before.
Last week I was working with pretty bad library that from time to time got stuck. No progress. Given the library was fairly young and supported asynchronous methods I suspect there was a deadlock/livelock somewhere. Although the code was open source I had no time (or intention) to debug it. I just needed quick fix.
Po Brně a Praze si “Asynchronní a paralelní programování v .NETu” střihneme v Olomouci. Jsem rád, že lidi toto zajímá. Je to téma co mě baví a rád o něm povídám. Klidně bych povídal a programoval a přemýšlel nad problémy co lidé přinesou hodiny. A když mě někdo poslouchá… :)
Asynchronní proramování nabralo za posledních pár let na obrátkách a dostalo se do povědomí mnoha vývojářů. Ačkoli ve své podstatě se nejedná o nic nového, alespoň v systému Windows. Nicméně příchod C# 5 a, jistě nyní známých, klíčových slov
awaitumožnil použití asynchronní programování bez dřiny.
Pokud vás zajímají detaily od křemíku až po kód, přijďte 13.10.2014 od 17:30 na WUG do Olomouce.
Two years ago I first hiked the Kreuzspitze. The Kreuzspitze in Ötztal Alps – kreu means cross in German and spitze could be translated as peak and as there’s a lot of peaks in (not only) Alps with cross on top, it’s also bunch of peaks with same name in Austria, Italy, Germany and maybe somewhere else. The trail from closest village Vent is not extra difficult (you don’t need to climb) although it’s steep in some sections and the final part being a bit exposed ridge. Later I discovered the concept of FKTs or Fastest Known Times and after a while it clicked me. This could be a great peak to try to summit (and get back down) in record time.
Everybody’s agile. Everybody’s having backlog and doing scrum (whatever that means). Everybody’s talking about one week sprints and two week sprints. And it’s so fun and modern and minimum viable product and burn down charts and … and I’m not so sure about sprints.
Release often. So here we are. Version 18.104.22.168 of ADO.NET provider for Firebird is ready for download to serve you until … until the new version comes out.
Task Parallel Library (TPL) and
await functionality completely changes the game we - developers - were playing last years. Because it changes the game so much there’s quite some implementation details that, when you want to play A game, need to be considered. It’s not that the implementation is wrong or attacking the problem from wrong direction. It’s just a trade-off. Basically to make a A- game ready without any additional learning.
After I wrote the earlier piece, I realized there’s maybe another option. And then after thinking about it I realized it’s not that black and white either.
Spending last few days travelling I got into thinking about article I read week or two before about companies more and more deleting people’s emails when they are on vacation. I think it’s a great idea. But it’s not black and white as it looks like.
I’m running Synology DS207+ home. I know this one is old, but it still works fine. And it does almost all I need. From time to time I change hard drives because the old one are basically done. Luckily the RAID 1 saves me a lot of trouble.
With today’s release of .NET provider for Firebird the Entity Framework (version 6) support got even better. But given we’re 3rd party provider, there’s always some steps involved. I created a sample project that shows both approaches to working with Entity Framework - Code First manually and EDMX using wizard (or course you can mix these two together too).
I’m pleased to announce new version - version 22.214.171.124 - of ADO.NET provider for Firebird. This version provides improved support for Entity Framework 6 and also countless hours and builds has been spent on hunting some race conditions in “events” support.
Back in 2005 I wrote a blogpost TcpListener and TcpClient (an easy-to-use example). It was really just a piece of code I wrote to quickly finish what I was doing and I put it on my blog. The code was throwaway code, but even after the years it’s still visited a lot on my blog.
Given the code was written 9 years ago, when my skills were 9 years younger and when the world around us was slightly different, different tools etc. I decided to give it a little facelift. Kind of 2014 edition.
Whenever I’m dealing with
DbUpdateConcurrencyException I don’t what is “client wins” and “store wins” look like. I can at the end figure it out because I know how the
ChangeTracker works and I kind of know where I’m heading. But going slowly though IntelliSense isn’t what I like to do.
Last week I noticed new firmware for Garmin fēnix 2 being available. I was eager to load it into watch because I was having problems lately with satellite reception. I was not happy to open Garmin Express to update the firmware. The watch works as a standard USB Mass Storage so why the vendor forces me to use this program is a mystery.
Anyway as I started the Garmin Express it started updating itself and kept popping up the UAC prompts. After like twenty confirmations it finally started, but said there’s no Garmin device connected. Heck it was, I just copied the
fit files from it, it was charging and I saw the “Garmin drive”. Couple of attempts later I gave up. Time to look how the update it done - I had strong feeling that it’s just copying the file somewhere and that’s it.
Last week participant on my Entity Framework course created a code that looked like it should not work, but it worked. And I had initially trouble explaining why. After I dug deep, almost running out of bullets :-), I finally saw it clearly. It made complete sense as computers follow steps exactly. Let’s have a look.