public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Nick Garnett <nickg@calivar.com>
To: ecos-discuss@ecos.sourceware.org
Subject: Re: [ECOS] Re: Thread suspend when scheduler is locked.
Date: Thu, 21 Jun 2012 12:48:00 -0000	[thread overview]
Message-ID: <4FE31826.1020801@calivar.com> (raw)
In-Reply-To: <jrv1rp$2t0$1@dough.gmane.org>



On 21/06/12 12:51, Sergei Organov wrote:
> Nick Garnett <nickg@calivar.com> 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

  reply	other threads:[~2012-06-21 12:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-20 18:23 [ECOS] " Sergei Organov
2012-06-21  9:00 ` [ECOS] " Sergei Organov
2012-06-21 10:33   ` Nick Garnett
2012-06-21 11:51     ` Sergei Organov
2012-06-21 12:48       ` Nick Garnett [this message]
2012-06-21 14:57         ` Sergei Organov
2012-07-01  2:45           ` Jonathan Larmour
2012-07-02 10:13             ` Sergei Organov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4FE31826.1020801@calivar.com \
    --to=nickg@calivar.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).