AES evnt_multi with MiNT: Busy waiting?

AES evnt_multi with MiNT: Busy waiting?

Post by Wolfram Roesl » Thu, 12 Mar 1992 07:09:30



Hi,

it seems that AES applications do busy waiting when using evnt_multi
calls under MiNT... other processes (e.g. top running on a terminal)
seem to get no cpu time while the application is waiting for an event.
Using Fselect before evnt_keyb is easy, but how about evnt_multi
waiting for msg events? Is there any way to put an application to
sleep entirely while waiting for an event?

Could it help to write an acc that executes Syield every time it
gets control via AES?

I hope you can help me...
Wolfram
--
Wolfram Roesler            Augustastr. 44-46            W-5100 Aachen

 
 
 

AES evnt_multi with MiNT: Busy waiting?

Post by Jens Kili » Thu, 19 Mar 1992 21:06:37


Not exactly related to the theme of this thread, but of a similar nature:

When browsing through the MW source code, I noticed that MW also constantly
burns CPU time. It listens for AES events, including the timer event, and
*only* when a timer event happens (with no other AES events thrown in) does
it condescend to Fselect() the pipes to the processes it manages.

After some heavy thinking (`*Why* does Alan Pratt do such a thing'), I came
to a rather depressing conclusion. Since MiNT knows nothing of AES, and AES
nothing of MiNT, I can see no way to wait for either an AES event or a
file descriptor getting ready for IO *at the same time*.

Let's hope that Atari does this right in MultiTOS (though knowing Atari,
I wouldn't bet on it ...)

        Jens.
--


Phone: (0|+49)7031-14-1726            TELNET : 778-1726
Fax  : (0|+49)7031-14-2049
-------------------------------------------------------------------------------
As the air to a bird, or the sea to a fish, so is contempt to the contemptible.

 
 
 

1. AES evnt_multi with MiNT: Busy

 >it seems that AES applications do busy waiting when using evnt_multi
 >calls under MiNT... other processes (e.g. top running on a terminal)
 >seem to get no cpu time while the application is waiting for an event.

This is because the current AES runs in supervisor mode and MiNT doesn't do
any taskswitches while the CPU runs in that mode. Most GEM applications
almost only run in AES during their main event loop ...

 >Could it help to write an acc that executes Syield every time it
 >gets control via AES?

Yes, exactly. Since from MiNT's point of view accessories are part of the
GEM process, this gives MiNT the opportunity to switch tasks while the AES
is running. You can do this by installing a small accessory like the one
below (which is written with Turbo-C).

Stephan.

/*************************************************************************/
#include <aes.h>
#include <tos.h>
#include <mintbind.h>

#define INTERVAL 40 /* approx. Syield() interval in ms */

typedef struct
{
    long tag;
    long value;

void main(void)
{
    void *ssp;
    COOKIE *jar;
    int msg_buf[8];

    appl_init();

    ssp = (void *)Super(0L);
    jar = *((COOKIE **) 0x5a0L); /* fetch cookie jar pointer */
    Super(ssp);

    if (jar) {                   /* first see if MiNT is installed */
        while(jar->tag) {
            if (jar->tag == (long)'MiNT')
                for(;;) {        /* MiNT cookie found --> enter event loop */
                    evnt_timer(INTERVAL, 0);
                    Syield();    /* let MiNT do a taskswitch */
                }
            jar++;               /* else inspect next cookie */
        }
    }                            /* MiNT not installed */
    for (;;)                     /* accessories must not terminate ... */
        evnt_mesag(msg_buf);

---
Stephan Baucke, Pontstr. 1-3, D-5100 Aachen, Germany

2. SORRY!!!! GEEZ!!!!

3. Non busy-wait disk IO on the ST.

4. 3D Analyst VRML enhance

5. Waiting for N.AES!?

6. Who wants to help me create a dual boot FAQ?

7. For those in the U.S. waiting and waiting for Expose......

8. Where's Atari World

9. MiNT/MagiC/AES advice needed

10. booting MiNT 98 and N.AES. HOW?

11. net problems under Mint/Aes

12. Oasis and N.AES/MiNT/MiNTnet?

13. Mint & AES Problems