Commit 3a19279
committed
librc: fix unnecessary copying parent memory page table
posix_spawn() is a more lightweight and modern alternative to fork()/exec(), which are used inside popen(). The main advantage of posix_spawn is that it can create a new process without completely duplicating the address space of the parent process.
References:
- https://blog.famzah.net/2018/12/19/posix_spawn-performance-benchmarks-and-usage-examples/
- https://lobste.rs/s/smbsd5/fork_road
- https://www.reddit.com/r/C_Programming/comments/1lvdhp2/fork_vs_posix_spawn/1 parent 584444d commit 3a19279
1 file changed
Lines changed: 20 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
| 39 | + | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
791 | 794 | | |
792 | 795 | | |
793 | 796 | | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
794 | 800 | | |
795 | 801 | | |
796 | 802 | | |
797 | | - | |
| 803 | + | |
798 | 804 | | |
799 | 805 | | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
800 | 818 | | |
801 | 819 | | |
802 | 820 | | |
| |||
876 | 894 | | |
877 | 895 | | |
878 | 896 | | |
879 | | - | |
| 897 | + | |
880 | 898 | | |
881 | 899 | | |
882 | 900 | | |
| |||
0 commit comments