From mboxrd@z Thu Jan 1 00:00:00 1970 From: Miroslav Mickey Lazarevic Subject: Re: Clipper idle mode, usleep and alrm Date: Fri, 4 Jun 2004 09:52:53 +0200 Sender: linux-msdos-owner@vger.kernel.org Message-ID: <200406032058.27795.mickey@birosoft.com> References: <1084563055.3478.32.camel@peperina> Mime-Version: 1.0 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: In-Reply-To: <1084563055.3478.32.camel@peperina> Content-Disposition: inline List-Id: Content-Type: text/plain; charset="iso-8859-1" To: linux-msdos@vger.kernel.org On Friday 14 May 2004 21:30, Maximiliano Curia wrote: > Hello, > > I'm still working out a way to limit the cpu utilization of clipper > programs. > > The problem I'm looking now is that even if the usleep parameter is h= igh > enough (say JIFFIE_TIME*100), the process never stops eating cpu, nor > does completes it's sleep time. > > Doing an strace I see a lot of SIGALRM which, I presume, are waking i= t > up all the time. Could it be? > > I'm sure I'm missing something. Why you doing this when you have a Clipper library for this problem? Yo= u need=20 "nanfor.lib" with "cpmi.lib" and to put next line on top of your Clippe= r=20 program: =A0ft_onidle( { || ft_iamidle(30, .t.)}). This will reduce CPU= =20 utilization near 0% when clipper app is idle.=20 You can read about this from next document: -------------------------------------------------------------------- Nanforum Toolkit v3.05 Patch #1 =A009/06/96 -------------------------------------------------------------------- There have been some complaints that FT_IAmIdle() failed to release the CPU timeslice under certain conditions. =A0The problem occurred ONLY in protected mode applications, and ONLY under some operating systems (Windows NT was specifically mentioned, but others may be affected as well -- however, the problem does NOT appear to occur under Windows 3.1x, Windows 95, or OS/2). In addition, there have been less serious complaints that =46T_IAmIdle() did indeed release the timeslice, but was only marginally successful in doing so (e.g. during idle states, CPU usage dropped from 100%, but still remained high -- in some cases 60% or 70% which still had a negative effect on any other tasks that might be running concurrently). This patch addresses both of these problems by adding two OPTIONAL arguments to FT_IAmIdle(). =A0The new syntax is: =A0 =A0 =A0 FT_IAmIdle( [ ], [ ] ) is an optional numeric value that varies the intensity of the timeslice release. =A0The default is 1, and should be fine for most operating systems. =A0You can experiment with higher values to determine if you get better timeslicing (limited experimentation with Windows NT showed that values between 10 and 30 seemed to work pretty well). is an optional logical argument. =A0If a value of .T. is passed, FT_IAmIdle() will force the CPU to switch to real mode before releasing the time slice (this had a DRAMATIC effect under Windows NT). =A0The default is .F., which causes FT_IAmIdle() to remain in the current CPU mode when releasing the time slice. =A0In a real mode application this argument is ignored. Remember that both of these arguments are optional, and the default values were chosen so that the function would retain its previous behavior if the arguments aren't passed. =A0If you are not experiencing any problems with FT_IAmIdle(), just continue calling it as you do currently, and you can remain blissfully unaware of this patch. To apply the patch, just replace IAMIDLE.ASM in your NFSRC.ZIP with the attached IAMIDLE.ASM (if you downloaded the source code). Then, you need a library utlitity (LIB.EXE comes with many versions of DOS, and with most compilers, and can be downloaded from the MSL forum on CompuServe as S12776.ARC). =A0If you know what to do, simply replace the IAMIDLE.OBJ module with the new one that is included in this patch file. The procedure, for those not sure: 1. =A0Make a safe copy of NANFOR.LIB. =A0Hide it away. 2. =A0Change to the directory where NANFOR.LIB is located. 3. =A0Put IAMIDLE.OBJ in the same directory as NANFOR.LIB. 4. =A0Type =A0 =A0 =A0 =A0LIB NANFOR -+ IAMIDLE; That should do it. Remember to report all bugs in Section 16 of the CLIPPER forum! =A0If you have any problems, please contact me. Ted Means [73067,3332] --=20 Best regards, Mickey mickey@birosoft.com, mickey72@neobee.net - To unsubscribe from this list: send the line "unsubscribe linux-msdos" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html