Distributed Memory implementation

tcak via Digitalmars-d digitalmars-d at puremagic.com
Tue Jan 19 03:56:38 PST 2016


On Tuesday, 19 January 2016 at 10:09:01 UTC, Ola Fosheim Grøstad 
wrote:
> On Monday, 18 January 2016 at 05:59:15 UTC, tcak wrote:
>> Is there anything like this in Phobos, or shall I start my own 
>> implementation?
>
> It isn't really clear to me what you are trying to do. IIRC the 
> C++ deque is usually implemented as an array of pointers to 
> fixed sized memory blocks.
>
> Is that what you are trying to achieve?

First of all, I have started implementation, and a part of 
implementation is completed.

For your question, I can explain it as follows:

Example I have 3 memory blocks.

Memory block 1: Ptr = 0x1000, Len = 100
Memory block 2: Ptr = 0x2000, Len = 5
Memory block 3: Ptr = 0x3000, Len = 150

Into the class FragmentedMemory, you append those three memory 
blocks. Then it provides you an interface like those three memory 
blocks are consecutive.

Let's say: fragmem[ 125 ] = 5;

Because the index 125 is in memory block 3, the value is written 
to memoryBlock3[ 20 ];
(125 = 100 + 5 + 20 )

Reading is in the same way. I think you can think about use cases 
on your side.

Currently, set, get, append operations are completed.

I will implement bulk memory copy and assign operations as well.


More information about the Digitalmars-d mailing list