Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Mar 1998 18:02:16 -0800
From:      Dan Sugalski <sugalskd@osshe.edu>
To:        Christopher Masto <chris@netmonger.net>, perl5-porters@perl.com, nvp@mediaone.net
Cc:        hackers@FreeBSD.ORG
Subject:   Re: Perl, Threads, FreeBSD, High Weirdness
Message-ID:  <3.0.5.32.19980309180216.00a15320@osshe.edu>
In-Reply-To: <19980309152332.35831@netmonger.net>

next in thread | previous in thread | raw e-mail | index | archive | help
At 03:23 PM 3/9/1998 -0500, Christopher Masto wrote:
>Here are the latest results of my investigations into _62's thread
>situation:

[Snip]

>Pretending the last line is fixed, this test still fails on FreeBSD
>(2.2.5-stable as of yesterday).  I don't know why, but I do know that
>threads are simply not working.  They do not run concurrently.
>
>This test program:
>
>  use Thread;
>
>  $t = Thread->new(sub { print "AAA\n" while 1; });
>  while (1) {
>    print "---\n";
>    sleep 1;
>  }
>
>Produces this output:
>
>---
>---
>---
>---
>---
>(ad infinitum)
>
>If the main program ever performs a $t->join or exits, the AAA thread
>takes over and actually can't be stopped with a ^C or ^\ (but kill -9
>from another session works).
>
>Either I'm completely misunderstanding the semantics of the Thread stuff
>(the documentation _is_ a bit skimpy right now (I will try to help remedy
>that if I ever get this working)), or something's truly screwy.

While I can't speak for FreeBSD, for OpenVMS this does work as expected--a
line of ---, then a jillion AAA lines with the odd --- scattered in there.
(Not many, I didn't let the test run too long :)

Dunno if it's an issue, but the POSIX threading does have a number of
different scheduling options for threads, and I had to do a special link on
OpenVMS to enable kernel threads. (Without the magic link option, multiple
threads wouldn't run on multiple processors) Depending on the defaults, I
can see this behaviour. (it looks like SCHED_FIFO's the default policy with
no thread rescheduling on blocking syscalls)

Maybe there are some special flags you need to feed to the C compiler, or
linker, or something.

					Dan

---------------------------------------------"it's like this"--------------
Dan Sugalski   (541) 737-3346                even samurai
SysAdmin                                     have teddy bears
Oregon University System                     and even the teddy bears
sugalskd@ous.edu                             get drunk

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3.0.5.32.19980309180216.00a15320>