inter-process inlining
Ulf Wiger
etxuwig@REDACTED
Sat Nov 30 00:38:08 CET 2002
Just a thought that came to me while driving home.
The EUC talk "On reducing interprocess overhead
communication in concurrent programs" mentioned the idea of
inlining, where a client process could (in some cases)
directly fetch the server's state and perform the operation
needed without context switching.
Perhaps it's mentioned somewhere in the paper, but what
happens if there is a bug in the server code, and it
crashes?
>From the presentation:
Client code:
inc(Beta) ->
Beta ! {'++',self()},
receive
{Beta, Answer} ->
Answer
end.
Server code:
ref_server(V) ->
receive
{'++', From} ->
From ! {self(),V+1},
ref_server(V+1);
...
end.
The client could then be rewritten as:
inc'(Beta) ->
if ready(Beta) ->
B_V=get('V',Beta)+1,
save('V',B_V,Beta),
B_V;
true ->
inc(Beta)
end.
What happens for example if V in Beta is, say, an atom?
This will cause a runtime error, but normally, the server
Beta would crash, and the error message would include, among
other things, a backtrace, showing in which function it
crashed and how it got there. This is certainly one of the
benefits of Erlang: that error messages quite often give the
programmer enough information to quickly find the bug and
correct it.
Would the normal error indication be simulated even with
inlining, or would there be an entirely different error?
/Uffe
--
Ulf Wiger, Senior Specialist,
/ / / Architecture & Design of Carrier-Class Software
/ / / Strategic Product & System Management
/ / / Ericsson Telecom AB, ATM Multiservice Networks
More information about the erlang-questions
mailing list