both processes showed up with the same size.
Yes, but which size? top shows a lot of information. If you don't know what the columns mean, your interpretation can be wildly wrong. Running the following very naive and simple program on my laptop (Linux PPC with a 2.4 kernel) and looking at top shows two processes of about 40 Mb apiece -- but the amount of shared memory for each process is exactly the same.
#!/usr/bin/perl use strict; use warnings; my @foo; $foo[10000000] = 1; fork and sleep 10; sleep 10;
As for the question of why Perl's ithreads are worse than forking, having seen the ithreads code only a couple of times and not being an expert on memory management by any means, I suspect Perl doesn't take advantage of the COW features of decent kernels. I make this guess because I don't know of any way that Perl could hint to the kernel to share specific memory pages.
In reply to Re^4: Handling multiple clients
by chromatic
in thread Handling multiple clients
by jalewis2
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |