threading
Python Singletons
In my opinion, good python libraries and frameworks should spend effort guiding you towards the ‘pit of success’, rather than trying to keep you from failing. They do this by spending most effort on things related to the critical path- clear interfaces, simple implementations, thorough documentation. Which is why...
Read more
Why GUI’s Lock Up
This is a post for the Tech Artists and new programmers out there. I am going to answer the common question “why do my GUI’s lock up” and, to a lesser extent, “what can I do about it.” I’m going to tell a story of a mouse click event....
Read more
Three options for data correctness
In a previous post, I linked to Rico Mariani’s performance advice for Data Access Layers. On G+, Tyler Good asked: I just read the posts and the linked blogs, I had a question about some specific implementations. How do you deal with classes that represent another non-[in this case]-Python...
Read more
Async IO- don’t do naive async!
This post comes from a response here: http://stackoverflow.com/questions/882686/asynchronous-file-copy-move-in-c . The second-highest rated response includes absolutely terrible advice. It says, just put the file IO on a background thread. It shows a complete lack of understanding of how IO works. When your do IO (reading/writing from/to HDD or network), the software...
Read more
Two keys to effective multithreaded programs
In my last post, I went over a mostly lock-free producer/consumer queue that worked entirely off the ThreadPool. This covers the two most important aspects to effective multithreaded programming: avoid creating new Threads, and work lock-free where possible. Avoiding the creation of new threads is easy- you just need...
Read more
Completely async file writer
I’ve been doing more and more asynchronous programming lately. I needed to implement a logging system recently, but wanted to use asynchronous file IO. There was also the possibility that log calls could come in faster than they could complete, so I needed to synchronize the logging calls, marking...
Read more
It is 2011. Start building responsive UIs.
In February, I finally figured out my New Year’s Resolution. It was to build no more UIs that lock up, ever (except in exceptional circumstances where there is no other choice). It spawned this post that I’ve finally gotten around to finishing (and some of the topics I have...
Read more
Naive Programming and Multithreading
I on almost weekly basis, I run into some example of naive programming regarding threading. Generally they have the following in common: 1- Uses Thread.Start 2- Show no understanding of CPU-vs-IO bound operations 3- Show no understanding of how a computer manages threads Take this psuedocode for some widely-used...