0% found this document useful (0 votes)
6 views43 pages

Unit I-Introduction To Operating System

Unit 1 operating system

Uploaded by

SOHAN BAGADE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views43 pages

Unit I-Introduction To Operating System

Unit 1 operating system

Uploaded by

SOHAN BAGADE
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 43

Unit I - Introduction to Operating System

Basics of Operating Systems:

What's the operating system?

An Operating System (OS) is an interface between a computer user and computer


hardware. An operating system is a software which performs all the basic tasks like
file management, memory management, process management, handling input and
output, and controlling peripheral devices such as disk drives and printers.

An Operating System is a System software that manages all the resources


of the computing device.

●​ Acts as an interface between the software and different parts of the

computer or the computer hardware.

●​ Manages the overall resources and operations of the computer.

●​ Controls and monitors the execution of all other programs that

reside in the computer, which also includes application programs

and other system software of the computer.

●​ Examples of Operating Systems are Windows, Linux, macOS,

Android, iOS, etc.


Objectives of Operating Systems
Let us now see some of the objectives of the operating system, which are

mentioned below.

●​ Convenient to use: One of the objectives is to make the computer

system more convenient to use in an efficient manner.

●​ User Friendly: To make the computer system more interactive with a

more convenient interface for the users.

●​ Easy Access: To provide easy access to users for using resources by

acting as an intermediary between the hardware and its users.

●​ Management of Resources: For managing the resources of a

computer in a better and faster way.


●​ Controls and Monitoring: By keeping track of who is using which

resource, granting resource requests, and mediating conflicting

requests from different programs and users.

●​ Fair Sharing of Resources: Providing efficient and fair sharing of

resources between the users and programs.

Services of Operating System

• Program execution

• I/O operations

• File System manipulation

• Communication

• Error Detection

• Resource Allocation

• Protection

Program execution
• Operating systems handle many kinds of activities from user programs to system
programs like printer spooler, name servers, file server, etc. Each of these activities are
encapsulated as a process.
• A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use).

Following are the major activities of an operating system with respect to program
management −
• Loads a program into memory.
• Executes the program.
• Handles program's execution.
• Provides a mechanism for process synchronization.
• Provides a mechanism for process communication.
• Provides a mechanism for deadlock handling.

I/O Operation
• An I/O subsystem comprises I/O devices and their corresponding driver software.
Drivers hide the peculiarities of specific hardware devices from the users.

• An Operating System manages the communication between user and device drivers.

• I/O operation means read or write operation with any file or any specific I/O device.

• The operating system provides the access to the required I/O device when required.

File system manipulation


• A file represents a collection of related information. Computers can store files on the
disk (secondary storage), for long-term storage purpose. Examples of storage media
include magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of
these media has its own properties like speed, capacity, data transfer rate and data access
Methods.

• Following are the major activities of an operating system with respect to file management

• The program needs to read a file or write a file.
• The operating system gives the permission to the program for operation on file.
• Permission varies from read-only, read-write, denied and so on.
• Operating System provides an interface to the user to create/delete files.
• Operating System provides an interface to the user to create/delete directories.

Communication

• In case of distributed systems which are a collection of processors that do not share
memory, peripheral devices, or a clock, the operating system manages communications
between all the processes. Multiple processes communicate with one another through
communication lines in the network.
Some activities are :

• Two processes often require data to be transferred between them


• Both the processes can be on one computer or on different computers, but are connected
through a computer network.

Error handling
• Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or
in the memory hardware. Following are the major activities of an operating system with
respect to error handling −
• The OS constantly checks for possible errors.
• The OS takes an appropriate action to ensure correct and consistent computing.

Resource Management
• In case of multi-user or multi-tasking environments, resources such as main memory,
CPU cycles and files storage are to be allocated to each user or job. Following are the
major activities of an operating system with respect to resource management −

• The OS manages all kinds of resources using schedulers.

Protection
• Considering a computer system having multiple users and concurrent execution of
multiple processes, the various processes must be protected from each other's activities.
• Protection refers to a mechanism or a way to control the access of programs, processes,
or users to the resources defined by a computer system.
• The OS ensures that all access to system resources is controlled.
• The OS ensures that external I/O devices are protected from invalid access attempts.

Function of Operating System

• Memory Management
• Processor Management
• Device Management
• File Management
• Security
• Resource sharing & protection
• Job accounting
• Error detection
• Coordination between other software and users (Accounting)

Memory management
Memory management refers to management of Primary Memory or Main Memory.
Main memory is a large array of words or bytes where each word or byte has its own
address.

-Main memory provides fast storage that can be accessed directly by the CPU. For a
program to be executed, it must be in the main memory. An Operating System does the
following activities for memory management −

-Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are
not in use.

-In multiprogramming, the OS decides which process will get memory when and how
much.

-Allocates the memory when a process requests it to do so.

-Deallocation of memory when a process no longer needs it or has been terminated.

Process management

In a multiprogramming environment, the OS decides which process gets the processor


when and for how much time. This function is called process scheduling.

An Operating System does the following activities for processor management −

-Keeps tracks of processor and status of process. The program responsible for this task is
known as traffic controller.

-Allocates the processor (CPU) to a process.

-De-allocates processors when a process is no longer required.


Device management

An Operating System manages device communication via their respective drivers.

It does the following activities for device management −


-Keeps tracks of all devices. The program responsible for this task is known as the I/O
controller.
-Decides which process gets the device when and for how much time.
-Allocates the device in an efficient way.

File management

A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions.

An Operating System does the following activities for file management −

-Keeps track of information, location, uses, status etc. The collective facilities are often
known as file systems.
-Decides who gets the resources.
-Allocates the resources.
-De-allocates the resources.

Security −

●​ By means of password and similar other techniques, it prevents unauthorized


access to programs and data.

●​ Control over system performance − Recording delays between request for a


service and response from the system.

●​ Job accounting − Keeping track of time and resources used by various jobs and
users.

Error detecting aids −


●​ Production of dumps, traces, error messages, and other debugging and error
detecting aids.

●​ Coordination between other softwares and users − Coordination of compilers,


interpreters, assemblers.

TYPES OF OPERATING SYSTEM

1. Batch Operating System

2. Time-Sharing Operating System

3. Embedded Operating System

4. Multiprogramming Operating System

5. Network Operating System

6. Distributed Operating System

7. Multiprocessing Operating System

Batch Operating System

The users of a batch operating system do not interact with the computer directly. Each
user prepares his job on an off-line device like punch cards and submits it to the computer
operator. To speed up processing, jobs with similar needs are batched together and run
as a group. The programmers leave their programs with the operator and the operator
then sorts the programs with similar requirements into batches.

The problems with Batch Systems are as follows −

Lack of interaction between the user and the job.


CPU is often idle, because the speed of the mechanical I/O devices is slower than the
CPU.
Multitasking OS

Multitasking is when multiple jobs are executed by the CPU simultaneously by switching
between them. Switches occur so frequently that the users may interact with each
program while it is running. An OS does the following activities related to multitasking −
The user gives instructions to the operating system or to a program directly, and receives
an immediate response.
The OS handles multitasking in the way that it can handle multiple operations/executes
multiple programs at a time. Multitasking Operating Systems are also known as
Time-sharing systems.
These Operating Systems were developed to provide interactive use of a computer system
at a reasonable cost.
A time-shared operating system uses the concept of CPU scheduling and
multiprogramming to provide each user with a small portion of a time- shared CPU.

Multiprogramming OS

When two or more programs reside in memory at the same time, it is referred to as
multiprogramming. Multiprogramming assumes a single shared processor.
Multiprogramming increases CPU utilization by organizing jobs so
that the CPU always has one to execute.

An OS does the following activities related to multiprogramming. The operating system


keeps several jobs in memory at a time.

This set of jobs is a subset of the jobs kept in the job pool. The operating system picks
and begins to execute one of the jobs in the memory.
Multiprogramming operating systems monitor the state of all active programs and system
resources using memory management programs to ensure that it is never idle, unless there
are no jobs to process.

Time sharing Operating System

Time-sharing is a technique which enables many people, located at various terminals, to


use a particular computer system at the same time. Time-sharing or multitasking is a
logical extension of multiprogramming. Processor's time which is shared among
multiple users simultaneously is termed as time-sharing.
Advantages of Timesharing operating systems are as follows −
●​ Provides the advantage of quick response.
●​ Avoids duplication of software.
●​ Reduces CPU idle time.
●​
Disadvantages of Time-sharing operating systems are as follows −

●​ Problem of reliability.
●​ Question of security and integrity of user programs and data.

Distributed Operating System

Distributed systems use multiple central processors to serve multiple real- time
applications and multiple users. Data processing jobs are distributed among the
processors accordingly.
The processors communicate with one another through various communication lines
(such as high-speed buses or telephone lines). These are referred to as loosely coupled
systems or distributed systems. Processors in a distributed system may vary in size and
function. These processors are referred to as sites, nodes, computers, and so on.

The advantages of distributed systems are as follows −

●​ Speedup the exchange of data with one another via electronic mail.
●​ If one site fails in a distributed system, the remaining sites can potentially
continue operating.
●​ Better service to the customers.
●​ Reduction of the load on the host computer.
●​ Reduction of delays in data processing.

Network Operating System

A Network Operating System runs on a server and provides the server the capability to
manage data, users, groups, security, applications, and other networking functions. The
primary purpose of the network operating system is to allow shared file and printer access
among multiple computers in a network, typically a local area network (LAN), a private
network or to other networks.
Examples of network operating systems include Microsoft Windows Server 2003,
Microsoft Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD.

Real time Operating System


A real-time system is defined as a data processing system in which the time interval
required to process and respond to inputs is so small that it controls the environment. The
time taken by the system to respond to an input and display of required updated
information is termed as the response time. So in this method, the response time is very
less as compared to online processing.

Example: Scientific experiments, medical imaging systems, industrial control systems,


weapon systems, robots, air traffic control systems, etc.

Introduction of System Call


A system call is a programmatic way in which a computer program requests
a service from the kernel of the operating system on which it is executed. A
system call is a way for programs to interact with the operating system. A
computer program makes a system call when it requests the operating
system's kernel. System call provides the services of the operating system to
the user programs via the Application Program Interface(API). System calls
are the only entry points into the kernel system and are executed in kernel
mode.
●​ A user program can interact with the operating system using a

system call. A number of services are requested by the program,

and the OS responds by launching a number of systems calls to

fulfill the request.

●​ A system call can be written in high-level languages like C or Pascal

or in assembly language. If a high-level language is used, the

operating system may directly invoke system calls, which are

predefined functions.

●​ A system call is initiated by the program executing a specific

instruction, which triggers a switch to kernel mode, allowing the

program to request a service from the OS. The OS then handles the

request, performs the necessary operations, and returns the result

back to the program.


●​ System calls are essential for the proper functioning of an operating

system, as they provide a standardized way for programs to access

system resources. Without system calls, each program would need

to implement its methods for accessing hardware and system

services, leading to inconsistent and error-prone behavior.

Services Provided by System Calls


●​ Process Creation and Management

●​ Main Memory Management

●​ File Access, Directory, and File System Management

●​ Device Handling(I/O)

●​ Protection

●​ Networking, etc.

○​ Process Control: end, abort, create, terminate,

allocate, and free memory.

○​ File Management: create, open, close, delete, read

files, etc.

○​ Device Management

○​ Information Maintenance

○​ Communication

Features of System Calls


●​ Interface: System calls provide a well-defined interface between

user programs and the operating system. Programs make requests

by calling specific functions, and the operating system responds by

executing the requested service and returning a result.

●​ Protection: System calls are used to access privileged operations

that are not available to normal user programs. The operating

system uses this privilege to protect the system from malicious or

unauthorized access.

●​ Kernel Mode: When a system call is made, the program is

temporarily switched from user mode to kernel mode. In kernel

mode, the program has access to all system resources, including

hardware, memory, and other processes.

●​ Context Switching: A system call requires a context switch, which

involves saving the state of the current process and switching to the

kernel mode to execute the requested service. This can introduce

overhead, which can impact system performance.

●​ Error Handling: System calls can return error codes to indicate

problems with the requested service. Programs must check for

these errors and handle them appropriately.

●​ Synchronization: System calls can be used to synchronize access to

shared resources, such as files or network connections. The

operating system provides synchronization mechanisms, such as


locks or semaphores, to ensure that multiple programs can access

these resources safely.

How does System Call Work?


Here is a detailed explanation step by step how system calls work:

●​ Users need special resources: Sometimes programs need to do

some special things that can't be done without the permission of the

OS like reading from a file, writing to a file, getting any information

from the hardware, or requesting a space in memory.

●​ The program makes a system call request: There are special

predefined instructions to make a request to the operating system.

These instructions are nothing but just a "system call". The program

uses these system calls in its code when needed.

●​ Operating system sees the system call: When the OS sees the

system call then it recognizes that the program needs help at this

time so it temporarily stops the program execution and gives all the

control to a special part of itself called 'Kernel'. Now 'Kernel' solves

the need of the program.

●​ The operating system performs the operations: Now the operating

system performs the operation that is requested by the program.

Example: reading content from a file etc.


●​ Operating systems give control back to the program : After

performing the special operation, the OS gives control back to the

program for further execution of the program.

Types of System Calls


Services provided by an OS are typically related to any kind of operation that
a user program can perform like creation, termination, forking, moving,
communication, etc. Similar types of operations are grouped into one single
system call category. System calls are classified into the following categories:

1. File System Operations


These system calls are made while working with files in OS, File
manipulation operations such as creation, deletion, termination etc.

●​ open(): Opens a file for reading or writing. A file could be of any

type like text file, audio file etc.


●​ read(): Reads data from a file. Just after the file is opened through

an open() system call, then if some process wants to read the data

from a file, then it will make a read() system call.

●​ write(): Writes data to a file. Whenever the user makes any kind of

modification in a file and saves it, that's when this is called.

●​ close(): Closes a previously opened file.

●​ seek(): Moves the file pointer within a file. This call is typically made

when the user tries to read the data from a specific position in a file.

For example, read from line - 47. Then the file pointer will move

from line 1 or wherever it was previously to line-47.

2. Process Control
These types of system calls deal with process creation, process termination,
process allocation, deallocation etc. Basically manages all the processes that
are a part of the OS.

●​ fork(): Creates a new process (child) by duplicating the current

process (parent). This call is made when a process makes a copy of

itself and the parent process is halted temporarily until the child

process finishes its execution.

●​ exec(): Loads and runs a new program in the current process and

replaces the current process with a new process. All the data such

as stack, register, heap memory everything is replaced by a new

process and this is known as overlay. For example, when you


execute a java byte code using command - java "filename". Then in

the background, exec() call will be made to execute the java file and

JVM will also be executed.

●​ wait(): The primary purpose of this call is to ensure that the parent

process doesn't proceed further with its execution until all its child

processes have finished their execution. This call is made when one

or more child processes are forked.

●​ exit(): It simply terminates the current process.

●​ kill(): This call sends a signal to a specific process and has various

purposes including - requesting it to quit voluntarily, or force quit, or

reload configuration.

3. Memory Management
These types of system calls deal with memory allocation, deallocation &
dynamically changing the size of a memory allocated to a process. In short,
the overall management of memory is done by making these system calls.

●​ brk(): Changes the data segment size for a process in HEAP

Memory. It takes an address as an argument to define the end of the

heap and explicitly sets the size of HEAP.

●​ sbrk(): This call is also for memory management in heap, it also

takes an argument as an integer (+ve or -ve) specifying whether to

increase or decrease the size respectively.


●​ mmap(): Memory Map - It basically maps a file or device into main

memory and further into a process's address space for performing

operations. And any changes made in the content of a file will be

reflected in the actual file.

●​ munmap(): Unmaps a memory-mapped file from a process's

address space and out of main memory

●​ mlock() and unlock(): memory lock defines a mechanism through

which certain pages stay in memory and are not swapped out to the

swap space in the disk. This could be done to avoid page faults.

Memory unlock is the opposite of lock, it releases the lock previously

acquired on pages.

4. Interprocess Communication (IPC)


When two or more processes are required to communicate, then various IPC
mechanisms are used by the OS which involves making numerous system
calls. Some of them are :

●​ pipe(): Creates a unidirectional communication channel between

processes. For example, a parent process may communicate to its

child process through a pipe making a parent process as input

source of its child process.

●​ socket(): Creates a network socket for communication. Processes in

same or other networks can communicate through this socket,

provided that they have necessary network permissions granted.


●​ shmget(): It is short for - 'shared-memory-get'. It allows one or

more processes to share a portion of memory and achieve

interprocess communication.

●​ semget(): It is short for - 'semaphore-get'. This call typically

manages the coordination of multiple processes while accessing a

shared resource that is, the critical section.

●​ msgget(): It is short for - 'message-get'. The IPC mechanism has

one of the fundamental concepts called - 'message queue' which is

a queue data structure inside memory through which various

processes communicate with each other. This message queue is

allocated through this call allowing other processes a structured

way of communication for data exchange purposes.

5. Device Management
The device management system calls are used to interact with various
peripheral devices attached to the PC or even the management of the current
device.

●​ SetConsoleMode(): This call is made to set the mode of the console

(input or output). It allows a process to control various console

modes. In windows, it is used to control the behaviour of the

command line.

●​ WriteConsole(): It allows us to write data on the console screen.


●​ ReadConsole(): It allows us to read data from the console screen (if

any arguments are provided).

●​ open(): This call is made whenever a device or a file is opened. A

unique file descriptor is created to maintain the control access to the

opened file or device.

●​ close(): This call is made when the system or the user closes the file

or device.

Importance of System Calls


●​ Efficient Resource Management: System Calls help your computer

manage its resources efficiently. They allocate and manage memory

so programs run smoothly without using up too many resources.

This is important for multitasking and overall performance.

●​ Security and Isolation: System Calls ensure that one program

cannot interfere with or access the memory of another program.

This enhances the security and stability of your device.

●​ Multitasking Capabilities: System Calls support multitasking,

allowing multiple programs to run simultaneously. This improves

productivity and makes it easy to switch between applications.

●​ Enhanced Control: System Calls provide a high level of control over

your device’s operations. They allow you to start and stop

processes, manage files, and perform various system-related tasks.


●​ Input/Output (I/O) Operations: System Calls enable communication

with input and output devices, such as your keyboard, mouse, and

screen. They ensure that these devices work effectively.

●​ Networking and Communication: System Calls facilitate

networking and communication between different applications.

They make it easy to transfer data over networks, browse the web,

send emails, and connect online.

What is The Purpose of System Calls in OS?


System Calls act as a bridge between an operating system (OS) and a
running program. They are usually written as assembly language instructions
and are detailed in manuals for programmers working with assembly
language.

When a program running in user mode needs to access a resource, it makes a


System Call. This request is sent to the OS kernel to obtain the needed
resource.

System Calls are used for various tasks, such as:

●​ Creating or executing files in the file system.

●​ Reading from and writing to files.

●​ Developing and managing new procedures in programs.

●​ Making network connections, including sending and receiving data

packets.

●​ Accessing hardware devices like printers and scanners.


Conclusion
System calls are a great way to take full advantage of the services provided
by the kernel. Every system call is made in the background completely
hidden from the user. And every action you perform in a computer like
creating, deleting, copying and other operations have many system calls
done in the background which are hidden from the user for simplicity.

●​ System calls define an interface between the user-level applications

and the kernel.

●​ These are examples of some of the most common system calls,

however there are many system calls, some of them even specific to

an Operating System.

●​ The system calls name may vary depending upon the OS but the

overall functionality will be the same.

●​ System calls provide a high-level abstraction and simplify the

process of interacting with low level hardware components which

the computer users don't typically have to worry about.

Operating Systems Structures


System Structure for an Operating System?

A system structure for an operating system is like the blueprint of how an


OS is organized and how its different parts interact with each other.
Because operating systems have complex structures, we want a structure
that is easy to understand so that we can adapt an operating system to meet
our specific needs. Similar to how we break down larger problems into
smaller, more manageable subproblems, building an operating system in
pieces is simpler. The operating system is a component of every segment.
The strategy for integrating different operating system components within
the kernel can be thought of as an operating system structure. As will be
discussed below, various types of structures are used to implement
operating systems.

Types of Operating Systems Structures

Depending on this, we have the following structures in the operating


system:

●​ Simple Structure
●​ Monolithic Structure
●​ Micro-Kernel Structure
●​ Hybrid-Kernel Structure
●​ Exo-Kernel Structure
●​ Layered Structure
●​ Modular Structure
●​ Virtual Machines

Simple Structure
Simple structure operating systems do not have well-defined structures and
are small, simple, and limited. The interfaces and levels of functionality
are not well separated. MS-DOS is an example of such an operating
system. In MS-DOS, application programs are able to access the basic I/O
routines. These types of operating systems cause the entire system to crash
if one of the user programs fails.

Simple OS Structure

Advantages of Simple Structure


●​ It delivers better application performance because of the few
interfaces between the application program and the hardware.
●​ It is easy for kernel developers to develop such an operating
system.

Disadvantages of Simple Structure

●​ The structure is very complicated, as no clear boundaries exist


between modules.
●​ It does not enforce data hiding in the operating system.

Monolithic Structure

A monolithic structure is a type of operating system architecture where the


entire operating system is implemented as a single large process in kernel
mode. Essential operating system services, such as process management,
memory management, file systems, and device drivers, are combined into a
single code block.

Advanatages of Monolithic Structure

●​ Performance of Monolithic structure is fast as since everything


runs in a single block, therefore communication between
components is quick.
●​ It is easier to build because all parts are in one code block.

Disadvanatges of Monolithic Architecture

●​ It is hard to maintain as a small error can affect the entire system.


●​ There are also some security risks in the Monolithic architecture.

Micro-Kernel Structure

Micro-Kernel structure designs the operating system by removing all


non-essential components from the kernel and implementing them as
system and user programs. This results in a smaller kernel called the
micro-kernel. Advantages of this structure are that all new services need to
be added to user space and does not require the kernel to be modified. Thus
it is more secure and reliable as if a service fails, then the rest of the
operating system remains untouched. Mac OS is an example of this type of
OS.

Advantages of Micro-kernel Structure

●​ It makes the operating system portable to various platforms.


●​ As microkernels are small so these can be tested effectively.

Disadvantages of Micro-kernel Structure


●​ Increased level of inter module communication degrades system
performance.

Hybrid-Kernel Structure

Hybrid-Kernel structure is nothing but just a combination of both


monolithic-kernel structure and micro-kernel structure. Basically, it
combines properties of both monolithic and micro-kernel and makes a
more advance and helpful approach. It implements speed and design of
monolithic and modularity and stability of micro-kernel structure.

Advantages of Hybrid-Kernel Structure

●​ It offers good performance as it implements the advantages of


both structures in it.
●​ It supports a wide range of hardware and applications.
●​ It provides better isolation and security by implementing a
micro-kernel approach.
●​ It enhances overall system reliability by separating critical
functions into micro-kernel for debugging and maintenance.

Disadvantages of Hybrid-Kernel Structure


●​ It increases the overall complexity of a system by implementing
both structure (monolithic and micro) and making the system
difficult to understand.
●​ The layer of communication between the micro-kernel and other
components increases time complexity and decreases performance
compared to monolithic kernels.

Exo-Kernel Structure

Exokernel is an operating system developed at MIT to provide


application-level management of hardware resources. By separating
resource management from protection, the exokernel architecture aims to
enable application-specific customization. Due to its limited operability,
exokernel size typically tends to be minimal.

The OS will always have an impact on the functionality, performance, and


scope of the apps that are developed on it because it sits in between the
software and the hardware. The exokernel operating system makes an
attempt to address this problem by rejecting the notion that an operating
system must provide abstractions upon which to base applications. The
objective is to limit developers' use of abstractions as little as possible
while still giving them freedom.

Advantages of Exo-Kernel
●​ Support for improved application control.
●​ Separates management from security.
●​ It improves the performance of the application.
●​ A more efficient use of hardware resources is made possible by
accurate resource allocation and revocation.
●​ It is simpler to test and create new operating systems.
●​ Each user-space program is allowed to use a custom memory
management system.

Disadvantages of Exo-Kernel

●​ A decline in consistency.
●​ Exokernel interfaces have a complex architecture.

Layered Structure

An OS can be broken into pieces and retain much more control over the
system. In this structure, the OS is broken into a number of layers (levels).
The bottom layer (layer 0) is the hardware, and the topmost layer (layer N)
is the user interface. These layers are so designed that each layer uses the
functions of the lower-level layers. This simplifies the debugging process,
if lower-level layers are debugged and an error occurs during debugging,
then the error must be on that layer only, as the lower-level layers have
already been debugged. The main disadvantage of this structure is that at
each layer, the data needs to be modified and passed on which adds
overhead to the system. Moreover, careful planning of the layers is
necessary, as a layer can use only lower-level layers. UNIX is an example
of this structure.

Layered OS Structure

Advantages of Layered Structure


●​ Layering makes it easier to enhance the operating system, as the
implementation of a layer can be changed easily without affecting
the other layers.
●​ It is very easy to perform debugging and system verification.

Disadvantages of Layered Structure

●​ In this structure, the application's performance is degraded as


compared to simple structure.
●​ It requires careful planning for designing the layers, as the higher
layers use the functionalities of only the lower layers.

Modular Structure

It is considered as the best approach for an OS. It involves designing of a


modular kernel. The kernel has only a set of core components and other
services are added as dynamically loadable modules to the kernel either
during runtime or boot time. It resembles layered structure due to the fact
that each kernel has defined and protected interfaces, but it is more flexible
than a layered structure as a module can call any other module.

Virtual Machines (VMs)

Based on our needs, a virtual machine abstracts the hardware of our


personal computer, including the CPU, disc drives, RAM, and NIC
(Network Interface Card), into a variety of different execution contexts,
giving us the impression that each execution environment is a different
computer. An illustration of it is a virtual box.

An operating system enables us to run multiple processes concurrently


while making it appear as though each one is using a different processor
and virtual memory by using CPU scheduling and virtual memory
techniques.

The fundamental issue with the virtual machine technique is disc systems.
Let's say the physical machine only has three disc drives, but it needs to
host seven virtual machines. The program that creates virtual machines
would need a significant amount of disc space in order to provide virtual
memory and spooling, so it should be clear that it is impossible to assign a
disc drive to every virtual machine. The answer is to make virtual discs
available.

Conclusion

Operating systems can be built using various structures, each affecting how
components interact within the kernel. These structures include
Simple/Monolithic, Micro-Kernel, Hybrid-Kernel, Exo-Kernel, Layered,
Modular, and Virtual Machines. The structure chosen influences the ease
of use, modification, and overall efficiency. By breaking down the OS into
manageable parts, developers can create more adaptable and robust
systems.

What is Linux Operating System


Linux is based on the UNIX operating system. UNIX is a powerful, multi-user,

multitasking operating system originally developed in the 1970s at AT&T

Bell Labs. It laid the foundation for many modern operating systems,

including Linux.

●​ Linux is free and open-source, accessible to everyone.

●​ Its source code can be inspected and modified by anyone.

●​ This promotes global collaboration and innovation.

●​ Linux offers efficient performance and strong security.

●​ It works well across many devices and industries.

The Linux Operating System is a Unix-like operating system that combines a

wide range of open-source tools and components to form a complete

computing environment. These components include file systems, user

interfaces, system utilities, and application programs—all working together

to manage hardware and enable users to interact with their computer

systems.
Why use Linux?
Because it is free, open-source, and extremely flexible, Linux is widely

utilized. For servers and developers, it is the ideal option because it offers

strong security, stability, and performance. Generally interoperable hardware,

a broad software library, and a vibrant community that offers support and

regular updates are the many benefits of Linux. Due to its adaptability, users

can customize the operating system according to their own needs, whether

they become for personal or large enterprise use.

Basic Shell Commands in Linux:


The Linux shell serves as an interface for users to interact with the operating

system. Mastering its commands can greatly enhance your efficiency,

whether you’re a system administrator or a developer. In this guide, we’ll

introduce some of the most fundamental Linux commands, covering file

management, system monitoring, and command syntax, along with practical

examples. By the end, you’ll have the knowledge needed to perform

everyday tasks confidently in the Linux command-line environment.

What are Shell Commands in Linux?


A shell in Linux is a program that serves as an interface between the user

and the operating system. It accepts commands from the user, interprets

them, and passes them to the operating system for execution. The
commands can be used for a wide range of tasks, from file manipulation to

system management.

Some of the essential basic shell commands in Linux for different operations

are:

●​ File Management -> cp, mv, rm, mkdir

●​ Navigation -> cd, pwd, ls

●​ Text Processing -> cat, grep, sort, head

●​ System Monitoring -> top, ps, df

●​ Permissions and Ownership -> chmod, chown, chgrp

●​ Networking - > ping, wget, curl, ssh, scp, ftp

●​ Compression and Archiving - > tar, gzip, gunzip, zip, unzip

●​ Package Management - > dnf, yum, apt-get

●​ Process Management -> kill, killall, bg, killall, kill

Basic Shell Commands for File and Directory

Management:
Command Description Example

ls Lists files and directories ls

cd

cd Changes the current directory /home/user/Document

Displays the current directory


pwd pwd
path

mkdir Creates a new directory mkdir new_directory

rm Removes files or directories rm file.txt


cp file1.txt
cp Copies files or directories
file2.txt

Moves or renames files and mv old_name


mv
directories new_name

Creates an empty file or


touch touch newfile.txt
updates file timestamps

Examples:

1. List files in a directory:


ls

2. Change directory:
cd/home/user

3. Create a new directory:


mkdir new_directory

4. Copy a file from one location to another:


cp source.txt destination.txt
5. Remove a file:
rm file.txt

Text Processing Commands in Linux

Command Description Example

cat Displays the contents of a file cat file.txt

grep "error"
grep Searches for a pattern in a file
log.txt

sort Sorts the contents of a file sort file.txt

head Displays the first few lines of a file head file.txt

tail Displays the last few lines of a file tail file.txt


Counts the lines, words, and
wc wc file.txt
characters in a file

Examples:

1. Display the contents of a file:


cat file.txt

2. Search for a pattern in a file:


grep "error" file.txt

3. Sort the contents of a file:


sort file.txt

4. Display the first 10 lines of a file:


head file.txt

5. Display the last 10 lines of a file:


tail file.txt

File Permissions and Ownership Commands

Command Description Example


chmod Changes file permissions chmod 755 file.txt

Changes file owner and chown user:group


chown
group file.txt

Changes file group


chgrp chgrp group file.txt
ownership

Examples:

1. Change permissions of a file:


chmod 755 file.txt

2. Change the owner of a file:


chown user:group file.txt

System Monitoring and Process Management

Commands
Command Description Example

Displays real-time system information


top top
(CPU, memory)

ps Displays the list of running processes ps aux

kill Terminates a process by its ID kill 1234

df Displays disk space usage df -h

Examples:

1. View running processes:


ps aux

2. Display real-time system statistics:


top
3. Kill a process by its ID:
kill 1234

4. Check disk space usage:


df -h

You might also like