Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2006:
[Freeciv-Dev] Re: (PR#13351) Meta-ticket: AI and threads
Home

[Freeciv-Dev] Re: (PR#13351) Meta-ticket: AI and threads

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: per@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#13351) Meta-ticket: AI and threads
From: "Marko Lindqvist" <cazfi74@xxxxxxxxx>
Date: Thu, 13 Jul 2006 10:48:15 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13351 >

On 7/13/06, Per I. Mathisen <per@xxxxxxxxxxx> wrote:
>
> Portability is the least of our worries. All relevant unix variants I know
> of support pthreads, including MacOSX, and adding Windows threading code
> support should be quite simple.

 As long as fcthread.h interface remains as simple as it was in my
patch, support for windows native threads is almost trivial.

>  we can just call the AI function to
> execute a few of these discrete operations while waiting for network
> packets. Or execute a few network packets while running the AI.

 Problem with this is that if executing AI function ever takes longer
than expected, there will be latency in network code. Even if overall
execution time of AI remains same, changing where certain function
gets called can cause unacceptable delays. I think this makes writing
new AI code even harder than threading would.
 Modifying existing code for either this model or threading model
would be equally hard.


> So I think using threads is neither necessary nor a good idea.

 Well, I do know that in the future AI needs to execute while humans
are moving. To be competitive with variant rulesets it simply needs
more CPU time and we cannot afford much more delay between turns to
execute AI.
 It might be possible to do in single thread between network packets,
as you suggested. At least it would be much easier to debug than two
threads model. But as I said, once either model is in place, further
development would be simpler in threads model. So I think threads
model is slightly better.


 - ML





[Prev in Thread] Current Thread [Next in Thread]