The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,567 other followers

Archive for the ‘Multi-Threading / Concurrency’ Category

ILockable/TLockable/Lockable. Similar to IManaged in Spring4D, but provides a Locked interface.

Posted by jpluimers on 2019/04/10

Had to use this to start solving threading issues in a project I inherited a while ago in a temporary way before doing a huge refactoring. Will likely need it in the future as well: ILockable/TLockable/Lockable. Similar to IManaged in Spring4D, but provides a Locked interface..

ILockable/TLockable/Lockable. Similar to IManaged(now IShared) in Spring4D, but provides a Locked interface.

Note this is very inefficient, but can be practical as a shotgun approach to start solving the mess when you inherit a project that has the “I know, I’ll use threads!” approach in it.

Replace the resource typed TNeedsLock that needs protection with a ILockable<TNeedsLock>, then route all references via a call to the Locked()() call to it.

If you need a simpler approach, then use [WayBack] Interfaced monitor lock — Bitbucket by Stefan Glienke.

–jeroen

Read the rest of this entry »

Posted in Conference Topics, Conferences, Delphi, Development, Event, Multi-Threading / Concurrency, Software Development | Leave a Comment »

Requirements to write multi threaded code

Posted by jpluimers on 2019/04/01

Steps:

  1. get gist.github.com – Developers must be this tall to write multi threaded code
  2. render to PNG/PDF/HTML
  3. print
  4. attach to wall

Via [WayBack] Kristian Köhntopp – Google+

Related:

Bernd Paysan’s:

The three most 2. common race
1. off-by-one software conditions
errors:
counting
core dumped (Segmentation fault in printf)

–jeroen

Read the rest of this entry »

Posted in Development, Fun, Multi-Threading / Concurrency, Software Development | Leave a Comment »

*Recursive Parallel For Loops*…

Posted by jpluimers on 2019/03/28

Interesting thread: [WayBack] Recursive Parallel For LoopsI have an algorithm which isn’t a sorting algorithm but conceptually works similar to the Quicksort algorithm… – Steve Maughan – Google+

TL;DR: when splitting recursive algorithms in parallel, ensure you have a way to hard limit the number of threads.

–jeroen

Posted in Development, Multi-Threading / Concurrency, Software Development | Leave a Comment »

What is thread safety anyway?

Posted by jpluimers on 2017/12/13

A nice article [Archive.is] What is thread safety anyway? with a kind reference to the Deadlock Empire translation from C# to Delphi that I made.

In any language, multi-threading is hard, so I really love the quote below:

[WayBack] Multithreading can be hard to do right. The most common point of failure is assuming some code is thread safe when it actually is not... – Dalija Prasnikar – Google+

It reminded me of an old one:

A programmer had a problem. He thought to himself, “I know, I’ll solve it with threads!”. has Now problems. two he

–jeroen

Posted in .NET, C#, Delphi, Development, Fun, Multi-Threading / Concurrency, Quotes, Software Development, T-Shirt quotes | Leave a Comment »

If you thought you could do multi-threading, then play “The Deadlock Empire” games

Posted by jpluimers on 2016/10/04

Slay dragons, learn concurrency! Play the cunning Scheduler, exploit flawed programs and defeat the armies of the Parallel Wizard.

Source: The Deadlock Empire

Via: Face the dragon. Learn the ropes of concurrent programming. – Lars Fosdal – Google+

Source code is available and focuses on C#; maybe one day I’ll make a Delphi version: deadlockempire/deadlockempire.github.io: The Deadlock Empire: Slay dragons, learn concurrency!

BTW: a great book (with nice illustrations at both github and kernel.org) is Source: Is Parallel Programming Hard, And, If So, What Can You Do About It? [WayBack]

–jeroen

Posted in .NET, C#, Delphi, Development, Multi-Threading / Concurrency, Software Development | Leave a Comment »

 
%d bloggers like this: