Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[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" <marko.lindqvist@xxxxxxxxxxx>
Date: Tue, 28 Jun 2005 08:54:03 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Benoit Hudson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13351 >
> 
> On Tue, Jun 28, 2005 at 01:59:32AM -0700, Per I. Mathisen wrote:
> 
>>>Would 2 processes be better than 2 threads? The AI could then be sent
>>>information in the same way as the clients (using the network code, but
>>>through a pipe).
>>
>>Then much of the AI code would have to be rewritten, since it depends on
>>being able to read server state directly. Much of the AI's data is not
>>accessible through the network interface.
> 
> 
> But the server code depends on no one reading its structures while it's
> updating them, so I'm not sure whether fixing the AI to be a seperate
> process is really any harder than fixing both AI and the server to lock
> structures appropriately.

  AI -thread is possible to make more gradually than AI -process. First 
protect huge blocks of code by mutexes and then make protected portions 
smaller and smaller. Of course, first versions would have no advantage 
over single thread model but only thread overhead. Only one thread is 
actually executing as other is waiting for mutex.
  What about portability? How difficult it is write thread 
implementation that works in linux/unix/windows/mac/...


  - ML





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