Operating System Unit IV
Operating System Unit IV
Evolution of Linux
1991: Initial Release:
Linus Torvalds announced the Linux kernel, inspired by the Unix operating system.
1992: GNU GPL Licensing:
The Linux kernel was relicensed under the GNU General Public License, making it
open-source.
1993-1994: Community Growth and Development:
The developer community expanded, and version 1.0 of the kernel was released in
1994.
1995-1998: Wider Adoption and Support:
Linux was ported to different hardware platforms, and major companies began
announcing their support,
1. Kernel:
Kernel is the main core component if Linux, it controls the activity of other
hardware components. It visualizes the common hardware resources and provide
each process with necessary virtual resources. It makes the process to wait in the
ready queue and execute in consequently to avoid any kind of conflict.
Different of types of kernel:
Monolithic Kernel: Monolithic kernel is a type of operating system kernel,
where all the concurrent processes are executed simultaneously in the
kernel itself. All the processes share same memory recourses.
Micro kernel: In micro kernel user services and kernel services are executed
in separate address spaces. User services are kept in user address space
and kernel services are kept in kernel address space.
Exokernel: Exo-kernel is designed to manage hardware resources at
application level. High level abstraction is used in this operating system to
offer hardware resources access to kernel.
Hybrid kernel: It is the combination of both monolithic kernel and
microkernel. It has speed and design of monolithic kernel and modularity
and stability of microkernel.
2. System Library:
System libraries are some predefined functions by using which any application
programs or system utilities can access kernel's features. These libraries are the
foundation upon which any software can be built.
Some of the most common system libraries are:
GNU C library: This is the C library that provides the most fundamental
system for the interface and execution of C programs. This provides may in-
built functions for the execution.
libpthread (POSIX Threads): This library plays important role for
multithreading in Linux, it allows users for creating and managing multiple
threads.
libdl (Dynamic Linker): This library is responsible for the loading and linking
file at the runtime.
libm (Math Library): This library provides user with all kind of mathematical
function and their execution.
3. Shell:
Shell can be determined as the interface to the kernel, which hides the internal
execution of functions of kernel from the user. Users can just enter the commend
and using the kernel's function that specific task is performed accordingly.
Linux shell
4. Hardware Layer:
Hardware layer of Linux is the lowest level of operating system track. It plays a
vital role in managing all the hardware components. It includes device drivers,
kernel functions, memory management, CPU control, and I/O operations. This
layer generalizes hard complexity, by providing an interface for software by
assuring proper functionality of all the components.
5. System utility:
System utilities are the commend line tools that preforms various tasks provided
by user to make system management and administration better. These utilities
enable user to perform different tasks, such as file management, system
monitoring, network configuration, user management etc.
Linux Commands
1. Directory Navigation:
ls: Lists files and directories in the current directory.
cd: Changes the current working directory.
pwd: Prints the current working directory.
mkdir: Creates a new directory.
rmdir: Removes an empty directory.
2. File Management:
cp: Copies files or directories.
mv: Moves or renames files or directories.
rm: Removes files or directories.
touch: Creates an empty file or updates the last modified time of an
existing file.
cat: Displays the contents of a file.
echo: Prints text to the terminal.
less: Displays file contents interactively, page by page.
4. Networking:
ping: Tests connectivity to a remote host.
traceroute: Traces the route packets take to a remote host.
ssh: Securely connects to a remote server.
scp: Securely copies files between systems.
wget: Downloads files from the web.
curl: Transfers data using various protocols.
Shell Scripting
Usually, shells are interactive, which means they accept commands as
input from users and execute them. However, sometimes we want to
execute a bunch of commands routinely, so we have to type in all
commands each time in the terminal.
As a shell can also take commands as input from file, we can write
these commands in a file and can execute them in shell to avoid this
repetitive work. These files are called Shell Scripts or Shell Programs.
Shell scripts are similar to the batch file in MS-DOS. Each shell script is
saved with `.sh` file extension e.g., myscript.sh.
A shell script has syntax just like any other programming language.
A shell script comprises the following elements –
Shell Keywords - if, else, break etc.
Shell commands - cd, ls, echo, pwd, touch etc.
Functions
Control flow - if..then..else, case and shell loops etc.
External Commands:
1. Definition: Standalone programs stored as executable files on the
file system.
2. Execution: The shell needs to locate the executable file (often
through the PATH variable) and then launch it.
3. Speed: Slower than internal commands due to the overhead of
loading and launching.
4. Examples: ls, cat, grep, df
1. Created: A process is created when a program is executed. At this stage, the process is
in a "created" state, and its data structures are initialized.
2. Ready: The process enters the "ready" state when it is waiting to be assigned to a
processor by the Linux scheduler. At this stage, the process is waiting for its turn to
execute.
3. Running: The process enters the "running" state when it is assigned to a processor and
is actively executing its instructions.
4. Waiting: The process enters the "waiting" state when it is waiting for some event to
occur, such as input/output completion, a signal, or a timer. At this stage, the process is
not actively executing its instructions.
5. Terminated: The process enters the "terminated" state when it has completed its
execution or has been terminated by a signal. At this stage, the process data structures
are removed, and its resources are freed.
6. Zombie: A process enters the "zombie" state when it has completed its execution but
its parent process has not yet read its exit status. At this stage, the process details still
have an entry in the process table, but it does not execute any instructions. The zombie
process is removed from the process table when its parent process reads its exit status.