From owner-freebsd-hackers Mon Mar 9 18:02:53 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id SAA04793 for freebsd-hackers-outgoing; Mon, 9 Mar 1998 18:02:53 -0800 (PST) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from osshe.edu (OSSHE.EDU [140.211.10.20]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id SAA04761 for ; Mon, 9 Mar 1998 18:02:41 -0800 (PST) (envelope-from sugalskd@osshe.edu) Received: from beech (southbeach.CONET.OSSHE.EDU [140.211.15.50]) by osshe.edu (8.8.7/8.8.7) with SMTP id SAA14514; Mon, 9 Mar 1998 18:02:23 -0800 (PST) Message-Id: <3.0.5.32.19980309180216.00a15320@osshe.edu> X-Sender: sugalskd@osshe.edu X-Mailer: QUALCOMM Windows Eudora Light Version 3.0.5 (32) Date: Mon, 09 Mar 1998 18:02:16 -0800 To: Christopher Masto , perl5-porters@perl.com, nvp@mediaone.net From: Dan Sugalski Subject: Re: Perl, Threads, FreeBSD, High Weirdness Cc: hackers@FreeBSD.ORG In-Reply-To: <19980309152332.35831@netmonger.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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