# Limits; for e.g. \[hard\] real-time (and for stacks)

**URL:** <https://discourse.julialang.org/t/limits-for-e-g-hard-real-time-and-for-stacks/106167>\
**Category:** Offtopic\
**Created:** [November 14, 2023, 12:10am UTC](https://discourse.julialang.org/t/limits-for-e-g-hard-real-time-and-for-stacks/106167 "2023-11-14T00:10:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [November 14, 2023, 12:10am UTC](https://discourse.julialang.org/t/limits-for-e-g-hard-real-time-and-for-stacks/106167/1 "2023-11-14T00:10:47Z")

</div>

A.  
I just learned of RLIMIT\_RTTIME and SIGXCPU (and another intriguing RLIMIT\_STACK):  
[https://man7.org/linux/man-pages/man2/getrlimit.2.html](https://man7.org/linux/man-pages/man2/getrlimit.2.html)

> <https://stackoverflow.com/questions/15697410/sigxcpu-error-in-c-program>

and while I’m sure Julia doesn’t support it, I’m thinking could it and how? I suppose in your app, you could catch SIGXCPU RLIMIT\_STACK somehow, but I’m thinking most GC languages aren’t used for real-time, and in Julia you do it by avoiding the GC.

Could and should Julia respond to that signal by running GC, or would it only make the problem worse? Do any GC languages do hard-real time GC in that way?

B.  
Julia like all languages can blow the stack, why I found RLIMIT\_STACK intriguing. The answer is not doing that, and maybe increasing the stack size so that it’s less likely to happen. But I didn’t know you could do anything if that actually happens. I think it’s rare that languages or programs support that.

I do see Python supports setting (and getting) all kinds of limits, though I think just for the next process, and very much doubt it’s for Python itself, i.e. that Python tries to respect it for itself (or the next Python process it spawns).

> **[resource — Resource usage information](https://docs.python.org/3/library/resource.html)**
>
> This module provides basic mechanisms for measuring and controlling system resources utilized by a program. Availability: Unix, not Emscripten, not WASI. Symbolic constants are used to specify part...

C.  
Yet another limit, what got me interested looking into and finding the others:

> <https://github.com/JuliaLang/julia/pull/51656#issuecomment-1757741053>
>
> We should probably respect \`RLIMIT\_AS\`, which was the posix standardized way to …set constraints, before cgroup2 invented its own convoluted mechanism of query, but the MemBalance paper proved that applying max physical memory as a limit guarantees Pareto-suboptimal performance and memory utilization both for the system as a whole and the application in particular, so that seems undesirable.

---

<div class="post-metadata">

**Author:** ![Benny](https://avatars.discourse-cdn.com/v4/letter/b/49beb7/32.png) [@Benny](https://discourse.julialang.org/u/Benny)\
**Post date:** [November 14, 2023, 1:00am UTC](https://discourse.julialang.org/t/limits-for-e-g-hard-real-time-and-for-stacks/106167/2 "2023-11-14T01:00:34Z")

</div>

> [@Palli](#):
>
> Do any GC languages do hard-real time GC in that way?

Java has options, though apparently even in realtime applications there are several options before you’d resort to handling a realtime GC.

> <https://stackoverflow.com/questions/217565/what-deterministic-garbage-collection-algorithms-are-out-there/11173870#11173870>

> [@Palli](#):
>
> Could and should Julia respond to that signal by running GC

Not what we have now.
