Friday, December 6, 2019

Digest for comp.programming.threads@googlegroups.com - 1 update in 1 topic

aminer68@gmail.com: Dec 05 12:53PM -0800

Hello,
 
 
About Coroutines..
 
 
Coroutines use cases
 
Coroutine will simplify writing:
 
- generators
- asynchronous I/O code
- lazy computations
- event driven applications
 
 
Read the following webpage to understand more:
 
Coroutines introduction
 
https://blog.panicsoftware.com/coroutines-introduction/
 
 
And my Object oriented Stackful coroutines library for Delphi and FreePascal was updated to version 2.11
 
Author: Amine Moulay Ramdane
 
Description:
 
This is an object oriented library to do Stackful Coroutines for FreePascal and Delphi and it comes with a semaphore and a mutex,
and it works on both Windows and Linux.
 
Because threads alone are expensive on windows because each thread can take one Megabytes of stack and the thread context
switch is expensive, so you can use this library with my Threadpool engine that scales well to be able to serve a great number of internet connections or TCP/IP socket connections, and of course you can do with it many other things such as simulations etc.
 
Here is the use cases of this object oriented coroutines library:
 
- Context switching is expensive with threads, with coroutines it is
really fast.
 
- My mutex and semaphore of my coroutines library are much much more faster than the mutex and semaphore used on processes and threads.
 
Main features:
 
Very small RAM overhead and provides semaphore and mutex.
 
Note: I have not saved the XMM registers on 64 bit compilers in my assembler routines, so with fastcall calling convention you have to pass the floating-point arguments by reference or use dynamic memory.
 
I have come to an interesting subject...
 
Is my Object coroutines library still useful ?
 
Can threads do the same job as coroutines ?
 
I think that coroutines are still useful because a lock or a cache-line transfer is expensive on threads running on multicores, a cache-line transfer between cores is around 800 CPU cycles on x86 , and that's too much expensive compared to coroutines, and the semaphore and mutex of my coroutines library and the contention on them are thus much much less expensive, other than that coroutines can yield to other functions or procedures inside a function or procedure, so i think that coroutines are thus still useful.
 
 
You can download it from:
 
https://sites.google.com/site/scalable68/object-oriented-stackful-coroutines-library-for-delphi-and-freepascal
 
 
Look at the defines.inc include file, you can configure it like this:
 
{$DEFINE XE} for Delphi XE compilers and Delphi tokyo.
 
{$DEFINE FPC} for FreePascal.
 
{$DEFINE Delphi} for Delphi 7 to Delphi 2007 compilers.
 
{$DEFINE CPU32} for 32 bit systems
 
{$DEFINE CPU64} for 64 bit systems
 
Language: FPC Pascal v2.2.0+ / Delphi5+:
http://www.freepascal.org/
 
Required FPC switches: -O3 -Sd
 
-Sd for delphi mode....
 
Required Delphi switches: -DMSWINDOWS -$H+ -DDelphi
 
Required Delphi XE-XE7 switch: -$H+ -DXE
 
For Delphi use -DDelphi
 
Operating Systems: Win, Mac OS X and Linux on (x86).
 
 
 
Thank you,
Amine Moulay Ramdane.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.programming.threads+unsubscribe@googlegroups.com.

No comments: