SHARE
Facebook X Pinterest WhatsApp

Improving mod_perl Driven Site’s Performance — Part VI: Forking and Executing Subprocesses from mod_perl Page 8

Written By
thumbnail Stas Bekman
Stas Bekman
Jul 20, 2010
ServerWatch content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More



Perl’s system() is not the system(3) call [C-library]. This is
how the arguments to system() get interpreted. When there is a single
argument to system(), it’ll be checked for for having shell
metacharacters first (like *,?), and if there are any–Perl
interpreter invokes a real shell program (/bin/sh -c on Unix
platforms). If you pass a list of arguments to system(), they will be
not checked for metacharacters, but split into words if required and
passed directly to the C-level execvp() system call, which is more
efficient. That’s a very nice optimization. In other words, only
if you do:

  system "sh -c 'echo *'"

will the operating system actually exec() a copy of /bin/sh to
parse your command. But even then since sh is almost certainly
already running somewhere, the system will notice that (via the disk
inode reference) and replace your virtual memory page table with one
pointing to the existing program code plus your data space, thus will
not create this overhead.

References

thumbnail Stas Bekman

Stas Bekman is a ServerWatch contributor.

Recommended for you...

What Is a Container? Understanding Containerization
What Is a Print Server? | How It Works and What It Does
Nisar Ahmad
Dec 8, 2023
What Is a Network Policy Server (NPS)? | Essential Guide
Virtual Servers vs. Physical Servers: Comparison and Use Cases
Ray Fernandez
Nov 14, 2023
ServerWatch Logo

ServerWatch is a top resource on servers. Explore the latest news, reviews and guides for server administrators now.

Property of TechnologyAdvice. © 2025 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.