Introduction
This presentation providesan overview of shell
scripting concepts, including control statements
and arithmetic operators, essential for effective
scripting practices.
Control Statements
Control statementsin shell scripting allow for decision-making and
flow control in scripts. They include structures such as if-else
statements, loops (for, while), and case statements, which help
execute certain commands based on conditions or repeat tasks under
specified criteria, ensuring scripts can adapt to various inputs and
situations.
5.
Use of ArithmeticOperators
Arithmetic operators are fundamental in shell scripting for
performing mathematical calculations. Common operators include
addition (+), subtraction (-), multiplication (*), division (/), and
modulus (%). These operators enable scripts to handle numeric data
dynamically, allowing calculations for variables and parameters.
6.
User and KernelMode
User mode and kernel mode are two distinct
execution environments in operating systems.
User mode restricts access to hardware and critical
operating system resources to ensure stability and
security. In contrast, kernel mode allows full access
to the system's hardware and memory, enabling
the execution of operating system processes.
Switching between these modes helps protect
system integrity while allowing user applications to
perform necessary tasks.
SJF Explanation
Shortest JobFirst (SJF) is a non-preemptive scheduling algorithm that
selects the process with the smallest execution time next. The
rationale behind SJF is to minimize waiting time and to improve
overall efficiency in the process queue. However, it may cause
starvation for longer processes, as shorter processes may
continuously arrive.
9.
Working of SJF
InSJF scheduling, the operating system maintains a queue of
processes and selects the one with the shortest burst time for
execution. When a new process arrives, the scheduler evaluates it
against the existing processes in the queue. If the new process has a
shorter burst time than the currently running process, it will be
queued until the current process completes, ensuring that overall
process turnaround time is minimized.
10.
Categories of System
Calls
Systemcalls are categorized based on their
functionality. The main categories include process
control (creating, managing, and terminating
processes), file management (creating, reading,
writing, and closing files), device management
(interacting with hardware devices), and
information maintenance (getting details like
system time, process status). Each category serves
a specific purpose in letting programs interact with
the operating system and underlying hardware.
11.
Conclusions
Shell scripting, controlstatements, and arithmetic operations are
essential for efficient programming. Understanding user and kernel
modes is critical in managing system resources. Scheduling
algorithms, like SJF, provide insights into process management, while
system calls enable necessary interactions with the operating system.