[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]
<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
|
|