|
mike mcfarlane wrote:
> > The main task won't get any time slice at all.
>
> NO time slice or just a very small chunk of time?
Digging through tm.c gave me the impression, that main will indeed get no
time slice. So I wrote another test program:
------------------------------------------------------------------------
#include <conio.h>
#include <unistd.h>
pid_t worker;
int work_task(int argc, char *argv[]);
int main()
{
int i;
i = 0;
worker = execi( work_task, 0, NULL, PRIO_NORMAL+4, DEFAULT_STACK_SIZE);
while( 1 ) {
lcd_int( i++ );
msleep( 10 );
}
return 0;
}
int work_task (int argc, char *argv[])
{
while( 1 )
;
return 0;
}
-------------------------------------------------------------------------
I get the "0", no further counting for some minutes. So I think that in
this situation, main indeed gets no more time slices.
> Also, what priority does this mean main() has?
If you look in kmain.c you see that main is execi-ed with PRIO_NORMAL.
> [...] just call one of my threads from main() and let it run as an
> infinite loop, ie, it will never return to main(), so main() can never
> exit.
So the called thread is not a thread anymore but a subroutine.
The best thing to get some knowledge of legOS is to dig through the
sources, even if one doesn't understand the whole thing ( I don't
understand the whole thing... ). Good books are the Andrew Tannenbaum books
on operation system design. Or Douglas Comer's book.
Mike
|
|
Message has 1 Reply: | | Re: More on threads
|
| (...) I recall that legOS's priority model is pretty rigid. If a thread with a higher priority never yields, threads with lower priority will never get any time. When I write legOS programs, I generally just have everything run at PRIO_NORMAL. That (...) (23 years ago, 19-Jan-02, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
| | Re: More on threads
|
| (...) ability to terminate but to run in an endless loop. But This is not true of an embedded system though which will have to run 'forever'. (...) priority of NORMAL+4. So, the (...) any time slice at all. NO time slice or just a very small chunk (...) (23 years ago, 19-Jan-02, to lugnet.robotics.rcx.legos)
|
18 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|