On Monday, May 30, 2016 at 12:10:39 PM UTC, Uwe Fechner wrote: > > I think, that would be difficult. > > As soon as you use any packages for image conversion or estimation you > have to assume that they use dynamic memory allocation. > > The garbage collector of Julia is fast, but not suitable for hard > real-time requirements. Implementing a garbage collector for hard real-time > applications is possible, but a lot of work and will probably not happen > in the near future. > > Their was an issue on this topic, that was closed as "won't fix": > https://github.com/JuliaLang/julia/issues/8543 > <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2FJuliaLang%2Fjulia%2Fissues%2F8543&sa=D&sntz=1&usg=AFQjCNGL2QEQox3U-q_GPUHD2crkohLC_Q> >
Well, the "won't fix"-label was later taken off the issue. Yes, the issue is still closed, but it's unclear to me what has changed with the GC, when. I know incremental GC was implemented at some point. No hard-real-time GC is available. It would be cool to know of Julia in space so I gave this some thought.. I recall from MicroPython, that they claimed hard-real-time GC (also available for Java with Metronome), that is predictable pause times. I remember thinking, how can they do/claim that (and if I recall, didn't change the GC)? MicroPython is meant for microcontrollers (at the time only one), that has a known amount of memory. I can't locate the information I read at the time now, I think they where talking in megabytes range. Then worst case, you have to scan a fixed amount of memory, and the speed of the CPU is also known. Unlike with MicroPython, you will have an operating system (that is not real-time, but Linux can be configured as such, but caches are a problem..). Maybe if you can limit the RAM, or just how much Julia will try to allocate, it helps in the same way. Anyway, you may not strictly need hard-real-time. I think, as always (in non-real-time/concurrent GC variants)?, the garbage collection only happens when you try to allocate memory and it is full. If you preallocate all memory and make sure no more is allocated, I can't see the GC being a problem (you can also disable it for some period of time). Libc.malloc and free is also available with Julia.. [Possibly it helps to split your task into more than one process, having only one real-time? If you can have shared memory between two processes, would that help? Be careful with that.. I'm not sure it's a good idea or at least I need to explain it better..] https://github.com/micropython/micropython/wiki/FAQ "Regarding RAM usage, MicroPython can start up with 2KB of heap. Adding stack and required static memory, a 4KB microcontroller could start a MicroController, but hardly could go further than interpreting simple expressions. Thus, 8KB is minimal amount to run simple scripts." https://forum.micropython.org/viewtopic.php?t=1778 "today I painfully learned, that uPy's automatic garbage collection can really mess up your 500Hz feedback control loop, since it takes forever (>1ms :o :shock: :cry: )." http://entitycrisis.blogspot.is/2007/12/is-hard-real-time-python-possible.html http://stackoverflow.com/questions/1402933/python-on-an-real-time-operation-system-rtos > > Uwe > > On Monday, May 30, 2016 at 12:00:13 PM UTC+2, John leger wrote: >> >> Hi everyone, >> >> I am working in astronomy and we are thinking of using Julia for a real >> time, high performance adaptive optics system on a solar telescope. >> >> This is how the system is supposed to work: >> 1) the image is read from the camera >> 2) some correction are applied >> 3) the atmospheric turbulence is numerically estimated in order to >> calculate the command to be sent to the deformable mirror >> >> The overall process should be executed in less than 1ms so that it can be >> integrated to the chain (closed loop). >> >> Do you think it is possible to do all the computation in Julia or would >> it be better to code some part in C/C++. What I fear the most is the GC but >> in our case we can pre-allocate everything, so once we launch the system >> there will not be any memory allocated during the experiment and it will >> run for days. >> >> So, what do you think? Considering the current state of Julia will I be >> able to get the performances I need. Will the garbage collector be an >> hindrance ? >> >> Thank you. >> >