X and idles => incredible slowdowns



Hello people,

I enclose a very simple test program that installs an idle routine for
drawing a moving window around the screen.

The problem is that when the program executes, the X Server gets an
horrible slow down. I mean, the mouse hardly responses to movements, and
the rest of X clients don't get much attention (they slow down a
lot) from the X server.

I have experienced this behaviour, not only with idle tasks, but also
with timeout tasks with a little timeout value.

My personal opinion is that I can recreate this ugly behaviour on the X
server whenever I send a lot of X requests (especially for drawing) from
a client (not only a GTK program). When this happens, the X server
becomes almost frozen (sometimes the Ctrl+Alt+Backspace combination get
scheduled to the server, but the response comes a minute later or
so...), and sometimes it hangs, or even worse, it seems to completely
hang my linux box.

I have tried the enclosed program over Windows 95 (with the GTK Win32
port), and Windows behaves very well indeed. No noticeable slow downs
here.

Now the questions:

Any other people has experienced this on their servers?.

If so, why is this? Is it a GTK related problem, or a X related problem
(I think is the last one)?

As you may notice,  if this is a generalized problem it's a very bad
thing for Linux, because if you have a rock-solid kernel, but then the X
server hangs the user interface, then the average user is going to see
Linux as another crasheable OS. Even worse, malicious X programs may
arise that hangs the interface and thus hanging the system. This is
bad... very bad...

Does anybody know a solution to this, or a solution in the future?.
(notice that I'm not using the new XFree 4.0 series).

However, if this is a X/XFree problem, could anybody tell the XFree team
about it? (It's a pity that the Xfree team doesn't have a mailing list
to talk about these things, or am I wrong?)

Thanks for you time...
#include <gtk/gtk.h>
#include <math.h>

int myidle(gpointer data)
{
  static double angle=0;
  double size=50*fabs(sin(5*angle));

  g_print("%f\n",size);

  gtk_widget_set_usize(GTK_WIDGET(data),(gint) size,(gint) size);
  gtk_widget_set_uposition(GTK_WIDGET(data),
	(gint) (400+100*cos(angle)),
	(gint) (300+100*sin(angle)));

  angle+=0.005;

  return TRUE;
}

int main(int argc,char **argv)
{
  GtkWidget *w;

  gtk_init(&argc,&argv);

  w=gtk_window_new(GTK_WINDOW_POPUP);

  gtk_widget_show_all(w);

  gtk_idle_add(myidle,(gpointer) w);

  gtk_main();

  return 0;
}




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]