From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3447 invoked by alias); 19 May 2008 05:32:31 -0000 Received: (qmail 3439 invoked by uid 22791); 19 May 2008 05:32:30 -0000 X-Spam-Check-By: sourceware.org Received: from defer-pm12.ocn.ad.jp (HELO defer-pm12.ocn.ad.jp) (122.1.234.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Mon, 19 May 2008 05:31:57 +0000 Received: from pop132.ocn.ne.jp (pop132.ocn.ne.jp [60.37.31.215]) by defer-pm12.ocn.ad.jp (Postfix) with ESMTP id C1DE12F58; Mon, 19 May 2008 14:31:54 +0900 (JST) Received: from ariga (p1110-ipbf5210marunouchi.tokyo.ocn.ne.jp [118.8.156.110]) by pop132.ocn.ne.jp (OCN) with SMTP id m4J5VrjU010162; Mon, 19 May 2008 14:31:54 +0900 (JST) Message-ID: <001901c8b971$a14202c0$1c0110ac@ariga> From: "ariga masahiro" To: "Andrew Lunn" Cc: References: <001001c85189$461611c0$1c0110ac@ariga> <4782BE28.8030706@mlbassoc.com> <000601c8750f$5ffb19b0$1c0110ac@ariga> <001001c87522$98475a50$1c0110ac@ariga> <000c01c8b72c$95df1bd0$1c0110ac@ariga> <20080516125053.GA27629@lunn.ch> Date: Mon, 19 May 2008 05:32:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="ISO-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook Express 6.00.2900.3138 X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] When or on what condition does "deschedule" happen? X-SW-Source: 2008-05/txt/msg00062.txt.bz2 Hello everyone, Thank you,Andrew, for your reply. There is one unclear point that I would make it clear. In explaning it ,let me use the scenario that Anthony J. Massa elaborate in his book "Embedded Software Development With Ecos". (supposing since I bought the book I don't infringe its licence) In case of Multilevel Queue Scheduler, three threads are created like next. ThreadC -- priority 30(lower) ThreadA,B -- priority 0(highest) - ThreadA - Timeslice - ThreadB -Deschedule - ThreadA - | | Preemption Deschedule | | ThreadC ThreadC Next is Anthony J. Massa's description. "three threads-Thread A, Thread B, and Thread C- are configured during creation of the threads at priority levels 0, 0, and 30, respectively. --- starts with Thread C executing. Next, Thread A becomes able to run, causing Thread C to be preempted and a context switch occurs. During the execution of Thread A, Thread B also becomes able to run. Thread A continues until its timeslice period expires. Then, another context switch occurs allowing Thread B to run. Thread B completes within its given timeslice period. The de-scheduling of a thread can happen for various reasons; for example, by waiting on a mutex that is not free or delaying for a specified amount of time. Since Thread A has the highest priority of tasks waiting to execute, a context switch occurs and it runs next. After Thread A has completed, a context switch takes place allowing Thread C to execute." My question is last part of Deschedule when ThreadC resumes execution. Am I correct in assuming that among your conditions, only two conditions should be fullfiled to make it possible for ThreadC to resume execution ? 1.When the thread blocks.(How does scheduler recognise this ?) 2.When a thread exits. If ThreadA does not finish and enter looping state,then isn't there any way for ThreadC to resume execution ? Please kindly forgive my ignorance and enlighten me. Thanks in advance. Masahiro Ariga > On Fri, May 16, 2008 at 05:12:30PM +0900, ariga masahiro wrote: >> Hello everyone, >> >> Please teach me about eCos Thread Scheduler. >> When or on what condition does "deschedule" happen ? > > When the thread blocks. > > When a higher priority thread becomes runnable. > > When a thread uses up its time slice and there is another thread of > the same priority which is runnable. > > When a thread calls yield and there is another thread of the same > priority which is runnable. > > When a thread exits. > > There is nothing unusual here. Any good book on operating systems will > teach you the same. > > Andrew > > -- > Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos > and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss > > > -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss