[% setvar title Implementation of Threads in Perl %]

This file is part of the Perl 6 Archive

Note: these documents may be out of date. Do not use as reference!

To see what is currently happening visit http://www.perl6.org/

TITLE

Implementation of Threads in Perl

VERSION

  Maintainer: Bryan C. Warnock <bwarnock@gtemail.net>
  Date: 1 Aug 2000
  Last Modified: 28 September 2000
  Mailing List: perl6-internals@perl.org
  Number: 1
  Version: 4
  Status: Frozen

CHANGES

No significant changes. Freezing.

ABSTRACT

Perl 6 should be built around threads from the beginning.

DESCRIPTION

Perl 5 attempted (with relatively good success) to implement threads atop the current architecture. It did, unfortunately, leave several gaps, traps, and "features" in heavy concurrency uses. These weaknesses could be fixed if Perl was built with threading from the start.

All Perl programs are threaded. Most just only have one.

MOTIVATORS

Impatience, Hubris, and Laziness, in that order.

IMPLEMENTATION

Attempt to build-in thread constructs for the internals, while allowing a Thread module to safely and robustly add user thread constructs, while not making things bad for the single-threaded folks.

SUMMARY OF IMPLEMENTATION

The summary is based on the current Perl 5 architecture. As the internal structure changes, like using vtables, the thread design will have to change.

There has been very little direct discussion about threads or this RFC. The bulk of the discussion centered around whether thread-global or program-global global variables should be the default.

There has been a bit of indirect discussion on threads, like how various structures will fit into a multi-threaded program. No attempt has been made to cross-reference these fringe discussions.

IMPACT

UNKNOWNS

REFERENCES

RFC 86: IPC Mailboxes for Threads and Signals

RFC 178: Lightweight Threads

RFC 185: Thread Programming Model

RFC 293: MT-Safe Autovariables in perl 5.005 Threading