Thread parallele filehandles (24 answers)
Opened by Gast at 2006-08-28 12:57

montii
 2006-08-29 09:57
#69293 #69293
User since
2006-08-28
13 Artikel
BenutzerIn
[default_avatar]
ich habe mir mal http://www.unix.org.ua/orelly/perl/prog3/ch17_01.htm durchgelesen gehabt. Da steht "ithreads" enstpricht forks() unter Windows.

Quote
However, through heroic efforts, version 5.6 of Perl now implements the fork operation on Windows by cloning a new interpreter object within the same process. That means that most examples using fork in the rest of the book will now work on Windows. The cloned interpreter shares immutable code with other interpreters but gets its own copy of data to play with. (There can still be problems with C libraries that don't understand threads, of course.)

This approach to multiprocessing has been christened ithreads, short for "interpreter threads". The initial impetus for implementing ithreads was to emulate fork for Microsoft systems. However, we quickly realized that, although the other interpreters are running as distinct threads, they're running in the same process, so it would be easy to make these separate interpreters share data, even though they don't share by default.


fork: immutable data, own copy
ithreads: would be easy to share data, even though they don't share by default

Von dem her hat sich das irgendwie wenig geschenkt.. normalerweise wird bei threading ja alles geteilt.. aber bei ithreads ist das nicht so.. entspricht also einem fork(). So hatte ich das verstanden... Ein weiterer Grund wieso ich mich dann für ithreads entschieden hatte: Queue. Ich will später nicht mehr als x (1 .. 5) parallele prozesse/threads haben. Und für fork() gab es kein beispiel :)

Wenn ich werte an den parent zurückgeben kann brauche ich nichts zu sharen. Die SubFunction (child/thread) soll später Auswertungen machen und an den Parent zurückliefern.. so war's geplant :)\n\n

<!--EDIT|montii|1156831141-->

View full thread parallele filehandles