unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Mikael Djurfeldt <djurfeldt@nada.kth.se>
Cc: marius.vollmer@uni-dortmund.de
Subject: Warning: Unstable POSIX threads support comitted to CVS
Date: Mon, 09 Dec 2002 14:44:47 +0100	[thread overview]
Message-ID: <xy77kej71dc.fsf@nada.kth.se> (raw)

[-- Attachment #1: Type: text/plain, Size: 2551 bytes --]

Hi,

Based on Marius copt threads work, I've now put together an initial
version of full POSIX threads support with preemptive thread
scheduling.  This is especially good to have if you, like me, use
multi-cpu machines.

Attached to this letter is an example program:

  par-fib N DEPTH --> fibonacci number N

The number is computed by forking to DEPTH levels.
For example, (par-fib 100 4) creates 31 threads (with 16 threads at
the base level, reverting to iterative computation of the rest).
(par-fib 100 5) crashes for me... :)

Well, yes, the current state of the code is slightly broken.  Just as
before this change, the null-threads alternative won't build, and the
threading alternative is the default.  The idea is that we for the
coming couple of weeks can make a collaborative effort of finding bugs
and fundamental problems.

However, single-thread use seems stable (although there could be some
problems with errors in macro transformers).

We need to work on signal delivery and exceptions.  One suggestion is
that we continue to *only* deliver signals at SCM_ASYNC_TICK points.
The effect of signal delivery (normally a throw) is then pretty well
controlled.  A novel (?) suggestion is this:

It is very irritating that signals are delivered to whatever thread
happens to run for the moment.  Is it possible to add explicit
interactive control over which thread is the "foreground" thread?
Only the "foreground" thread gets signal delivery (=> that thread gets
its async lists marked regardless of which thread reacted on the
signal).  Normally, the "foreground" is the repl loop thread, and we
can have a small "command language" (perhaps ordinary scheme
procedures) to inspect status of the other threads and explicitly
deliver signals like "SIGINT".

One further area which needs work is the current recursive critical
sections (SCM_REDEFER/REALLOW_INTS, SOURCE_SECTION in eval.c etc).
They need to be optimized (use real POSIX recursive mutecis if
available).  We should also add a mechanism for resetting (unlocking)
the associated mutecis on an error throw.  This can be made by adding
a line for registering the critical section in
SCM_REC_CRITICAL_SECTION in snarf.h.

I and Marius hope to fix the most basic problems within a few days.
Then I think we'll have an acceptable level of stability.  And, as
Marius have said before, the thread suppport is in a state of flux.
Much can still change...

(BTW, there seems to be some unrelated build problem right now due to
the recent change to versioning.)

Best regards,
Mikael D.


[-- Attachment #2: Thread test program --]
[-- Type: text/plain, Size: 370 bytes --]

(define (par-fib n n-forks)
  (cond ((<= n 1) 1)
	((> n-forks 0)
	 (letpar ((f1 (par-fib (- n 1) (- n-forks 1)))
		  (f2 (par-fib (- n 2) (- n-forks 1))))
	   (+ f1 f2)))
	(else
	 (let ((f1 (mono-fib (- n 1)))
	       (f2 (mono-fib (- n 2))))
	   (+ f1 f2)))))

(define (mono-fib n)
  (let iter ((f1 1) (f2 1) (i 1))
    (if (>= i n)
	f2
	(iter f2 (+ f1 f2) (+ 1 i)))))

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Guile-devel mailing list
Guile-devel@gnu.org
http://mail.gnu.org/mailman/listinfo/guile-devel

             reply	other threads:[~2002-12-09 13:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-09 13:44 Mikael Djurfeldt [this message]
2002-12-09 14:26 ` Warning: Unstable POSIX threads support comitted to CVS Marius Vollmer
2002-12-09 17:40   ` Mikael Djurfeldt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xy77kej71dc.fsf@nada.kth.se \
    --to=djurfeldt@nada.kth.se \
    --cc=marius.vollmer@uni-dortmund.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).