English 中文(简体)
freeRTOS and parallel processing
原标题:

This is a simple question: Does freeRTOS handla multiple threads in multiple processes as the "real" Linux system does?

最佳回答

FreeRTOS is not Linux, nor does it pretend to be, although it is a cross platform standard kernel in its own right as it supports 26 different cores - but it is designed for microcontrollers not microprocessors. Most of those cores don t use an MMU though so there is no concept of a process. If you like, all the tasks are threads running in a single process . That is why I use the terminology task so as not to cause confusion. There are FreeRTOS versions that support the use of an MPU though, this allows memory partitioning and access rights like an MMU, but in a linear rather than virtual address space.

问题回答

FreeRTOS uses a simple priority scheduler, documented here.

I m not sure what you mean by handling threads like Linux does, but if every thread has the same priority, they should be allocated CPU time fairly.

No. (Free)RTOS generally don t have the same ideas of processes and threads as is used with a common GPOS like Linux. The term "task" is often used instead to avoid confusion.

That said, you might have a look at FreeRTOS coroutines, which are sort of execution-threads-inna-task in FreeRTOS.

Yes, rmmh is right that Tasks with similar priority will be allocated CPU time as well. This can be seen from the following website:

http://www.freertos.org/implementation/a00007.html

As an added point, FreeRTOS, as it s name suggests is a Real-Time Operating System. That being said, FreeRTOS can be configured to perform like a Time-Sharing System like that of Linux and vice-versa.

Hope that helped. Cheers!

Every process/thread/task has its own Stack. FreeRTOS allocates memory from the heap for that purpose. This is what FreeRTOS does when making a context switch from Task_A to Task_B: (1) Push all contents from the CPU registers to the stack of Task_A. (2) Make the CPU stack pointer refer to the stack of Task_B instead of Task_A. (3) The stack of Task_B has the CPU registers on top that represent the saved status of the CPU when Task_B was put to sleep. Now is the time to restore those values to the CPU registers. (4) Continue running Task B.

This context switch normally happens very regularly in FreeRTOS. In this way the FreeRTOS operating system can ensure that all Tasks with highest priority get a share of the CPU time. Tasks with lower priorities get CPU time when the higher priority Tasks cannot run, eg. when they are waiting for a Queue, Semaphore, ..

FreeRTOS does not support multi-cores - as far as I know. FreeRTOS generally runs on tiny microcontrollers that have just one CPU core.





相关问题
Signed executables under Linux

For security reasons, it is desirable to check the integrity of code before execution, avoiding tampered software by an attacker. So, my question is How to sign executable code and run only trusted ...

encoding of file shell script

How can I check the file encoding in a shell script? I need to know if a file is encoded in utf-8 or iso-8859-1. Thanks

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How can I use exit codes to run shell scripts sequentially?

Since cruise control is full of bugs that have wasted my entire week, I have decided the existing shell scripts I have are simpler and thus better. Here is what I have so far svn update /var/www/...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

热门标签