EPICS Controls Argonne National Laboratory

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  <20192020  2021  2022  2023  2024  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  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: How to share asyn's queue thread among ports?
From: "Konrad, Martin via Tech-talk" <[email protected]>
To: Klemen Vodopivec <[email protected]>, "[email protected]" <[email protected]>
Date: Fri, 31 May 2019 17:42:54 +0000
Hi Klemen,
> The obvious solution is to use asyn's blocking mode, but there's up
> to 500 ports resulting in as many threads.
Could you please elaborate on why you think this is a problem? It might
not look pretty but in practice CPU overhead might actually be small:
Asyn is using threads because it needs to wait for asynchronous
operations to complete. The pattern is generally: process some data
(which takes a very short time), go to sleep and wait for the next
event/interrupt. Whenever you send a thread to sleep the scheduler is
performing a context switch.

Let's say you have 1000 events/s to process with a single thread. You
wake up 1000 times/s and go to sleep 1000 times/s resulting in 1000
context switches/s. If you are processing the 1000 events with 1000
threads, each of them wakes up once per second and goes to sleep. Again
1000 context switches/s total.

I'm simplify here but CPU overhead might not be as bad as you might
think in the first place. Memory overhead of course is a different story.

-Martin

-- 
Martin Konrad
Facility for Rare Isotope Beams
Michigan State University
640 South Shaw Lane
East Lansing, MI 48824-1321, USA
Tel. 517-908-7253
Email: [email protected]

Replies:
Re: [EXTERNAL] Re: How to share asyn's queue thread among ports? Klemen Vodopivec via Tech-talk

Navigate by Date:
Prev: Re: Receiving duplicate monitor values using CA PV Gateway William Layne via Tech-talk
Next: Re: Receiving duplicate monitor values using CA PV Gateway Johnson, Andrew N. 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  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: [EXTERNAL] RE: How to share asyn's queue thread among ports? Mark Rivers via Tech-talk
Next: Re: [EXTERNAL] Re: How to share asyn's queue thread among ports? Klemen Vodopivec 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  <20192020  2021  2022  2023  2024 
ANJ, 04 Jun 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·