[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] En ordentlig timing



On Thu, 1 Nov 2001, Peter Aagaard Kristensen wrote:

> Hvis IO-Port Howto'en er korrekt så løser mit problem lidt sig selv.
> For hvis den serielle port (som nu engang er den jeg bruger) tager
> 1 ms om at skifte så får jeg det nok ikke til at køre hurtigere.
> Er der forresten nogen der kan bekræfte de 1ms forsinkelse på
> PC porte ?

Jeg ved ikke hvad du snakker om med at skifte, men Frank Damgård ved det
formentlig.

Mht. resten af diskussionen - hvis du vil vente så kort som 100 ns, så
giver det altså ikke rigtigt nogen mening at kalde nogen former for sleep
på en PC platform. Alene et trådkontekstskift koster dig omkring 2.7 us
på en 366 Mhz intel med linux, og en del mere under de fleste versioner af
Windows (jeg har målt det engang, men kan ikke huske de præcise tal).

Så, _hvis_ du vil lave det så kort, så busy wait.

> Både usleep og nanosleep er ikke meget bevendte.
> man nanosleep siger selv at dens præcisition kun kan tvinges ned
> på 2 ms i en tidskritisk tråd(v.h.a. busy wait), og så vidt jeg kunne
> måle passer det vist meget godt.

2ms for nanosleep? Det lyder af lidt meget. 

Det giver under alle omstændigheder ingen mening at kalde
nanosleep(100) med en forventning om andet end at sleep tiden >= 100
ns. Og, den vil formentlig være en skalafaktor større

Under Linux kører skeduleren måske heller ikke mere end 1 ms granularitet,
så det vil aldrig virke.

Mads

-- 
Mads Bondo Dydensborg.                               sslug@sslug
In a stinging rebuke, a federal judge Monday ruled Microsoft Corp. violated
the nation's antitrust laws by using its monopoly power in personal computer
operating systems to stifle competition.
                        - CNN Financial News April 03, 2000: 7:53 p.m. ET



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *