Changeset 416 for trunk/libs/malloc.h
- Timestamp:
- Jan 4, 2018, 10:05:47 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libs/malloc.h
r412 r416 24 24 //////////////////////////////////////////////////////////////////////////////// 25 25 // General principles: 26 // - In user space th is HEAP zone has a fixed size, that spread between the27 // ELF zone and the STACK zone.26 // - In user space the HEAP zone spread between the ELF zone and the STACK zone, 27 // as defined in the kernel_config.h file. 28 28 // - The malloc library uses the mmap() syscall to create - on demand - 29 // up to one vseg per cluster. The size of these vsegs is defined by the 30 // MALLOC_LOCAL_STORAGE_SIZE parameter. 31 // - For a standard malloc(), the target cluster is the cluster of the client 32 // thread. For a remote_malloc(), the target cluster is explicitely defined 33 // by the arguments. 29 // one vseg in a given cluster. The size of this vseg is defined below 30 // by the MALLOC_LOCAL_STORE_SIZE parameter. 31 // - For a standard malloc(), the target cluster is the cluster containing 32 // the core running the client thread. 33 // - For a remote_malloc(), the target cluster is explicitely defined 34 // by the argument. 34 35 // - In each cluster, the available storage in virtual space is handled by a 35 36 // local allocator using the buddy algorithm. 36 // TODO : introduce the possibility to use a list of vsegs in each cluster... 37 // 38 // TODO : In this first implementation one single - fixed size - vseg 39 // is allocated on demand in each cluster. 40 // We should introduce the possibility to dynamically allocate 41 // several vsegs in each cluster, using several mmap when required. 37 42 //////////////////////////////////////////////////////////////////////////////// 38 43 // Free blocks organisation in each cluster : … … 43 48 // given list have the same size. 44 49 // - The NEXT pointer implementing those linked lists is written 45 // in the 4first bytes of the block itself, using the unsigned int type.50 // in the first bytes of the block itself, using the unsigned int type. 46 51 // - The pointers on the first free block for each size are stored in an 47 // array of pointers free[32] in the sto trage(x,y) descriptor.52 // array of pointers free[32] in the storage(x,y) descriptor. 48 53 //////////////////////////////////////////////////////////////////////////////// 49 54 // Allocation policy: … … 56 61 // and returns the block B if the list[actual_size] is not empty. 57 62 // - If the list[actual_size] is empty, it pop the list[actual_size * 2]. 58 // If a block B' is found, it break this block in 2 B/2 blocks, returns63 // If a block B' is found, it breaks this block in 2 B/2 blocks, returns 59 64 // the first B/2 block and push the other B/2 block into list[actual_size]. 60 65 // - If the list[actual_size * 2] is empty, it pop the list[actual_size * 4]. … … 73 78 // of the allocated block must be obtained from the base address of the block. 74 79 // - The number of entries in this array is equal to the max number 75 // of allocated block : MALLOC_LOCAL_STOR AGE_SIZE / MALLOC_MIN_BLOCK_SIZE.80 // of allocated block : MALLOC_LOCAL_STORE_SIZE / MALLOC_MIN_BLOCK_SIZE. 76 81 // - For each allocated block, the value registered in the alloc[] array 77 82 // is log2( size_of_allocated_block ).
Note: See TracChangeset
for help on using the changeset viewer.