public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Semaphores and context switch
@ 2000-02-03  2:29 Daniel Kahlin
  2000-02-03  6:00 ` Nick Garnett
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Kahlin @ 2000-02-03  2:29 UTC (permalink / raw)
  To: ecos-discuss

I have 2 processes running at equal priority (MLQUEUE), and two semaphores
(sem1 & sem2) which are initially zero.

(1) Process 1 polls a semaphore (and some hardware) using
    cyg_semaphore_trywait(sem1).   Process 2 sets up a bunch of things,
    and then does cyg_semaphore_post(sem1), and cyg_semaphore_wait(sem2)

(2) Process 1 will eventually see the post, do some processing, and then
    do cyg_semaphore_post(sem2).

(3) Process 2 continues, and can use the data from process 1 if necessary.

Now, am I right in assuming that the context switch after
cyg_semaphore_wait(sem2) in (1) will occur at next tick instead
of exactly when cyg_semaphore_wait(sem2) is called?

The same goes for the cyg_semaphore_post(sem2) in (2), will the context
switch occur at the next tick or when the call is made?

Will this also apply to a cyg_thread_yield() ?

Q:
If this is so, how can I make the switch occur faster?
My current workaround would be increasing the tick rate.

Regards,
Daniel Kahlin

-- 
Daniel Kahlin                    <daniel.kahlin@netinsight.net>
Hardware System Designer         phone:  +46-8-685 04 00
Net Insight AB                   direct: +46-8-685 04 08
URL: http://www.netinsight.net   fax:    +46-8-685 04 20

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-02-03  6:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-03  2:29 [ECOS] Semaphores and context switch Daniel Kahlin
2000-02-03  6:00 ` Nick Garnett

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).