The following exercises are for experimenting and learning Redux. Do not use any external library except rxjs
(it's optional and recommended).
Documentations:
Write your allocator. Allocate a big block of bytes and manage its allocations and deallocations by your self. For example, allocate an array of 20,000
bytes and divide it into 10 cells such that each cell contains 2,000
bytes. The user can allocate and free cells of 2,000
bytes whenever he wants.
Implement both the following APIs.
function allocate(howMuchBlocksToAllocate)
allocator.allocate(2)
// there will be a next-signal for each allocation
.subscribe(allocation => console.log(allocation));
function free(allocationId)
allocator.free("myAllocationId")
// there will be at most one next-signal after you freed the allocation.
// if the id represents an already-freed allocation, then there will be only a complet-esignal.
.subscribe(allocationFreed => console.log(allocationFreed));
function allocate(howMuchBlocksToAllocate,callback)
allocator.allocate(2,allocation => console.log(allocation));
function free(allocationId,callback)
allocator.free("myAllocationId",allocationFreed => console.log(allocationFreed));
The following exercise is going to be much more complicated, and its goal is to point about an unsolved problem. Your task is to understand the real problem. To understand it, you are going to implement the solution for the following problem:
-- soon --