Posts
22
Comments
75
Trackbacks
0
semaphore
Semaphores for better distribution of work items across threads
As developers we will often find ourselves doing loops/iterations to process hundreds, thousands or even millions of items, e.g. parsing files, screen scraping sites, doing complex computations on multiple rows etc. To process these types of jobs, we can take a look on some supermarket lines, where we have 1 long line with several counters catering to 1 customer at a time, when a cashier is done with the current customer, one customer will be called from the line. On the programming world we have ......
Posted On Tuesday, September 13, 2016 7:20 PM | Comments (2)
Semaphores–queuing with multiple workers–C#
One of the challenges of working with queues is how to properly and neatly process each item using multiple workers, luckily on .Net we have Semaphores. “In computer science, a semaphore is a variable or abstract data type that is used for controlling access, by multiple processes, to a common resource in a concurrent system such as a multiprogramming operating system.” https://en.wikipedia.org/wi... Below is a simple program that demonstrate the use of semaphore with a parametized ......
Posted On Thursday, May 19, 2016 9:20 PM | Comments (0)
Tag Cloud