EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025 Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025
<== Date ==> <== Thread ==>

Subject: Understanding ASYN_CANBLOCK
From: Marco Filho via Tech-talk <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>
Date: Thu, 30 Jan 2025 22:02:34 +0000

Hi all. I'm writing this e-mail to ask for help understanding ASYN_CANBLOCK.

I have an asyn driver that communicates via a thread-safe API with the hardware. It tries to read thousands of parameters and I noticed that the IOC was freezing periodically as I added more parameters to be scanned.

I also noticed that reducing the SCAN time from 1 second to 5 seems to make the IOC shell freeze every couple of seconds or so (instead of freezing constantly), and guessed - just a guess - that this could be due to asyn trying to scan all parameters at once, no matter the period of 5 seconds between each reading.

Searching for a way to distribute the readings in time and reading the documentation, I found ASYN_CANBLOCK, which seems to create a separate thread for managing the queue requests:

"If queueRequest is called for a port that can block the request is queued to a thread dedicated to the port.
"

I expected then that putting the ASYN_CANBLOCK flag in the driver constructor would solve my problem, but to my surprise the behavior was the opposite: I found out that the constructor was already using this flag:

asynPortDriver(portName, 1,
      asynInt8ArrayMask | asynInt32Mask | asynInt32ArrayMask | asynInt64Mask | asynFloat64Mask | asynOctetMask | asynDrvUserMask,          // Interfaces that we implement
      asynInt8ArrayMask | asynInt32Mask | asynInt32ArrayMask | asynInt64Mask | asynFloat64Mask | asynOctetMask,       // Interfaces that do callbacks
      ASYN_MULTIDEVICE | ASYN_CANBLOCK, 1, /* ASYN_CANBLOCK=1, ASYN_MULTIDEVICE=1, autoConnect=1 */
      0, 0),  /* Default priority and stack size */

And removing the flag caused the OPI and shell to not freeze. By visually and manually inspecting I also have the feeling that the parameters are being properly scanned and that I'm not leaving anything behind.

The question is: by removing ASYN_CANBLOCK am I actually distributing the readings in time or am I doing something else? Are the requests actually being executed in parallel?

Thanks for any elucidations,

Marco


Replies:
Re: Understanding ASYN_CANBLOCK Mark Rivers via Tech-talk

Navigate by Date:
Prev: Re: MRF kernel modules not seeing hardware Han Lee via Tech-talk
Next: Re: Understanding ASYN_CANBLOCK Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025
Navigate by Thread:
Prev: Re: archiver appliance and CA -> PVA Sky Brewer via Tech-talk
Next: Re: Understanding ASYN_CANBLOCK Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  <2025