--
You received this message because you are subscribed to the Google
Groups "rt-thread-users" group.
To post to this group, send email to rt-thre...@googlegroups.com
To unsubscribe from this group, send email to
rt-thread-use...@googlegroups.com
while,
what's your issue? You can use timeout feature of mail box to handle this case.
Bernard
--
What's you request? There is a tx/rx in same time mode. Maybe you can check it on forum. Can you use Google translation to read Chinese?
,---. Rogerz Zhang ( @ @ ) Human, not octopus ).-.( Chase what you love and only that '/|||\` 人非章鱼·爱吾所爱 '|` AsciiArt < Shimrod(hh)
To post to this group, send email to rt-thread-users@googlegroups.com
To unsubscribe from this group, send email to
The polling thread is part of a library I am porting. It would take a substantial effort to rewrite it.I understand why it is not working which is why I was able to use an event object to work around the issue. And after looking through the code I see that the mailbox is working as designed. I was just expecting a faster mechanism for transferring control to a waiting thread. Such as preempting the current thread and resuming the thread waiting on the object without waiting for the next tick. Currently it's not enough to rely on the scheduler to prempt the current thread and resume a waiting thread, even it had higher priority it can still take up to 10ms (on a system with a 10ms tick).On the Mini2440 the Ehternet ISR sends a notification to a mailbox object but it can take up to 10ms (or more if there are higher or equal priority threads) before the waiting thread resumes. This forms a bottleneck and impedes the performance of the network. Not only is it slower than it should be but packets are lost once the buffer overflows.My "request" is simply for suggestions of how to improve the situation avoiding the 10ms limitation of the scheduler. I didn't write the
ethernet interface to Lwip but perhaps a mailbox is not the best mechanism to use here? Or perhaps a faster mechansim can be
implemented in RT-Thread? In most cases 10ms is adequate for a scheduler but in some cases a more immmediate context switch is required.
This library I am porting expects to timeout after waiting 500us for a reply packet and if one has not been received it resends it's request. I have implemented a timer with less then 1us resolution but if the thread yields it may not run again until the next tick.
Yes, the scheduler has no relationship with os tick. The os tick is used for timeout and same priority thread scheduling.
The possible thing is, there are some high priority thread exist in your system, or your process thread has another thing to handle and not waiting on an event object.
Please show your code for details information.
I don't pretend to be an expert on RT-Thread but I'm learning, despite the lack of documentation, so it is possible I could be doing something wrong. I post to this forum to provide a little assistance to the developement of RT-Thread where possible as well as to get a little help when things don't work as expected. I get the feeling some people get defensive and even slightly hostile when I suggest something doesn't work as expected. I'm not here to offend.
As far as a relationship between the scheduler and system tick, you say in one sentence there is no relationship and in the next sentence describe the relationship. The system tick calls rt_tick_increase which decrements the current thread's remaining tick count and when it reaches zero the thread yields and rt_schedule is called. I call that a relationship. The smallest timeslice is 1 tick. Although I don't fully understand how the timeslice is supposed to work, for instance if the thread yields before it's timeslice expires the next time it resumes it's remaining_tick count is not reset so it will only run for the remainder of it's timeslice.
In any case, sending to a mailbox resumes the waiting thread and calls the scheduler but there is no guarantee as to when the waiting thread will actually get executed. Also, in the context of an ISR such a context switch is not desireable until the ISR has returned.
As for posting code, you already have it, just start up a thread that remains busy for a period of time (a few ticks) and connect the device to a network with some traffic and see how long before the NIC (ie. DM9000) overflows as received packets are not processed quickly enough.
I don't pretend to be an expert on RT-Thread but I'm learning, despite the lack of documentation, so it is possible I could be doing something wrong. I post to this forum to provide a little assistance to the developement of RT-Thread where possible as well as to get a little help when things don't work as expected. I get the feeling some people get defensive and even slightly hostile when I suggest something doesn't work as expected. I'm not here to offend.As far as a relationship between the scheduler and system tick, you say in one sentence there is no relationship and in the next sentence describe the relationship. The system tick calls rt_tick_increase which decrements the current thread's remaining tick count and when it reaches zero the thread yields and rt_schedule is called. I call that a relationship. The smallest timeslice is 1 tick. Although I don't fully understand how the timeslice is supposed to work, for instance if the thread yields before it's timeslice expires the next time it resumes it's remaining_tick count is not reset so it will only run for the remainder of it's timeslice.
In any case, sending to a mailbox resumes the waiting thread and calls the scheduler but there is no guarantee as to when the waiting thread will actually get executed. Also, in the context of an ISR such a context switch is not desireable until the ISR has returned.
As for posting code, you already have it, just start up a thread that remains busy for a period of time (a few ticks) and connect the device to a network with some traffic and see how long before the NIC (ie. DM9000) overflows as received packets are not processed quickly enough.
在 2012-12-7 下午4:14, <rd...@iinet.net.au>写道:
>
> No apologies necessary, I just don't want to be offending anyone. I might appear as someone who only shows up when he has something to complain about, but I try to contribute as well.
>
> My apologies for the long post ...
>
> An example:
>
> Mini2440 BSP:
>
> void test_thread_entry(void* parameter)
> {
> /* Allow time for initialisation to complete */
> rt_thread_delay(rt_tick_from_millisecond(2000));
> rt_kprintf("Starting loop\n");
> while(1);
> }
No, no.
A thread must be designed to avoid running all the time. It must suspend or block on some thing. If this thread is running with a highest priority, the system can not hand anything except interrupt.
This was an extreme example to demonstrate the issue. The thread is low in priority and other threads do execute, the shell is responsive, etc. The tick interupt is calling the scheduler. But in any case the call to mb_send is interrupt driven and calls the scheduler which should switch to the thread waiting on the mailbox. In this example this never happens.
Rob
Rob--