Archive for category .NET
.NET Thread Pool vs. Windows Thread Pool
Posted by Viktor Peller in .NET, Internals, Multithreading on May 5, 2018
In the previous post we learned how Windows handles slow devices. Completion Port is an effective tool to handle I/O results. Completion Ports have Thread Pool like features, and it is not a coincident. Windows implements a Thread Pool, and it is partially based on Completion Ports. It may sound strange, because Thread Pool is […]
Thread pool for I/O – Completion Ports
Posted by Viktor Peller in .NET, Internals, Multithreading on January 4, 2018
CPUs are incredibly fast, but sometimes they need to work with slow devices. How to handle these devices and let the CPU working efficiently?
Multithreading – Introduction II – Thread Pools
Posted by Viktor Peller in .NET, Multithreading on January 1, 2018
Multi core CPUs can run threads parallel, but it is not that trivial to decide when to start new threads. Creating threads is expensive, and using them in a wrong way can cause performance problems.
Multithreading – Introduction I
Posted by Viktor Peller in .NET, Multithreading on December 23, 2017
Writing multithreaded applications has been an option for a while in Windows. It was possible even under Windows 95. It is easy to answer that why it became a hot topic to write multithreaded programs in the last couple of years. Newer generation microprocessors are built with multiple cores, so they are able to execute more threads in parallel. But what was the benefit of writing multithreaded applications 20 years ago for single core processors?
Tech Interview – Improve the Algorithm
Posted by Viktor Peller in .NET, Algorithms, Interview on November 11, 2017
Adding new files to our database increases the processing time significantly. This is because the algorithm we use is not efficient. Let’s recap how it works. After we read the database in, we have a list of Person instances, and every Person instance maintains a list that tells which other people this person likes: If […]
Tech Interview – Non-recursive Tree Traversal
Posted by Viktor Peller in .NET, Algorithms, Design Patterns, Interview, Refactor on November 4, 2017
In the previous part we extended the database structure and now it supports sub-directories. The algorithm that walks through the directory structure is based on recursive calls. Many times recursion results a nice program structure, but it also has its drawbacks. What if we want to process the data – like files from a directory […]
Prevent Stack Overflow in Recursion
Posted by Viktor Peller in .NET, Algorithms on October 7, 2017
In the previous part we solved a problem using recursion. In this solution a method keeps calling itself. When a method calls a method, it has some administrative cost, it needs memory. For example, the CPU needs to know where to continue the execution of the program code after it returns from a method, so […]
Tech Interview – Recursive Tree Traversal
Posted by Viktor Peller in .NET, Algorithms, Interview on October 3, 2017
One of the improvements we need to make on the Like Statistic application is to change the structure of the database where the datafiles are stored. The database is a directory with datafiles, and the program reads all datafiles from that given directory from a single level, but doesn’t read those from the subdirectories. In […]
Expression Tree Based Activators
Posted by Viktor Peller in .NET, Refactor on September 23, 2017
In the previous part, in the convention based factory, we used the Activator class CreateInstance() method to create a parser dynamically using a type information. This solution works well in our example, but there is a faster way to create class instances than using Activator.
Tech Interview – Refactoring V – Convention Based Factory
Posted by Viktor Peller in .NET, Design Patterns, Interview, Refactor, SOLID Principles on September 10, 2017
In the previous part we fixed the code which reads the Person instances from the datafiles. A part of this code was a Factory class based on a switch statement. This solution is ok, but when we add a new parser, we need to remember to add a new case block to the switch statement. […]
Recent Comments