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

BOUNCE rtl@rtlinux.org: Approval required: Non-member submissionfrom ["Jonas Persson" <jonas.persson@comsys.se>] (fwd)



>From owner-rtl Fri Jun  1 03:31:05 2001
Received: from kanga.comsys.se (kanga.comsys.ideon.se [194.237.138.68])
	by hq.fsmlabs.com (8.11.2/8.11.2) with ESMTP id f519V4s15595
	for <rtl@fsmlabs.com>; Fri, 1 Jun 2001 03:31:04 -0600
Received: from zeta (zeta [192.168.0.9])
	by kanga.comsys.se (8.9.3/8.9.3/Debian 8.9.3-21) with SMTP id LAA11873
	for <rtl@fsmlabs.com>; Fri, 1 Jun 2001 11:25:47 +0200
From: "Jonas Persson" <jonas.persson@comsys.se>
To: <rtl@fsmlabs.com>
Subject: RE: [rtl] Weird scheduling problem
Date: Fri, 1 Jun 2001 11:23:47 +0200
Message-ID: <GBEBJEDLOFFHLCHJLHDLMEAICEAA.jonas.persson@comsys.se>
MIME-Version: 1.0
Content-Type: text/plain;
	charset="us-ascii"
X-Priority: 3 (Normal)
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0)
Importance: Normal
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
In-Reply-To: <20010529155728.B27017@hq2>
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by hq.fsmlabs.com id f519V5s15596

I am both both happy and sorry to say that I solved (happy) the problem, and it was a pointer error (sorry) in the statement next to the sem_post(s) in your example below. Of course I did small changes in the code every time I tried to understand the problem, which gave different error, and ultimately only confused me even more!

I should have learned by now, when I don't understand a thing of what is happening, it is usually a pointer error.... :-)

So: a very different question: can anyone recommend a tool for statically checking the correctness of a C program, specifically if all pointers and/or indexes of arrays ar initialized before use? This would be very useful, apart from adding -Wuninitialized to CFLAGS...

Cheers!
Jonas


______________________________________________________________________
 Jonas Persson                    E-mail: jonas.persson@comsys.se
 Project Manager, M.Sc C.Sc&E     http://www.comsys.se/
 Comsys AB                        Phone: +46-(0)46-286 3051
 Forskningsbyn IDEON              Fax: +46-(0)46-286 3505
 S-223 70 Lund, Sweden


-----Ursprungligt meddelande-----
Fran: owner-rtl@fsmlabs.com [mailto:owner-rtl@fsmlabs.com]For Victor
Yodaiken
Skickat: den 29 maj 2001 23:57
Till: rtl@fsmlabs.com
Amne: Re: [rtl] Weird scheduling problem


What version of RTLinux?
Can you describe the code in more detail?
Try with a simpler design

	A:
	while(1){
	         sem_wait(s);
		 do something 
		 }


       B:
                while(1){
		   do something
		   sem_post(s);
		   clock_nanosleep(CLOCK_REALTIME, ns2ts(10000));
		   }


On Tue, May 29, 2001 at 02:27:13PM +0200, Jonas Persson wrote:
> Hi all,
> 
> I have a strange scheduling problem. Let's say I have two (RTL-) threads, A and B, which interact in the following way - B, which has higher priority, calls sem_wait on a semaphore. Whenever A has one piece of data ready for B, A calls sem_post on the same semaphore. 
> 
> For whatever reason, when running this example A runs one cycle and so does B. But when I insert another module, being another RTLinux program, whenever usleep() is called from there, both A and B runs another cycle! 
> 
> Both A and B are periodic processes with the same periodicity, but only A make calls to pthread_make_periodic_np and pthread_wait_np since B waits for the semaphore and has higher priority than A.
> 
> Any thought appreciated!
> 
> Regards,
> Jonas
> 
> ______________________________________________________________________
>  Jonas Persson                    E-mail: jonas.persson@comsys.se
>  Project Manager, M.Sc C.Sc&E     http://www.comsys.se/
>  Comsys AB                        Phone: +46-(0)46-286 3051
>  Forskningsbyn IDEON              Fax: +46-(0)46-286 3505
>  S-223 70 Lund, Sweden
> -- [rtl] ---
> To unsubscribe:
> echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> --
> For more information on Real-Time Linux see:
> http://www.rtlinux.org/rtlinux/

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/