Information Technology Reference
In-Depth Information
UNIX fork and the Chrome Web browser
Although UNIX fork is normally paired with a call to exec , in some cases UNIX fork
is useful on its own. A particularly interesting example is in Google's Chrome web
browser. When the user clicks on a link, Chrome forks a process to fetch and render
the web page at the link, in a new tab on the browser. The parent process continues to
display the original referring web page, while the child process runs the same browser,
but in its own address space and protection boundary. The motivation for this design is
to isolate the new link, so that if the web site is infected with a virus, it won't infect the
rest of the browser. Closing the infected browser tab will then remove the link and the
virus from the system.
Some security researchers take this a step further. They set up their browsers and
email systems to create a new virtual machine for every new link, running a copy of
the browser in each virtual machine; even if the web site has a virus that corrupts the
guest operating system running in the virtual machine, the rest of the system will remain
unaffected. In this case, closing the virtual machine cleans the system of the virus.
Interestingly, on Windows, Google Chrome does not use CreateProcess to fork new
copies of the browser on demand. The difficulty is that if Chrome is updated while
Chrome is running, CreateProcess will create a copy of the new version, and that may
not interoperate correctly with the old version. Instead, they create a pool of helper
processes that wait in the background for new links to render.
UNIX exec and wait
The UNIX system call exec completes the steps needed to start running a new
program. UNIX exec is typically called by the child process after it has returned
from UNIX fork and configured the execution environment for the child. We
will describe more about how this works when after we discuss UNIX pipes in
the next section.
UNIX exec does the following steps:
Load the program prog into the current address space
Copy arguments args into memory in the address space
Initialize the hardware context to start execution at \start"
Note that exec does not create a new process!
On the other side, often the parent process needs to pause until the child
process completes, e.g., if the next step depends on the output of the previous
step. In the shell example we started the chapter with, we need to wait for the
two compilations to finish before it is safe to start the linker.
Search WWH ::




Custom Search