This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Where data structures are mostly used in embedded

Hi, 

       I want to know where data structures are highly required in microcontrollers of arm ?

Thanks.

  • Hi Sid,

    The question's scope seems to be little vast, so let me answer it from the embedded systems perspective and provide the resources for some self-learning

    1. Arrays - You might be aware of arrays being used widely for all kinds of storage purposes in the embedded codes etc., 

    2. Stacks - It's basically a FILO data structure where first input element comes out last, this datasturcutre is very widely seen in embedded systems with names like Function Call stack etc.. because when a function is called the stack pointer points to the function and when another function is called from there all these names are appended to a stack datastructure, something as shown below. Once the top function returns, it is popped from the stack and so on till the last function is executed. You can see the main function is called first and as you grow to top.

    3. Queues and Vring Buffers - Queue data structures are used majorly for any kind of peripheral data buffers like UART, DMA, etc., When you want to send data through the peripherals, they have a dedicated buffers setup for data storing and these will be shifted out on to the data lines, these are also called FIFO buffers and in the API definitions of the peripherals you could see the data being loaded into these buffers. Below is the snippet from UART driver code where you can see the FIFO buffers are being written.

    4. There are many other data structures like heaps, hashmaps etc., being used based on the usage and application requirements however above one's are some of the regularly used DS. Please refer to some of the resources on google as you can find many more use cases explained there ( I added some below)

    How Are Data Structures Useful In Embedded Systems? - PTInstitute

    Real-time application of Data Structures - GeeksforGeeks

    Hope this helps.