1 / 20

Memory Management

Memory Management. Functions. OSMemCreate() Create a partition OSMemGet() Obtaining a memory block OSMemPut() Returning a memory block OSMemQuery() Obtaining status of a memory partition. Memory Control Blocks of μC/OS-II. Memory Partition. Multiple Memory Partitions.

Download Presentation

Memory Management

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Memory Management

  2. Functions • OSMemCreate() Create a partition • OSMemGet() Obtaining a memory block • OSMemPut() Returning a memory block • OSMemQuery() Obtaining status of a memory partition

  3. Memory Control Blocks of μC/OS-II

  4. Memory Partition

  5. Multiple Memory Partitions

  6. Advantages of μC/OS-II • Disadvantages of malloc() • Fragmentation • Nondeterministic running time • Advantages of μC/OS-II • Avoidance of memory fragmentation • Allocation and deallocation a memory block is done in constant time

  7. List of Free Memory Control Blocks

  8. OSMemCreate() OSM_MEM *CommTxBuf; INT8U CommTxPart[100][32]; void main() { INT8U err; OSInit(); /*…*/ CommTxBuf = OSMemCreate(CommTxPart, 100, 32, &err) /*…*/ }

  9. OSMemCreate()

  10. OSMemCreate()

  11. OSMemCreate()

  12. OSMemGet() • You must not use more memory than is available form the memory block. • When you are done using the block, you must return it to the proper memory partition. • Pseudo code • Return a memory block • OSMemFreeList should point to the next memory block

  13. OSMemGet()

  14. OSMemPut() • You should note that OSMemPut() has no way of knowing whether the memory block returned to the partition belongs to that partition.

  15. OSMemPut()

  16. OS_MemQuery()

  17. Using dynamic memory allocation

  18. Using dynamic memory allocation

  19. A blocking system call

  20. A blocking system call

More Related