[fpc-devel] Suggestion: reference counted objects

Boian Mitov mitov at mitov.com
Sat Sep 20 21:27:12 CEST 2014


  Hi Giuliano,

All of our libraries, are heavily multithreaded, and use exclusively reference counting with interfaces, as well as lazy evaluation nested object reference counting for performance.
We have been doing this for over 11 years with great success, and we continue to expand the functionality.
Not only is it doable, but it is nearly impossible to do really complex heavily distributed threading without it. Trust me, I have been doing multithreading since the days we had to implement it in interrupt cascades in 6502/6800 8 bit processors 30 years ago ;-) . I know what it takes to do it in assembler, C, C++, Delphi, with and without OOP, as well as with and without ref. canting ;-) . I have done them all...

With best regards,
Boian Mitov

-------------------------------------------------------
Mitov Software
www.mitov.com
-------------------------------------------------------

From: Giuliano Colla 
Sent: Saturday, September 20, 2014 11:33 AM
To: FPC developers' list 
Subject: Re: [fpc-devel] Suggestion: reference counted objects


Il 20/09/2014 19:20, Boian Mitov ha scritto:

    Hi Chriss,

  Personally I favor reference counted objects. While there are interfaces as you pointed, and in Delphi you can even use smart pointers now, there is still a lot of cases when you need to use objects, and have to manually free them.
  In single threaded environment that is not such an issue, but in parallel and heavily multithreaded environments, reference counting is a life saver.

Can you explain how reference counting can be safely implemented in a parallel multithreaded environment, without heavily affecting performance?
A mere increment or decrement of count means to get a lock and to release a lock on that object. Application code can know what is thread safe and what is not, and use lock only when appropriate.
A general mechanism to be reliable should take into account all possibilities. If it does, it will block threads even when unnecessary. If it doesn't, it will be unsafe.

What do I miss?

Giuliano




--------------------------------------------------------------------------------
_______________________________________________
fpc-devel maillist  -  fpc-devel at lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140920/3e9b8825/attachment.html>


More information about the fpc-devel mailing list