Re: Re: Thread suspend when scheduler is locked.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 21/06/12 12:51, Sergei Organov wrote:
> Nick Garnett <nickg@xxxxxxxxxxx> writes:

>> Essentially locking the scheduler yourself is like running in a DSR,
>> there is only a limited number of calls it makes sense to use, and their
>> effects may be deferred until the scheduler lock returns to zero.
> 
> So, there is no way in eCos to just disable _preemption_? I.e.,
> (temporarily) switch from preemptive to cooperative multi-threading?

Not really. You could try implementing a new scheduler that only did
context switches when a yield function is called. If you disable
timeslicing and run all your threads at the same priority they will
essentially run round-robin and only lose the CPU when they explicitly
suspend, although higher priority threads will still preempt. But the
usual way to make a set of threads work cooperatively is to use a mutex
to serialize their execution.

Also note that the scheduler lock will also delay or block execution of
DSRs. Which is probably not what you want.

Trying to make eCos work as a cooperatively scheduled system is likely
to be more trouble than it is worth. It wasn't really designed to work
that way.



-- 
Nick Garnett                                      eCos Kernel Architect
eCosCentric Limited    http://www.eCosCentric.com      The eCos experts
Barnwell House, Barnwell Drive, Cambridge, UK.     Tel: +44 1223 245571
Registered in England and Wales:                        Reg No: 4422071

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



[Index of Archives]     [Linux Embedded]     [U-Boot V2]     [Linux Kernel]     [Linux MIPS]     [Linux ARM]     [Linux for the Blind]     [Yosemite]     [ISDN Cause Codes]     [eCos Home]

  Powered by Linux