Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2001:
[Freeciv-Dev] Re: Threads!!??
Home

[Freeciv-Dev] Re: Threads!!??

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Jordan Crouse <jordanc@xxxxxxxxxxx>
Cc: rf13@xxxxxxxxxxxxxxxxxxxxxxxx, Freeciv developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Threads!!??
From: Jed Davis <jldavis@xxxxxxxxxxxxxx>
Date: 06 Feb 2001 21:17:39 -0500

Jordan Crouse <jordanc@xxxxxxxxxxx> writes:
> 
> Actually, threads are processes that haven't been completely spawned
> off.  Threads and processes both maintain their own
> stack and PC information (and are thus handled individually by the
> scheduler), but where processes are given their own memory space, 
> threads share the same memory as the calling process.  

\begin{pedant}

Not always.  Under the Mach microkernel, the task is really just the
unit of resource ownership (e.g. memory space, file descriptors); a
thread (a stack and processor state) is what actually executes
instructions.  The end result is in many aspects the same, but
starting a new thread is, implementation-wise, decidedly not a special
case of forking a new process.

\end{pedant}

In any case, having a shared memory space between the server and a
"client-side" AI maybe isn't very useful, because a client generally
doesn't need access to the server's data structures (and the protocol
tends to be designed with this in mind).  And if the client has its
own storage, relatively disjoint from the server's, then why not go
ahead and make it its own process?  And even separate processes can
share memory with the mmap() call, which is supported on most systems;
there's even a library (GPL, I think) to implement malloc() and
friends on top of it.

So, in conclusion: life is complicated.  (-:

--Jed

-- 
"But life wasn't yes-no, on-off.  Life was shades of gray, and rainbows
not in the order of the spectrum."   -- L. E. Modesitt, Jr., _Adiamante_




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