As for now, I have implemented a virtual memory with allocation mechanism, added concurrency and a basic transaction support.
Today I'm releasing a first version of this library, ie v0.1. This library can't do much yet, and if I'll have some time, I will start working on next version soon.
Library is open sourced, I'm hosting it on GitHub https://github.com/rkhmelyuk/memory. Documentation can be found in project's Wiki.
First memory should b allocated. There a few different allocators for this:
FixedMemoryAllocator
- to allocate a memory of fixed sizeDynamicMemoryAllocator
- to allocate a memory of dynamic size (with initial and max size specified)FileMemoryAllocator
- to allocate a memory mapped to file, supports both fixed and dynamic allocation
After memory is allocated, it can be used in application. The common workflow is to allocate spaces in this memory. Space represents a block of memory. This block will be not available for allocation till a space is freed. A space is like a window to specified block of memory: it can be used to read and write data at this block.
Spaces are thread-safe. This means that locking is used when read/write operation happens. For a single write operation there is no change other thread will read a corrupted data. For a multiple sequence read and write operation it's possible to use a transactional space currently. In the next version I plan to add a lock/unlock operation, so single client can lock and use space without a chance a space to be changed by other thread.
A simple example for the end of this post:
No comments:
Post a Comment