Message-ID: <390DAFFD.7E4A3D36@mtu-net.ru> Date: Mon, 01 May 2000 20:25:33 +0400 From: "Alexei A. Frounze" X-Mailer: Mozilla 4.72 [en] (Win95; I) X-Accept-Language: en,ru MIME-Version: 1.0 To: Eli Zaretskii Cc: djgpp AT delorie DOT com Subject: Re: 3rd Try: Maybe an asm problem? (Problems linking) References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Recipient: eliz AT is DOT elta DOT co DOT il Reply-To: djgpp AT delorie DOT com Eli Zaretskii wrote: > > Just some kind of a synonym. :) > > Well, not really. Normally, Windows (or any other multitasker) waits for > some period of time before it preempts a program and switches to another > one. A call to __dpmi_yield causes Windows to reschedule immediately. Sure I know that. ;) But I don't know too much people who have more than 2 (or 3 max) DOS programs running at once. I run 2 ones at max myself. :) Maybe I should more? I need to figure out a new task for me that would need 3 V86 tasks... :) > > Do you bother about that while you're programming? I.e. do you write a custom > > keyboard read function that calls that thing? > > It depends. If I'm writing a program that is expected to sit idling for > long periods of time, then I generally build some kind of an idle loop > around `select' or `kbhit' with `__dpmi_yield' in the loop (`select' does > that automatically). As an example, look at the DJGPP-specific sources of > info.exe, where the keyboard loop is implemented. I put the same Int 2F (1680h function) call to my Norton Commander clone about 3 years ago just for fun, just to make the program almost fully correct. Dunno, maybe I should test it with and without that call under taskmanager which counts CPU time for each process? Just to see how much time is lost, if the program runs in background. But if a program is designed not to be run in background (a simple util or a game, for example), I think timeslice releasing is not needed. > > How about old DOS programs? Are you sure all they release timeslice? > > Old DOS programs usually called Int 28h, the DOS Idle Interrupt, while > they were waiting for input. This was used by resident software, such > as a disk cache, as a signal that it can e.g. flush its buffers. I know about residents too. > > I bet most of programmers don't bother about that because it's not a thing to > > worry too much about. > > You'd be surprised to know how many people are aware of programs which > use up CPU time while idling. There were quite a few threads in this > group started by people who payed attention to the CPU usage on their > Windows systems and complained when programs like RHIDE (in its old > versions) were using the CPU in their idle loop. I think playing games or doing other job on web-servers (or something like that) is a bit incorrect. If they ran all this stuff on home personal computers that don't need to do any time-critical job all the time, what was their problem? :) > The loss of CPU time is real: a program that runs in another DOS box will > take more time if some idling program doesn't release its slices while > doing nothing. > > So I think programmers do need to pay attention to these issues. Maybe you're talking about advanecd programmers only? How about an average programmer? -- Alexei A. Frounze ----------------------------------------- Homepage: http://alexfru.chat.ru Mirror: http://members.xoom.com/alexfru