logoalt Hacker News

Panzerschrek • yesterday at 12:03 PM • 3 replies • view on HN

> A handler always runs to completion in a bounded amount of time

What if I want to start a computation and I can't reason how long it takes, so that the OS kills my program, because it spent too much time? In a traditional OS it's not a problem, it can interrupt my program at any moment and resume it later.

> An idle actor instance has no stack, and no register context to save

If I have no stack, what can I use to save program state? Do I need to mess with global variables for this?


Replies

timmisiak • yesterday at 5:39 PM

> What if I want to start a computation and I can't reason how long it takes

I wrote about that. It's the main weakness of this approach. You can solve it fairly easily for a linear style of task (decompression, encryption, etc.) because you can capture your state as a simple future. For cpu intensive recursive algorithms, it gets far messier.

> If I have no stack, what can I use to save program state? Do I need to mess with global variables for this?

All state is actor instance state. Kind of like any class based programming paradigm for an object not actively executing.

cowlevel • yesterday at 7:50 PM

I presume you could still make your own stack, and even save the stack pointer and program counter as part of your instance state?

dapperdrake • yesterday at 4:01 PM

How does he prove termination for boundedness in the general case?

Sounds like someone is still discovering the difference between the necessary assumptions for their wish to become true and the assumptions they are actually making.

➕ show 1 reply