No-Heap Event Handlers vs. No-Heap Threads

Async event handlers can do anything a thread can do, but only bound async events have (something like) a thread object of their own.

A no-heap real-time thread can

  • be placed in scoped memory and follow complex rules about references,

  • run in immortal memory and take pains not to leak memory, or

  • run partly in immortal and partly in scoped memory, which is easy if kept simple.

Unlike async event handlers, threads based in immortal memory have to contort themselves to be reusable. There is no way to change the run method on a thread.

Changeable run methods are a core technology for async event handlers. Somewhere under the hood, the system is hooking async event handlers to something like a thread and then ...

Get Real-Time Java™ Platform Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.