Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!hplabs!felix!fritz!marty From: marty@fritz.UUCP (Marty McFadden) Newsgroups: net.unix-wizards Subject: Re: busy looping in kernel, time question Message-ID: <698@fritz.UUCP> Date: Wed, 23-Apr-86 13:28:13 EST Article-I.D.: fritz.698 Posted: Wed Apr 23 13:28:13 1986 Date-Received: Sat, 26-Apr-86 03:15:47 EST References: <234@Shasta.ARPA> <14809@onfcanim.UUCP> <291@copper.UUCP> Reply-To: marty@fritz.UUCP (Marty McFadden) Organization: FileNet Corp., Costa Mesa, CA Lines: 23 In article <291@copper.UUCP> stevesu@copper.UUCP (Steve Summit) writes: >In article <234@Shasta.ARPA> alex@lancelot writes: >> >> Assume I want to busy loop in the kernel for 100 milliseconds, how >>many times (approx) should I go around a loop which increments an int? > > while(ryaddr->ryics & RY_TR) == 0); My advice is to be careful here!! The first question about how many times should one loop is NOT processor portable!! Say for instance, you decide to upgrade from a 68000 to a 68020 with cache. These 100 millisecond loops are no longer 100 milliseconds but can virtually take almost NO time at all :-) The second suggestion is okay, but I suggest that you also add some sort of timeout mechanism that comes along every few seconds or so and makes sure that you are not hung in that state. cheers. -- Martin J. McFadden {decvax, ucbvax}trwrb!felix!marty FileNet Corp. Costa Mesa, Ca.