Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7051361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:15:16+00:00 2026-05-28T03:15:16+00:00

Maybe the title does not word the question so precisely: I know that when

  • 0

Maybe the title does not word the question so precisely: I know that when I run gcc foo.c GCC calls other sub-programs that do all the work for it, making the main gcc program just an interface. But how exactly is this done?

Does it use system or exec or some other function? The reason I want to know this because I want to build a web crawler based on a similar system, where there would be a interface program and several other sub-programs like crawl and download.

I’m sorry if this question has already been asked but I didn’t find it using search or the “Questions with similar titles”.

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:15:16+00:00Added an answer on May 28, 2026 at 3:15 am

    While your question is really more general (and only using gcc as an example), my first idea would be to use strace to figure out what it’s doing. On my system (Ubuntu 11.10/x64), I just ran strace, like so:

    strace -F -o sout gcc -Wall -o test test.c
    

    This shows system calls for the gcc process, while following forks (-F) and sending the output of the trace to sout. Doing this, I can see that gcc here calls vfork(), and then execve() in the child, though the actual program’s source might just do a simple fork()/exec().

    The relevant output from sout is:

    26264 stat("/usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1", {st_mode=S_IFREG|0755, st_size=11248824, ...}) = 0
    26264 access("/usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1", X_OK) = 0
    26264 vfork()                           = 26265
    26264 wait4(26265,  <unfinished ...>
    26265 execve("/usr/lib/gcc/x86_64-linux-gnu/4.6.1/cc1", ["/usr/lib/gcc/x86_64-linux-gnu/4."..., "-quiet", "-imultilib", ".", "-imultiarch", "x86_64-linux-gnu", "test.c", "-quiet", "-dumpbase", "test.c", "-mtune=generic", "-march=x86-64", "-auxbase", "test", "-Wall", "-fstack-protector", ...], [/* 46 vars */]) = 0
    

    At the begnning of each line is the pid of the process running. So the primary process calls stat() to find cc1, then forks, and the child executes it.

    That being said, I could have answered your question without the citation; fork/exec is a common way to call sub-processes from your program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

EDIT: This question title originally was: How does Doctrine know last inserted id in
I know, the title does not sound good however I will explain it clearly.
Windows Explorer in Windows 7, and maybe Vista too (can't rememmber), does not have
OK so that title sucks a little but I could not think of anything
I have a problem with word press not displaying the SEO title from All
May be my title is not clear. I am looking for some kind of
That title may need some work. Perhaps after reading this, you may be able
The title may be a little confusing, but I don't know how else to
Hey all, title may be abit misleading but i didnt know the correct way
Maybe I just don't know .NET well enough yet, but I have yet to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.