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: "Jason Dorje Short" <jdorje@xxxxxxxxx>
Date: Thu, 13 Jul 2006 11:02:14 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Marko Lindqvist wrote:

>>  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.

However, threading has that same problem.  You have to lock your global 
mutexes to protect the shared data before the AI can go to work, but 
many (not all) network operations will depend on these same mutexes. 
You have the exact same tradeoff: if the AI locks mutexes for a long 
time the network code has to block waiting for them, while reducing the 
lock length to get more fine-grained locking leads to a higher chance of 
bugs.

-jason





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