Execution Models: Review Questions

Self-Study & Discussion

These questions cover the 8 sections of the Execution Models overview and are organized by topic clusters. No answers are provided — the goal is to test your understanding of how servers execute dynamic code, the trade-offs between execution models, and their architectural implications.

The questions mix conceptual understanding, performance analysis, and architectural design decisions.

Cluster 1: The Challenge & CGI (Sections 1–3)

  1. Explain the fundamental difference between serving a static HTML file and generating a dynamic response. What problem does a server-side execution model solve?
  2. Describe the five steps of CGI fork-exec. What Unix system calls are involved, and why does the process exit after each request?
  3. CGI uses environment variables (QUERY_STRING, REQUEST_METHOD, CONTENT_LENGTH) to pass request data to the script. Why environment variables instead of function arguments? What does this reveal about CGI's design?
  4. A Perl CGI script handles 50 requests per second, but each fork() + exec() takes 20ms. Calculate the overhead as a percentage of a 100ms response. Why did this become a bottleneck as the web grew?
  5. CGI provides "complete isolation" between requests. Explain what this means in terms of memory, variables, and crash impact. What is the trade-off compared to persistent processes?

Cluster 2: Server Modules & App Servers (Sections 4–5)

  1. Explain how mod_php eliminates the fork-exec overhead of CGI. Where does the PHP interpreter live, and what happens when a .php file is requested?
  2. mod_php runs inside the Apache process. What security risk does this create compared to CGI's process isolation? What happens if a PHP script crashes or has a memory leak?
  3. In the application server model (e.g., Node.js), the application IS the server. Explain what this means — who handles HTTP parsing, routing, and port binding?
  4. A Node.js application stores a counter variable let visits = 0 that increments on each request. Would this work in CGI? In mod_php? Why or why not? What does this reveal about each model's relationship with state?
  5. Why does a production Node.js deployment put Nginx in front as a reverse proxy? List at least four responsibilities that Nginx handles so that Node.js doesn't have to.

Cluster 3: Comparison & Trade-offs (Section 6)

  1. Compare startup cost per request across CGI, mod_php, and Node.js. Why does CGI's "full process" startup become catastrophic at high concurrency while the other models handle thousands of requests per second?
  2. "Crash impact" scales inversely with isolation: CGI affects one request, mod_php affects one Apache worker, Node.js affects ALL requests. Explain why each model has this crash radius. How does PM2 or cluster mode mitigate Node.js's risk?
  3. A developer says "CGI is obsolete." Is this accurate? Name a scenario where CGI's complete isolation and language-independence might still be the right choice.
  4. The comparison table shows CGI deployment as "drop files" and Node.js as "process manager." Explain what this means operationally — what happens when you update code in each model?
  5. Memory isolation is "complete" for CGI, "partial" for mod_php, and "none" for Node.js. Explain what "partial" means for mod_php. What shared resources exist, and what security implications does this create for shared hosting?

Cluster 4: History, Architecture & Modern Choices (Sections 7–8)

  1. Trace the historical progression: CGI (1993) → mod_perl (1997) → Node.js (2009) → Lambda (2014). For each transition, what specific problem did the newer model solve?
  2. PHP started as CGI scripts in 1995 but later became an Apache module. What performance problem drove this transition? Is modern PHP still using mod_php, or has the execution model changed again?
  3. The page says each model "didn't replace the previous one entirely — they coexist." Give a concrete example of when you would choose CGI over an application server today, and vice versa.
  4. Serverless/FaaS (AWS Lambda) appears in the overview table but doesn't have its own section. Compare serverless to CGI — both create fresh execution contexts per request. What is similar? What is fundamentally different about how the process is managed?
  5. You're architecting a new web application that needs to handle user authentication, a REST API, and WebSocket connections for real-time chat. Which execution model would you choose and why? Could you use different models for different parts of the application?