Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cbmvax!daveh From: daveh@cbmvax.commodore.com (Dave Haynie) Newsgroups: comp.sys.amiga.tech Subject: Re: Micro Timing Critical sections HELP! Message-ID: <14567@cbmvax.commodore.com> Date: 20 Sep 90 18:56:51 GMT References: <4934@uqcspe.cs.uq.oz.au> Reply-To: daveh@cbmvax.commodore.com (Dave Haynie) Organization: Commodore, West Chester, PA Lines: 55 In article <4934@uqcspe.cs.uq.oz.au> thyssen@batserver.cs.uq.oz.au writes: > I calculated that the `E' line should be runing at .715Mhz (1/10th >of cpu clock rate) and physical measurments (a stop watch over ~20mins) >give a figure of .709 +/- .001 Mhz (3 measurements were made). You're right, actually, on both accounts. If you have a PAL machine, the CPU clock is 7.09MHz, so you get a 0.709MHz E clock. If you have an NTSC machine, you have a 7.159MHz CPU clock, which results in a 0.716MHz E clock. > Timing a fixed loop of code (see below) however produced varing >results which I beleave is due to the interupt handling of the CPU. There are a variety of reasons why any arbitrary chunk of code will take varying amounts of time to execute. The most obvious reason is that Amiga CPUs vary from 7.09MHz 68000s to 50MHz 68030s. Thus, the policy that no CPU-speed dependent code is permitted in Amiga applications starts to make some real-world sense. If you need timing, use a timer, which will be at least reasonably consistent (like, within 1% or so) between all Amigas. >QUESTIONS :- > 1) What is the differance bettween Disable-Enable > and Forbid-Permit exec library calls? Forbid()/Permit() disables multitasking -- it lets you hog the CPU, for whatever reasons. In general, the only valid reason for this is that you have a chunk of code that's examining some shared data structures that aren't locked by a semaphore. Disable()/Enable() turn off all interrupt processing, which as a result also happens to disable multitasking. Some I/O devices will use this, but there's just about no situation in which an application program will use these functions. > 3) Is there any other interupts which can be disabled? How? Disable()/Enable(), by definition, will disable all valid interrupts. Or, to invert this argument, interrupts that don't get disabled by Disable() aren't supported by the AmigaOS. The only such interrupts you could get that are members of this class are expansion-board-generated INT1*, INT4*, INT5*, or INT7* on an A2000. > 4) Under the above can memory still be allocated/deallocated - Important? Memory can be allocated and freed during a Forbid(), and I believe during a Disable() as well, though I have never used that one myself. > Anthony Thyssen - (Dragon Computing!) thyssen@batserver.cs.uq.oz.au So you know your dragons. Think of the OS as you walking down the road, unarmed. Forbid() would be like your average angry Wyvern meeting you on this road. Disable() is more like Smaug or Tiamat coming along to greet you. -- Dave Haynie Commodore-Amiga (Amiga 3000) "The Crew That Never Rests" {uunet|pyramid|rutgers}!cbmvax!daveh PLINK: hazy BIX: hazy Get that coffee outta my face, put a Margarita in its place!