Operating systems — command interpreters: What is the primary advantage when a command processor executes only built-in (internal) commands, instead of launching external user-defined commands?
-
Aflexibility to the users in running lists of commands by simply collecting them in named batch command files
-
Bthe command set being common across different hardware configurations
-
Cusers can create system programs and run them as commands
-
Dthe processing is much faster than would otherwise be the case when user-defined commands are used
-
ENone of the above
Answer
Correct Answer: the processing is much faster than would otherwise be the case when user-defined commands are used
Explanation
Introduction / Context:Many operating systems include a command processor (also called a shell) that accepts user commands. Some commands are implemented internally (built-ins) while others are external programs. This question focuses on the performance implications of using only built-in commands versus invoking external executables.
Given Data / Assumptions:
- The command processor can execute built-in commands directly without loading a separate process.
- External commands require locating a program file, loading it from storage, and creating a new process context.
- We are comparing overall execution speed and overhead.
Concept / Approach:
Built-in commands run within the shell process itself. This avoids disk I/O, executable image loading, dynamic linking, and process creation. Eliminating these steps reduces latency for short utility operations such as directory navigation, variable manipulation, or quick configuration changes.
Step-by-Step Solution:
Identify overhead for external commands: path search + disk read + load/relocate + create process + context switch.Contrast with built-ins: parse and execute directly within the shell, reusing the existing process context.Conclude that minimizing process launches and disk access yields faster command turnaround.Therefore, the dominant advantage is higher execution speed.Verification / Alternative check:
Empirical shell timing (for example, time of a built-in echo or cd) is consistently faster than launching an external program of similar function because of the avoided process creation and I/O.
Why Other Options Are Wrong:
- Flexibility via batch files: Batch scripts work with both built-ins and externals; not unique to built-ins.
- Common command set across hardware: Standardization depends on the OS distribution, not on being built-in.
- Users can create system programs: That relates to external commands, not built-ins only.
- None of the above: Incorrect because the speed benefit is real and primary.
Common Pitfalls:
Assuming built-ins are always preferable; sometimes external tools are richer in features. Also, security policies and maintainability may favor external tools despite overhead.
Final Answer:
the processing is much faster than would otherwise be the case when user-defined commands are used