[ECOS] Time slice is not happening quiet alright

Nick Garnett nickg@ecoscentric.com
Fri Aug 30 16:00:00 GMT 2002


"Mike A" <embeddedeng@hotmail.com> writes:

> So, You mean that there is some code within printf that blocks the
> scheduler (something like a schedule_lock), or which prevents the
> running task from giving up the CPU.
> Wonderful!

No, you have misunderstood. The eCos C library is thread safe, so
whenever an IO operation takes place, such as prinyf(), a lock
associated with the stream is taken. Any other thread that tries to do
IO on the same stream will be blocked until the first thread releases
it. This is standard mutual exclusion. Any thread that is not doing IO
on that stream is not affected in any way.

In your program's case, both your threads got serialized by the lock
on the standard IO stream. Giving the non-intuitive results you saw.

> 
> Now one more question.
> Is there a document that talks about this? If there is let me know.
> 

Nothing explicit. This is standard C library behaviour.

-- 
Nick Garnett - eCos Kernel Architect
http://www.eCosCentric.com/


-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss



More information about the Ecos-discuss mailing list