From v.velox at vvelox.net Fri Feb 12 23:53:03 2010 From: v.velox at vvelox.net (Zane C.B.) Date: Sat, 13 Feb 2010 01:53:03 -0600 Subject: [Chicago-talk] threading Question In-Reply-To: <4B5DCB10.6040804@gmail.com> References: <4B5DCB10.6040804@gmail.com> Message-ID: <20100213015303.792b06d0@vixen42.vulpes.vvelox.net> On Mon, 25 Jan 2010 10:47:12 -0600 packet wrote: > Does it matter if you have 1 cpu or 4 cpu for programming threads > in perl and why? > > > I got 1 cpu on the laptop and 4 cpu on my desktop.Just want to know > this been bugging me for abit.:) I love forking, when it comes to writing things like daemons. When it comes to stuff like that, even on a single core system, it offers a massive improvement. The only issue I've ever run into, is that it is a bitch, passing information between between each instance. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 196 bytes Desc: not available URL: From jon-chicagotalk at jrock.us Sun Feb 14 00:27:15 2010 From: jon-chicagotalk at jrock.us (Jonathan Rockway) Date: Sun, 14 Feb 2010 02:27:15 -0600 Subject: [Chicago-talk] threading Question In-Reply-To: <20100213015303.792b06d0@vixen42.vulpes.vvelox.net> (Zane C. B.'s message of "Sat, 13 Feb 2010 01:53:03 -0600") References: <4B5DCB10.6040804@gmail.com> <20100213015303.792b06d0@vixen42.vulpes.vvelox.net> Message-ID: <87hbpknrx8.fsf@snowball2.jrock.us> * On Sat, Feb 13 2010, Zane C.B. wrote: > The only issue I've ever run into, is that it is a bitch, passing > information between between each instance. Hence threads. (But not ithreads, which is just fork without copy and write.) I really recommend using Coro for network daemons. It will easily handle 30,000+ open and idle connections. (And only that few because that's when my machine runs out of file descriptors.) If you need to use all 4 CPUs, run four copies of your daemon. Regards, Jonathan Rockway -- print just => another => perl => hacker => if $,=$" From lembark at wrkhors.com Sun Feb 14 12:45:22 2010 From: lembark at wrkhors.com (Steven Lembark) Date: Sun, 14 Feb 2010 15:45:22 -0500 Subject: [Chicago-talk] threading Question In-Reply-To: <87hbpknrx8.fsf@snowball2.jrock.us> References: <4B5DCB10.6040804@gmail.com> <20100213015303.792b06d0@vixen42.vulpes.vvelox.net> <87hbpknrx8.fsf@snowball2.jrock.us> Message-ID: <20100214154522.01d865cdlembark@wrkhors.com@wrkhors.com> On Sun, 14 Feb 2010 02:27:15 -0600 Jonathan Rockway wrote: > * On Sat, Feb 13 2010, Zane C.B. wrote: > > The only issue I've ever run into, is that it is a bitch, passing > > information between between each instance. > > Hence threads. > > (But not ithreads, which is just fork without copy and write.) > > I really recommend using Coro for network daemons. It will easily > handle 30,000+ open and idle connections. (And only that few because > that's when my machine runs out of file descriptors.) If you need to > use all 4 CPUs, run four copies of your daemon. Under all but the fewest of cases, threading offers so much more pain that data passing that forking will usually be a better approach -- at least on *NIX [VMS spawn's have their own problems and Windawg doesn't support real forks]. The amount of data that has to be moved is usually small, and success/failure or a set of pre-defined choices can easily be handled by exit codes. If you have to move more data, there are standard approaches for socket interfaces -- POE being the most adaptable and thus complicated, simple listen+ select being the easiest also well supported by perly modules. Shared memory is quite simple to manage with Perl and has generally less overhead than threading. An attitude of first verifying that forks will accomplish your needs reasonably before trying threads will pay off handsomly in reduced pain over the long term. enjoi -- Steven Lembark 85-09 90th St. Workhorse Computing Woodhaven, NY, 11421 lembark at wrkhors.com +1 888 359 3508 From jeremy at marzhillstudios.com Tue Feb 16 09:21:51 2010 From: jeremy at marzhillstudios.com (Jeremy Wall) Date: Tue, 16 Feb 2010 11:21:51 -0600 Subject: [Chicago-talk] threading Question In-Reply-To: <87hbpknrx8.fsf@snowball2.jrock.us> References: <4B5DCB10.6040804@gmail.com> <20100213015303.792b06d0@vixen42.vulpes.vvelox.net> <87hbpknrx8.fsf@snowball2.jrock.us> Message-ID: <69d143cd1002160921j57030ad1m1f7134b55e03999c@mail.gmail.com> First I've heard of Coro. I'm going to check it out now since I have an upcoming application for just that sort of thing. And continuation style is just what the doctor ordered. On Sun, Feb 14, 2010 at 2:27 AM, Jonathan Rockway wrote: > * On Sat, Feb 13 2010, Zane C.B. wrote: > > The only issue I've ever run into, is that it is a bitch, passing > > information between between each instance. > > Hence threads. > > (But not ithreads, which is just fork without copy and write.) > > I really recommend using Coro for network daemons. It will easily > handle 30,000+ open and idle connections. (And only that few because > that's when my machine runs out of file descriptors.) If you need to > use all 4 CPUs, run four copies of your daemon. > > Regards, > Jonathan Rockway > > -- > print just => another => perl => hacker => if $,=$" > _______________________________________________ > Chicago-talk mailing list > Chicago-talk at pm.org > http://mail.pm.org/mailman/listinfo/chicago-talk > -- Jeremy Wall http://jeremy.marzhillstudios.com Jeremy at marzhillstudios.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From pcmantz at gmail.com Thu Feb 25 18:23:52 2010 From: pcmantz at gmail.com (Paul Mantz) Date: Thu, 25 Feb 2010 20:23:52 -0600 Subject: [Chicago-talk] Fwd: Hackathon: Quiet Riot this Saturday! In-Reply-To: <42f28fe1002251755s2551ebadwc4b6018ae620fdbc@mail.gmail.com> References: <42f28fe1002251755s2551ebadwc4b6018ae620fdbc@mail.gmail.com> Message-ID: <42f28fe1002251823h58fdd593q8300560089724ac9@mail.gmail.com> Hey guys, If you have time you'll come to the hackathon this Saturday. Also, if anyone's looking for help with any CPAN project, I'd be more than happy to donate a couple hours. ---------- Forwarded message ---------- From: Paul Mantz Date: Thu, Feb 25, 2010 at 7:55 PM Subject: Hackathon: Quiet Riot this Saturday! To: pumping-station-one at googlegroups.com, pumping-station-one-public at googlegroups.com Hello everyone, Sorry for the late call-out, but we're having our monthly coding hackathon this Saturday, February 27, at 8pm; or whenever you want to show up. ?We've had a lot of good projects come out of this, and we always want to see more. ?We're going to shut of the power tools, ingest a lot of caffeine, and crank out some code. Everyone's welcome to attend. ?Bring a laptop (or other project!) and come code, reverse engineer, architect, and/or solder the night away. Name: Hackathon: Quiet Riot Edition Location: Pumping Station: One, 3354 N. Elston, Chicago, IL Date: Saturday, February 27, 2010. Repeats every 4th Saturday. Time: 8:00PM to Noon (Sunday) Happy hacking! -- Paul Mantz http://www.mcpantz.org Zmanda - Open source backup and recovery http://www.zmanda.com/ PS. Forward widely! From richard at rushlogistics.com Sun Feb 28 16:16:43 2010 From: richard at rushlogistics.com (Richard Reina) Date: Sun, 28 Feb 2010 19:16:43 -0500 (EST) Subject: [Chicago-talk] =?utf-8?q?capturing_the_pts/=3F?= Message-ID: <20100301001643.42BE7600@captain.xo.com> Does anyone know if there is a perl function that in linux captures the terminal number (pts/0, pts/1, pts/3, etc.) that the script is being run in? Thanks, Richard From andrew at cleverdomain.org Sun Feb 28 17:01:01 2010 From: andrew at cleverdomain.org (Andrew Rodland) Date: Sun, 28 Feb 2010 19:01:01 -0600 Subject: [Chicago-talk] capturing the pts/? In-Reply-To: <20100301001643.42BE7600@captain.xo.com> References: <20100301001643.42BE7600@captain.xo.com> Message-ID: <201002281901.01533.andrew@cleverdomain.org> On Sunday 28 February 2010 06:16:43 pm Richard Reina wrote: > Does anyone know if there is a perl function that in linux captures the > terminal number (pts/0, pts/1, pts/3, etc.) that the script is being run > in? POSIX::ttyname. Call it as ttyname(0), or if you want to be a bit more persistent, do: sub get_tty { for (0 .. 2) { if (my $ttyname = POSIX::ttyname($_)) { return $ttyname; } } return; } which works as long as one of stdin, stdout, or stderr is connected to a terminal (often, like when running in a pipeline, stdin and stdout will both be opened to a pipe or a file, but stdout will still be pointing to the terminal, so this is a good trick.) Andrew