Please i need the help with three kernel code:tasks.c、queue.c、list.c

could someone explain to me task management, memory management, and scheduling methods in three kernel code
thank you for your help

This is an extremely broad question. Can you be more concise about what it is that you dont understand? This will make it easier to help you.

you may want to read the book: 161204_Mastering_the_FreeRTOS_Real_Time_Kernel-A_Hands-On_Tutorial_Guide.pdf

which should answer most of your questions.

1 Like

Hey @tarikkaoutar,

Thanks for posting in the FreeRTOS forum.

You can refer to the following quick links to get familiarized with those topics:

Please refer to the Mastering the FreeRTOS™ Real Time Kernel book (which is already posted in one of the answers) for understanding more on FreeRTOS and The FreeRTOS™ Reference Manual book for detailed information on related APIs.

If you have any more specific queries on any of those topics please update the thread.


thank you so much that is really helpful and thank you once again for guiding me and i appreciate that

1 Like

the question is I need to understand the source code of the kernel code for such a task.c , list.c and queue.c how the Task management, memory management and synchronization tool implement in kernel codes

Why do you need to reverse engineer FreeRTOS ?

Hey @tarikkaoutar,

For understanding the source code, probably the best way is to get familiarized with the functionalities that FreeRTOS offers and its APIs, which makes code walk through much easier.

Its still quite a broad question. It sounds like youre basically asking for somewhat of a crash course to understand the in’s and out’s of FreeRTOS? But there is a lot to be covered in such a course.

How much experience do you have with programming in general? This may help or hinder your ability to understand things to the level that you want.

Ive found the FreeRTOS source code to be quite easy to follow in general, so if you have some programming experience behind you, then you could read through the code for things like xTaskCreate() and vTaskStartScheduler() to see what FreeRTOS is doing under the hood to kick things off (its like learning how a magic trick is done).

Otherwise, as suggested, some initial high level understanding can be very useful so that you know in general what is supposed to be happening. When I was first learning about FreeRTOS, and other than the official documentation itself, I watched a bunch of videos on YouTube to help familiarise myself with how it works and how things interact (at a higher level). I found the videos like this one to be helpful: FreeRTOS Task & Queue tutorial - YouTube (there are more covering additional topics, just click through to the channel to find them).

After that I still had some questions, so I started reading through the source code and, admittedly, started writing a very simplified RTOS using FreeRTOS as inspiration to get some deeper questions answered (most significantly around task switching and how that is achieved). With all of that behind me the rest of my questions were answered through the documentation and/or source code, a bit of experimentation, trial and error, and the occasional question here when I really felt stuck on something (everyone has been very patient with my generally not-an-issue issues :smile:).

As Tom remarked appropriately, it depends a lot on your previous experience with coding/debugging.

For people familiar with C programming, list.c and queue.c should be straightforward to comprehend - all FreeRTOS code is written extremly well, and in those files, the “off-the-shelf in-and-out” function calling paradigm is followed.

The most intricate code to wade through is in tasks.c because that is where context switches and system-level synchronization (eg deferred context switching) comes into play. It takes a while to figure out how this differs from the traditional “in-and-out-of-a-function” model. After all, this is at the very heart of an RTOS by definition.

Again, you may first want to get familiar with FreeRTOS from an applicxcatin programmer’s point of view to work your way into the system. The book is a great resource for that kind of thing.

thank you so much, i’m a junior student in computer engineering I took the operation system course and the professor give FreeRTOS as the final project he wants from students to understand and get familiarised with code sources (kernel code) focusing on the three main code in the file ( tasks.c、queue.c、list.c) for example analyze task management, memory management, scheduling methods explain the code implementation and process in details.
I think the book is the best resource I could rely on and thank you for sharing I appreciate your for you helping and guiding me. it was nice of you

1 Like