|
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: ![](/news/x.gif) | | 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 (...) (22 years ago, 19-Jan-02, to lugnet.robotics.rcx.legos)
|
Message is in Reply To:
![](/news/x.gif) | | 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 (...) (22 years ago, 19-Jan-02, to lugnet.robotics.rcx.legos)
|
18 Messages in This Thread: ![threads -Mike McFarlane (14-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![Re: threads -Mike McFarlane (15-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/246.gif) ![Re: threads -Albert Huang (15-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![Re: threads -Mike McFarlane (16-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![Re: threads -Albert Huang (16-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![Re: threads -Mike McFarlane (17-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: threads - bug in the firmware? -Mike McFarlane (16-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/246.gif) ![Re: threads - bug in the firmware? -Eric Swalens (16-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: threads - bug in the firmware? -Michael Obenland (17-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/246.gif) ![Re: threads - bug in the firmware? -Mike McFarlane (17-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/268.gif) ![Re: threads - bug in the firmware? -Ross Crawford (17-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![Re: threads - bug in the firmware? -Mike McFarlane (18-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![Re: threads - bug in the firmware? -Ross Crawford (21-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif)
![](/news/x.gif) ![](/news/x.gif) ![](/news/68.gif) ![Re: threads - bug in the firmware? -Michael Ash (18-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![More on threads -Michael Obenland (18-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![Re: More on threads -Mike McFarlane (19-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif) ![](/news/46.gif) ![You are here](/news/here.gif) ![](/news/46.gif) ![Re: More on threads -Michael Ash (19-Jan-02 to lugnet.robotics.rcx.legos)](/news/x.gif)
- 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
|
|
|
|