I was trying to understand the internal data structure of FreeRTOS, specially how TCBs are maintained internally and how Kernel handle them based on multiple conditions.
I went through the code, but its difficult.
Please share the information or if you have any document, please share that.
The TCB is just a C data structure: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/master/tasks.c#L254
If you create a task using dynamically allocated memory, the TCB structure is allocated dynamically: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/master/tasks.c#L762
If you create a task using static memory allocation the memory used to hold the TCB is passed as a parameter into xTaskCreateStatic(): https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/master/tasks.c#L620
In both cases a task’s handle is a pointer to its TCB, although the pointer is made “opaque” to ensure the application using the handle can’t access the TCB members: https://github.com/FreeRTOS/FreeRTOS-Kernel/blob/master/tasks.c#L1077
Your question is a bit imprecise, so hard to answer. As Richard Barry said, TCBs are just C structures with information about tasks. FreeRTOS keeps tasks (via their TCBs) organized via a number of lists, there are lists of ready tasks at each task priority that are used for scheduling, there is a list of tasks that are currently blocked for a period of time, a list of task that are blocked for an indefinite period of time, and every queue/semaphore and the like have lists of tasks waiting to access the queue (either waiting for it to have an item or for room to be available).
Actually, I am trying to understand, how FreeRTOS maintains the list of all tasks, ready tasks etc, i.e the architecture of the data structure.
This is old but probably still valid and may help: http://www.aosabook.org/en/freertos.html#:~:text=FreeRTOS%20(pronounced%20%22free%2Darr,%2C%20and%20easy%20to%20use%22.