-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hi,
On 05.11.2014 04:18, Kevin wrote:
Thanks for your answer,
please always reply to the mailing list. The answers may also be interesting to other people.
Maybe my question is confused. I know the concept of class "Thread",It'sa runnable, schedulable activity, and a Task has many Threads, and Task is just some address spaces.
So, my question is: If there are many Tasks, for example, Task A and Task B, and I want each Thread of Task A has a higher priority than B's, what should I do?
Fiasco schedules threads in a priority-based, round-robin fashion. That means it always selects the thread with the highest priority (per CPU). If multiple threads with the same prio exist, they get equal shares of the CPU.
You can set a thread's priority upon creation using the l4_scheduler_*() system calls. There are examples of that in l4/pkg/examples - grepping for 'scheduler_' should do the trick.
Furthermore, you can also set the prio of threads within the Lua init scripts. For that purpose you do something like:
loader:startv({ caps = ..., log = ..., scheduler = L4.Env.user_factory:create(L4.Proto.Scheduler, 0x90, 0x80) }, ...);
This sets up a scheduler environment for your new program. The numeric parameters are max_prio and base_prio. When you later specify priorities using the scheduler interface in your program, the actual prio of your threads will be calculated:
prio := base_prio + selected_prio; if (prio > max_prio) prio := max_prio;
anyway, can we schedule these Threads by group? not just set the scheduling parameters of Thread one by one.
You need to set the scheduling parameters for every newly created thread separately. If you use the pthread interface, this will be done by the library and all threads will have the same prio. In combination with the Lua scheduler settings this might be what you want.
Bjoern