Subject: Re: Question: Lisp's power points
From: Erik Naggum <erik@naggum.net>
Date: Sun, 14 Oct 2001 21:55:46 GMT
Newsgroups: comp.lang.lisp
Message-ID: <3212085346119781@naggum.net>

* Roger Corman
| I just want to make a comment here.  Common Lisp does not specify how
| special variables interact with threads, so this is an area that is
| debatable.

  This is true, but extending the concept of special binding to threads is
  not a conceptual hurdle, it is more of an implementational hurdle.

| In my opinion an optimal implementation of per-thread special variable
| bindings does not require any re-binding.

  I was unspecific.  The design I had mind was threads managed by a single,
  monolithic process, but I did cover the case of separate processes, as
  well, those needing IPC and shared memory.  I.e., the process scheduler
  in the Common Lisp system, not the kernel, would have to do a context
  switch that would include saving and restoring the binding stack of the
  new context.  This is one of the drawbacks of having your own scheduler,
  but there are also serious drawbacks to using operating system threads
  and processes, especially when using shared memory for all the global
  _objects_, and that includes code.

| And if all those threads are active at once, no problem.  No context
| switching need occur.

  Well, context switching between threads at the operating system level is
  different from context switching between threads when privately managed.

| I can't see a reason for a thread to re-bind it, and then have all other
| threads see the binding.

  That was clearly not what I wanted to say, either.

| I think you would have multiple threads trying to undo each others
| bindings, possibly.

  Only if you assume a globally shared memory and operating system threads.
  I find it fascinating that you only consider those kinds of threads and
  not the well-known technique of managing multiprocessing privately.

///
-- 
  The United Nations before and after the leadership of Kofi Annan are two
  very different organizations.  The "before" United Nations did not deserve
  much credit and certainly not a Nobel peace prize.  The "after" United
  Nations equally certainly does.  I applaud the Nobel committee's choice.