bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] add option --no-cache-file and configuration variable no_cac


From: Hideki IWAMOTO
Subject: Re: [PATCH] add option --no-cache-file and configuration variable no_cache_file
Date: Wed, 09 Jul 2003 00:58:23 +0900

On Tue, 08 Jul 2003 00:57:09 +0900, Shigio Yamaguchi wrote...
> > I think there is no way except for asking perl people to use vfork.
> 
> I had forgotten 'copy-on-write' technique.
> Recent fork(2) is sure to be impremented using 'copy-on-write' technique
> that delay copy of process until the first access to the memory.
> Taking time for the copy might mean that extra access was done after
> fork(2)/clone(2) before exec(2) in perl.

I think that this difference is an unescapable overhead accompanying use of 
fork(2).
The almost same difference as htags arises in the attached simple test program.



address@hidden:/home/iwamoto/work/test>time ./test2 15000000 54003 'cat 
/dev/null'
64.720u 189.970s 4:17.59 98.8%  0+0k 0+0io 19171140pf+0w
address@hidden:/home/iwamoto/work/test>time ./test2 80000000 54003 'cat 
/dev/null'
66.700u 758.560s 14:26.62 95.2% 0+0k 0+0io 19171158pf+0w
address@hidden:/home/iwamoto/work/test>strace -c ./test2 15000000 54003 'cat 
/dev/null'
execve("./test2", ["./test2", "15000000", "54003", "cat /dev/null"], [/* 32 
vars */]) = 0
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 80.57   58.270417        1079     54003           clone
 18.74   13.550315         251     54003           wait4
  0.49    0.353061           2    216012           rt_sigaction
  0.20    0.147972           1    108006           rt_sigprocmask
  0.00    0.002395        1198         2           munmap
  0.00    0.000021           7         3         1 open
  0.00    0.000020           3         6           old_mmap
  0.00    0.000003           3         1           read
  0.00    0.000003           3         1           uname
  0.00    0.000003           3         1           mmap2
  0.00    0.000003           2         2           fstat64
  0.00    0.000003           3         1           set_thread_area
  0.00    0.000002           1         2           close
  0.00    0.000002           2         1           brk
------ ----------- ----------- --------- --------- ----------------
100.00   72.324220                432044         1 total
address@hidden:/home/iwamoto/work/test>strace -c ./test2 80000000 54003 'cat 
/dev/null'
execve("./test2", ["./test2", "80000000", "54003", "cat /dev/null"], [/* 32 
vars */]) = 0
% time     seconds  usecs/call     calls    errors syscall
------ ----------- ----------- --------- --------- ----------------
 78.76  384.163277        7114     54003           clone
 21.13  103.075143        1909     54003           wait4
  0.07    0.362153           2    216012           rt_sigaction
  0.03    0.155021           1    108006           rt_sigprocmask
  0.00    0.015072        7536         2           munmap
  0.00    0.000096          16         6           old_mmap
  0.00    0.000020           7         3         1 open
  0.00    0.000005           3         2           fstat64
  0.00    0.000003           3         1           read
  0.00    0.000003           3         1           uname
  0.00    0.000003           3         1           mmap2
  0.00    0.000002           1         2           close
  0.00    0.000002           2         1           set_thread_area
  0.00    0.000001           1         1           brk
------ ----------- ----------- --------- --------- ----------------
100.00  487.770801                432044         1 total

======= source of system(3) ======
#ifdef FORK
  pid = FORK ();
#else
  pid = __fork ();
#endif
  if (pid == (pid_t) 0)
    {
      /* Child side.  */
      const char *new_argv[4];
      new_argv[0] = SHELL_NAME;
      new_argv[1] = "-c";
      new_argv[2] = line;
      new_argv[3] = NULL;

      /* Restore the signals.  */
      (void) __sigaction (SIGINT, &intr, (struct sigaction *) NULL);
      (void) __sigaction (SIGQUIT, &quit, (struct sigaction *) NULL);
      (void) __sigprocmask (SIG_SETMASK, &omask, (sigset_t *) NULL);
      INIT_LOCK ();

      /* Exec the shell.  */
      (void) __execve (SHELL_PATH, (char *const *) new_argv, __environ);
      _exit (127);
    }
  else if (pid < (pid_t) 0)

----
Hideki IWAMOTO  address@hidden

Attachment: test2.c
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]