This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: RE: RE: Playing with memory pool and timeouts ...


Thanks a lot Andrew and Jonathan.

So I understood that is current time added to number of ticks for
cyg_semaphore_timed_wait(). For the Posix mq_timedreceive, I think (but it's
really not sure) that it's the fonction itself which add the current time to
obtain an absolute time. It's how it works under Unix, I think so ... Am I
right ?

About the number of blocks to malloc (for mempool), I am always in doubt ...
I'm going to search in the ecos code but if you have an answer for me it
would be better.
I'm really lost when it's about memory. So help me please.


-----Message d'origine-----
De: Andrew Lunn [mailto:andrew.lunn@ascom.ch]
Date: mardi 1 juillet 2003 16:38
À: Matthieu.GIRARDIN@fr.thalesgroup.com
Cc: ecos-discuss@sources.redhat.com; andrew.lunn@ascom.ch
Objet: Re: Playing with memory pool and timeouts ...


On Tue, Jul 01, 2003 at 04:26:02PM +0200,
Matthieu.GIRARDIN@fr.thalesgroup.com wrote:
> Hi everybody !
> 
> Does someone know how to fill the last parametre of
> cyg_semaphore_timed_wait() ?
> Is it the number of ticks real (the system add itself the current
realtime)
> or must I pass 
> to this fonction, as parametre, realtime + nb_ticks ?

It takes the absolute time to wake up. So you want to pass something like

(cyg_current_time() + nb_ticks)  

> I have the same question for the posix fonction mq_timedreceive() with its
> structure timespec ...

I've never used the posix code. Im sure you can read the code and work
it out just as easily as i could....
 
> Another thing; Andrew answered me the number of extra blocks (to calculate
> the size to malloc for a 
> mempoolspace knowing the size we want) is :
> 	(size/blocksize) - ((size/blocksize/8/blocksize) + 1
> 								(Thanks a
> lot Andrew)
> but : 	1) He told me also, that it's underestimate by 1, so can I
change
> the "+ 1" by "+ 2" ?
> 	2) Is it really size/blocksize/8/blocksize ? Is it really a division
> of size by blocksize then
> 	a division by 8 the a division by blocksize ? For me it's the same
> thing with
> 		(size * 8) / (blocksize ² ), am I right ?

The best answer to this is to read the code! Once you understand the
code, you can work out your own formula. You can then tell me if i've
got it wrong (which is quite possible!).

      Andrew

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]