[gameprogrammer] Re: What do the new processors mean for game programming?

  • From: Petri Latvala <adrinael@xxxxxxxxxxxxxxx>
  • To: gameprogrammer@xxxxxxxxxxxxx
  • Date: Wed, 2 Mar 2005 00:15:43 +0200

On Tue, Mar 01, 2005 at 03:46:03PM -0600, Bob Pendleton wrote:
> It seems to me that most programming languages currently in use have
> little to no built in support for multithreaded programming. Java is the
> only one I can think of. Are you folks thinking about how to make use of
> multiple processors in your games? What approaches are you using? What
> libraries? Are any libraries really designed to help?
I use Common Lisp, mainly, for my projects and I use threads fairly
heavily. I'm in the process of creating a network game server, and I
chose the threading approach for network handling as opposed to one
based on select(), for a few reasons. One is precisely what you said
about processors. I have for a while waited anxiously for the world to
realise that the key to performance isn't increasing frequency
anymore, but increasing processor amounts. Another reason is that I
didn't find a sane way to select() with the libs I use =)

And even then the select() approach (for small number of connections)
only means you do the same scheduling as threads would do
automatically for you, but without race conditions or deadlocks...

I use sbcl (http://www.sbcl.org) as the compiler, and sb-threads as
the threading lib. Threading fits into Common Lisp like a
glove. Anonymous functions make starting threads simple as pie:

(sb-thread:make-thread (lambda () <code here>))

And the usual Lisp syntax for holding a resource for the duration of a
code block:

(sb-thread:with-mutex (somemutex)
   <code here>)

Of course, some knowledge about concurrent programming is
mandatory. No library can protect you from race conditions. A library
may protect you from deadlocks, but only to some extent, and even then
only to tell you that you have a bug that needs fixing.


--
Petri Latvala


-- Attached file included as plaintext by Ecartis --
-- File: signature.asc
-- Desc: Digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFCJOmPRgYfIWb4VLIRAiXnAJ952ppVGx8a8r6fGpb+oPtZzhhd3wCeIjnj
pZ8Fjk6k0Fid65DWB5leBso=
=2pEl
-----END PGP SIGNATURE-----




---------------------
To unsubscribe go to http://gameprogrammer.com/mailinglist.html


Other related posts: