comp.lang.ada
 help / color / mirror / Atom feed
From: Ludovic Brenta <ludovic@ludovic-brenta.org>
Subject: Re: confusion about message passing between the tasks
Date: Sat, 25 Oct 2014 09:13:04 +0200
Date: 2014-10-25T09:13:04+02:00	[thread overview]
Message-ID: <87lho4ei67.fsf@ludovic-brenta.org> (raw)
In-Reply-To: f5f92033-cca6-4f9d-ab21-c031e2d7fe89@googlegroups.com

compguy45@gmail.com writes:
> In those directories all example are graphics example. Which directory
> is one that creates N tasks?

The directories 1..5 all contain different versions of the same
graphical program.

Version 1: no tasks.

Version 2: N tasks, race condition when multiple tasks want to draw
using a shared graphics context.

Version 3: race condition solved by placing the graphics context in a
protected object. But the problem now, with 10_000 tasks, is excessive
virtual memory consumption (8 MiB of stack per task), which luckily does
not translate into physical memory usage, at least on Linux.

Version 4: Introduce a task queue.  Now the number of tasks is
independent on the number of rectangles.  But there is still a problem;
a deadlock exists when one task A finds that there remains a rectangle
in the queue but another task B gets to dequeue it first.  Then A tries
to dequeue the last rectangle but waits forever as the queue is now
empty.  As a consequence the master task waits forever for A to
complete.

Version 5: deadlock solved by a select statement.

-- 
Ludovic Brenta.


  reply	other threads:[~2014-10-25  7:13 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-24 16:44 confusion about message passing between the tasks compguy45
2014-10-24 18:39 ` Ludovic Brenta
2014-10-25  1:51   ` compguy45
2014-10-25  7:13     ` Ludovic Brenta [this message]
2014-10-24 23:49 ` Stribor40
2014-10-25  7:03   ` Ludovic Brenta
2014-10-25  7:58 ` Simon Wright
2014-10-25 13:01   ` compguy45
2014-10-25 14:11     ` Simon Wright
2014-10-25 17:25 ` Dennis Lee Bieber
2014-10-25 17:54   ` Jeffrey Carter
2014-10-25 22:23     ` Robert A Duff
2014-10-25 23:26       ` compguy45
2014-10-26  4:50         ` Dennis Lee Bieber
2014-10-26 10:20         ` Georg Bauhaus
2014-10-26  5:37       ` J-P. Rosen
2014-10-26  8:14         ` Pascal Obry
2014-10-26 15:47           ` J-P. Rosen
2014-10-26 20:27         ` Robert A Duff
2014-10-26 20:31           ` Robert A Duff
2014-10-26 20:36             ` Jeffrey Carter
2014-10-26 22:27               ` Robert A Duff
2014-10-26 23:23                 ` Jeffrey Carter
2014-10-27  0:46                   ` Robert A Duff
2014-10-27  2:18                     ` Jeffrey Carter
2014-10-27  7:51                     ` J-P. Rosen
2014-10-27  7:44             ` J-P. Rosen
2014-10-26 20:42           ` Dmitry A. Kazakov
2014-10-26 21:15             ` Brad Moore
2014-10-27  9:22               ` Dmitry A. Kazakov
2014-10-26 22:20             ` Robert A Duff
2014-10-27  7:40           ` J-P. Rosen
2014-10-25 23:42 ` compguy45
2014-10-25 23:55   ` compguy45
2014-10-26  0:24     ` Jeffrey Carter
2014-10-26  0:41       ` compguy45
2014-10-26 11:30         ` Brian Drummond
2014-10-26 15:40     ` Simon Wright
replies disabled

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