Changeset 416 for trunk/libs/malloc.h


Ignore:
Timestamp:
Jan 4, 2018, 10:05:47 AM (6 years ago)
Author:
alain
Message:

Improve sys_exec.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libs/malloc.h

    r412 r416  
    2424////////////////////////////////////////////////////////////////////////////////
    2525// General principles:
    26 // - In user space this HEAP zone has a fixed size, that spread between the
    27 //   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.
    2828// - 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.
    3435// - In each cluster, the available storage in virtual space is handled by a
    3536//   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.
    3742////////////////////////////////////////////////////////////////////////////////
    3843// Free blocks organisation in each cluster :
     
    4348//   given list have the same size.
    4449// - The NEXT pointer implementing those linked lists is written
    45 //   in the 4 first bytes of the block itself, using the unsigned int type.
     50//   in the first bytes of the block itself, using the unsigned int type.
    4651// - The pointers on the first free block for each size are stored in an
    47 //   array of pointers free[32] in the stotrage(x,y) descriptor.
     52//   array of pointers free[32] in the storage(x,y) descriptor.
    4853////////////////////////////////////////////////////////////////////////////////
    4954// Allocation policy:
     
    5661//   and returns the block B if the list[actual_size] is not empty.
    5762// - 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, returns
     63//   If a block B' is found, it breaks this block in 2 B/2 blocks, returns
    5964//   the first B/2 block and push the other B/2 block into list[actual_size].
    6065// - If the list[actual_size * 2] is empty, it pop the list[actual_size * 4].
     
    7378//   of the allocated block must be obtained from the base address of the block. 
    7479// - The number of entries in this array is equal to the max number
    75 //   of allocated block : MALLOC_LOCAL_STORAGE_SIZE / MALLOC_MIN_BLOCK_SIZE.
     80//   of allocated block : MALLOC_LOCAL_STORE_SIZE / MALLOC_MIN_BLOCK_SIZE.
    7681// - For each allocated block, the value registered in the alloc[] array
    7782//   is log2( size_of_allocated_block ).
Note: See TracChangeset for help on using the changeset viewer.