h a l f b a k e r yMagical moments of mediocrity.
add, search, annotate, link, view, overview, recent, by name, best, random
news, help, about, links, report a problem
browse anonymously,
or get an account
and write.
register,
|
|
|
- DotNet has application domains. Communication
between each one requires serialisation and
deserialisation.
- If interdomain objects were stored in a seperate memory
space, shared by all appdomains, such
serialisation/deserialisation wouldn't occur.
- Objects would need to be "owned" by a
domain though,
to prevent errors.
- A simple example of this is of information flowing from a
network interface (in AppDomain A), through to a process
(in AppDomain B), another process (in AppDomain B), then
back again to the network inferface, through the other
domains.
- The simple example can be implemented by asking for a
large amount of unmanaged memory. The memory is
treated as an infinate circular address space. When data
is allocated it is taken from the end, when data is
deallocated, the space is marked as dead, and when a
consecutive set of dead space is straight after the start, it
is reclaimed, by moving the definition of start. So
AppDomain A, would create an array of received bytes, it
would pass the reference to AppDomain B, which after
processing would pass the reference to AppDomain C.
Eliminating, serialisation/deserialisaion between. The
memory access would need to be syncronised for thread
safety. Each appdomain would only need to deserialise.
- A more complicated version is to create the
SharedObject class which every inter-appdomain data
class needs to inherit. The unmanaged memory wrapper
would need to implement a GC similar to .NETs. On
construction the SharedObject class would obtain a
memory handle, the SharedObject. All primatives would
need to be reimplemented as SharedString, SharedInt
etc.. The outcome would be that, no deserialisation will
need to occur between appdomains either.
- Of course running out of memory in the first chunk of
allocated memory would require more being allocated,
then joined together to form a single logical block.
- I'm sure there's much more that would need to be done
but...
- This would be heaps easier if the CLR was simply coded
to support AppDomain SharedMemory.
[link]
|
| |