comp.lang.ada
 help / color / mirror / Atom feed
* High CPU in tasking
@ 2004-06-24 15:43 Lutz Donnerhacke
  2004-06-24 17:00 ` Nick Roberts
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Lutz Donnerhacke @ 2004-06-24 15:43 UTC (permalink / raw)


In order to stop others falling into the same mistake, I debugged several
days.

I wrote an data stream decoder and output (via TCP) manifolder using Ada
tasking and a protected ringbuffer. The whole application word fine, but the
CPU load increased linear on input load and dramatically over the number of
output queues.

Debugging turned out:
  - Every writing to the ringbuffer wakes up all reader tasks.
  - That's why the reader buffers were filled with only the little data amount
    just written.
  - Tasking overhead caused the CPU load.

Two solutions (used both):
  - The ringbuffer got a minimum reading length => Fewer wakeups.
  - The writer task collect a lot of data before writing
    => Fewer checks for wakeup.

The ratio of tasking events before and after the change is about 30:1.

Conclusion:
  When implementing tasking synchonisation with protected objects,
  keep in mind, that the standard Ada tasking model generates a near real
  time experience, which is mostly not required.

HTH



^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2004-07-01  7:02 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-24 15:43 High CPU in tasking Lutz Donnerhacke
2004-06-24 17:00 ` Nick Roberts
2004-06-24 20:25   ` Lutz Donnerhacke
2004-06-24 21:56     ` Nick Roberts
2004-06-25  7:34       ` Lutz Donnerhacke
2004-06-25 17:03         ` Nick Roberts
2004-06-28  8:32           ` Lutz Donnerhacke
2004-06-29 17:26             ` Nick Roberts
2004-06-30 12:26               ` Lutz Donnerhacke
2004-06-30 23:39                 ` Randy Brukardt
2004-07-01  7:02                   ` Lutz Donnerhacke
2004-06-25 21:15 ` Mark Lorenzen
2004-06-26  8:01 ` Wojtek Narczynski
2004-06-28  8:17   ` Lutz Donnerhacke

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox