Skip to content

Userspace incremental-only heap implementation #21

Description

@MartinUbl

The task here is to implement a heap for userspace. Every process may request an arbitrary amount of heap memory. The heap must be incremental-only; thus, no deallocation is required, only allocation.

The implementor is required to reduce the number of system calls for allocations, utilizing a standard library implementation of his/her own making. A simple way of achieving the reduction could be demonstrated as follows:

char* a = malloc(10); // user code requests 10 bytes, however, standard library pre-allocates 128 bytes - SYSCALL occurs
char* b = malloc(20); // user code requests 20 bytes, standard library still has 118 bytes left - no syscall
char *c = malloc(90); // user code requests 100 bytes, standard library still has 98 bytes left - no syscall
char *d = malloc(10); // user code requests 10 bytes, standard library has only 8 bytes left - SYSCALL occurs
// etc.

Thus, the implementor must implement:

  • syscalls for heap allocation (may be brk and sbrk, or a completely different approach)
  • syscall stub in userspace RTL
  • malloc() standard library implementation with at least a simple way of reducing system calls

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestkernelspaceKernel-relatedside questA task which, upon solving, yields the solver bonus pointsuserspaceUserspace-related (task, standard library, CRT0, etc.)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions