Giter Club home page Giter Club logo

tinyvmem's Introduction

TinyVMem

TinyVMem is a public domain implementation of the VMem resource allocator first described in the paper “Magazines and Vmem: Extending the Slab Allocator to Many CPUs and Arbitrary Resources”

Features

  • VMem, despite its name, is not limited to allocation of virtual address space; it can deal with any sort of interval scale (for example, PIDs).
  • Support for multiple allocation strategies such as best-fit and instant fit (constant time). Next-fit support is planned.
  • Reduced fragmentation.
  • Allows importing spans from other arenas.

Porting

TinyVMem is written in portable ANSI C therefore porting to a new platform should be easy enough. If you’re running on a freestanding environment, you need to define the __KERNEL__ macro and the following functions/macros:

/* Allocates 'n' pages */
void *vmem_alloc_pages(size_t n);

/* Locks a global lock (defined by the user) */
void vmem_lock(void);

/* Locks a global lock (defined by the user) */
void vmem_unlock(void);

/* From libc's string.h */
char *strcpy(char *restrict dst, const char *restrict src);

/* Assertion */
#define ASSERT(...) assert

/* Printf-like function, can be ignored if you're not going to call vmem_dump() */
#define vmem_printf(...) printf

You also need to have a complete implementation of sys/queue.h available. If not, I suggest you use netbsd’s.

todo

  • Implement support for next-fit allocation
  • Implement support for VM_NOSLEEP and VM_SLEEP

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.