CSE-301. Operating System
CSE-301. Operating System
Answer: System calls allow user-level processes to request services from the operating system.
System Programs: System programs are special types of software that provide a basic environment for running application
programs and managing the hardware of a computer. They act as a support layer between the operating system and the
user/application programs.
Examples of System Programs:
File Explorer (Windows)i
Terminal / Bash (Linux/macOS)
Task Manager
Purpose of System Programs:
File Management – Handles creation, deletion, and manipulation of files and directories.
Process Management – Manages execution, scheduling, and termination of processes.
Device Management – Controls and coordinates input/output devices.
System Monitoring – Monitors system performance and resource usage.
Security and Protection – Ensures data security and user access control.
Communication Support – Enables data exchange between users and programs.
Program Execution – Loads and runs application programs.
Command Interpreter: A Command Interpreter is a program that takes commands from the user and tells the computer's
operating system to perform the requested tasks. It is also known as a shell.
Purpose of Command Interpreter:
Acts as a bridge between the user and the operating system.
Receives commands from the user.
Translates those commands into actions.
Executes programs or system functions as instructed.
Displays output or error messages to the user.
Command Interpreter Usually Separate from the Kernel: The command interpreter is usually kept separate from the kernel
for the following reasons:
Flexibility: Users can choose or change the shell without modifying the kernel.
Safety and Stability: Keeping it separate prevents user command errors from affecting the core of the operating
system.
Modularity: Separating components makes the system easier to maintain and update.
User-Level Program: The shell is a user-level program that interacts with the kernel through system calls, not as part
of it.
Layered Approach: The layered approach is a system design method where the system is divided into multiple layers, each
with a specific function. Each layer only interacts with the layer directly below or above it, creating a clear separation of
concerns. This makes the system easier to develop, maintain, and understand.
Main Advantage of the Layered Approach to System Design: The main advantage of the layered approach is its modularity
and abstraction, which make the system easier to understand, maintain, and extend.
Key Benefits:
Modularity: Each layer handles a specific task, allowing independent development and debugging.
Abstraction: Hides lower-level complexity, simplifying higher-layer design.
Ease of Maintenance: Updates can be made in one layer without affecting others.
Scalability: New layers or features can be added easily.
Flexibility: Supports integration of new technologies without redesigning the whole system.
Hierarchical Structure: Enhances clarity and teamwork by organizing the system logically.
System Calls Required to Start a New Process in UNIX: To start a new process, a UNIX shell (or command interpreter)
typically uses the following two main system calls:
fork()
Creates a new process by duplicating the calling (parent) process.
The new process is called the child and is an exact copy of the parent, except for a few differences like the PID.
Both the parent and child continue execution after the fork() call.
exec() (family of calls, e.g., execl(), execvp(), etc.)
Replaces the child process's memory space with a new program.
Loads the executable file of the command to be run and starts its execution.
Does not return if successful—it replaces the current process image.
Using the program shown in Figure 3.30, explain what the output will be at LINE A.
Answer: The result is still 5, as the child updates its copy of value. When control returns to the parent, its value remains at 5.
Including the initial parent process, how many processes are created by the program shown in Figure 3.31?