Nothing Special   »   [go: up one dir, main page]

Chapter 3

Download as pdf or txt
Download as pdf or txt
You are on page 1of 45

Chapter 3

Operating System Support


3.1 Distributed Operating System
3.2 Network Operating System
3.3 Operating System Layer
3.4 Protection
3.5 Kernel
3.6 Process and Threads
3.6.1 Process
3.6.2 Threads
3.7 Communication and Invocation
3.8 Operating System Architecture
What is an Operating System?

A program between computer users and computer
hardware™ to manage and use computer hardware in an
efficient manner

Operating system goals:
-To provide an environment for users to execute programs
in a convenient and efficient manner
-™ To ensure the correct operation of the computer system
Operating System Definition

OS is a resource allocator
-Manages all resources
-Decides between conflicting requests for efficient and
fair resource use

OS is a control program
- Controls execution of programs to prevent errors and
improper use of the computer.
Basic Concepts

The two dominating factors as important needs
in the field of computing / information access:
1. The need for physically distributed hardware:
Distributed system
2. The need for logically centralized
software :Distributed operating system
3.1 Distributed Operating System

A distributed operating system,is a specific type of operating system designed
to manage and coordinate the resources and processes of a distributed system.

It provides an abstraction layer that hides the distributed nature of the
underlying hardware and enables transparent access to resources.

A distributed operating system facilitates resource sharing, communication, and
coordination among the nodes in a distributed system.

It often includes features such as distributed file systems, process migration,
inter-process communication mechanisms, and fault tolerance mechanisms.

Examples of distributed operating systems include Google's Google File
System (GFS) and the Andrew File System (AFS).
Note:
-a distributed system is a broad concept referring to a collection of independent computers
working together,
- while a distributed operating system is a specific type of software that manages and
coordinates the resources and processes within a distributed system.
Characteristics of DOS

Hide and manage hardware and software resources

™ provides transparency support

™ provide heterogeneity support

™ control network in most effective way

™ Inter-process communication (IPC)

remote file and device access

synchronization and deadlock avoidance

resource allocation and protection

global resource sharing

deadlock avoidance

communication security
Advantages of Distributed Operating
System

With resources sharing facility, a user at one site may be able to use the
resources available at another .

Speedup the exchange of data with one another via electronic mail.

Failure of one site in a DS does not affect the others.

Since resources are being shared, computation is highly fast and durable.

These systems are easily scalable as many systems can be easily added
to the network.

Better service to the customer.
3.2 Network Operating System

A network operating system (NOS) is an operating system specifically designed to support and
manage network resources and services.

It provides the necessary functionality to enable computers and devices within a network to
communicate, share resources, and coordinate their activities.

NOS is software that connects multiple devices and computers on the network and allows them to
share resources on the network.

The primary purpose of a network operating system is to facilitate the efficient and secure operation
of a computer network.

NOS is an OS that allows multiple resources to communicate, share files and hardware devices
with each other, for example: UNIX, Mac, windows.

Over a small private network, these OS allow shared access to files, printers, security, applications
and other networking functions.

All users are aware of the underlying configurations, as well as the identities of all other users on
the network, their individual connections, and so on, which is why these computers are referred to
as tightly coupled systems.
Characteristics of NOS
a. Network Management:

A network operating system includes tools and utilities for managing and administering the
network infrastructure.

It allows network administrators to configure, monitor, and control network devices, such as
routers, switches, and servers, to ensure smooth network operation.
b. User and Authentication Management:

Network operating systems provide user and authentication management features.

They allow network administrators to create and manage user accounts, control access to
network resources, and enforce security policies.

User authentication mechanisms, such as usernames and passwords, are typically used to
verify user identities.
c. File and Print Services:

NOSs often include file and print services to facilitate resource sharing within the network.

These services enable users to store and access files on shared network drives and printers,
allowing for centralized management and control.
d. Network Protocols and Services:

Network operating systems support a variety of network protocols and services, such as TCP/IP,
DHCP, DNS, and FTP.

These protocols enable communication, address assignment, name resolution, and file transfer
between networked devices.

e. Security and Access Control:



NOSs incorporate security measures to protect network resources and data.

They provide features like access control lists (ACLs), firewalls, encryption, and intrusion detection
systems to safeguard against unauthorized access and potential threats.

f. Fault Tolerance and High Availability:



Network operating systems often include mechanisms for fault tolerance and high availability.

They can employ techniques such as redundancy, load balancing, and failover to ensure
uninterrupted network operation and minimize service disruptions.

g. Remote Access and Virtual Private Networks (VPNs):



NOSs typically support remote access capabilities, allowing users to connect to the network from
outside locations securely.

They may include VPN functionality to establish encrypted connections over public networks,
providing secure remote access to network resources.

Network operating systems can be found in various
environments, including small office/home office
(SOHO) networks, enterprise networks, and data
centers.

Examples of network operating systems include
Microsoft Windows Server, Linux distributions tailored
for network environments (such as CentOS or Ubuntu
Server), Novell NetWare, and Apple macOS Server.
Advantages of NOS

Highly scalable centralized servers.

Security concerns are handled through servers.

New technologies and hardware up- gradation
are easily integrated into the system.

Server access is possible remotely from
different locations and types of systems.
Disadvantages of NOS

Depend on the central location to perform the
operations.

High cost to buying server.

Regular updating and maintenance are
required.
Difference between NOS and DOS
S.N. Network Operating System Distributed Operating System

1. Network Operating System‘s main Distributed Operating System’s main


objective is to provide the local objective is to manage the hardware
services to remote client. resources.

2. In Network Operating System, In Distributed Operating System,


Communication takes place on the Communication takes place on the basis of
basis of files. messages and shared memory.

3. Network Operating System is more Distributed Operating System is less scalable


scalable than Distributed Operating than Network Operating System.
System.
4. In Network Operating System, fault While in Distributed Operating System, fault
tolerance is less. tolerance is high.
5. Ease of implementation in Network While in Distributed Operating System
Operating System is also high. Ease of implementation is less.

6. In Network Operating System, All While in Distributed Operating


nodes can have different operating System, All nodes have same
system. operating system.
3.3 Operating System Layer

As we know, there are many processes that a task undergoes before executing in a system.

These processes are performed by different parts of a system may be software, hardware, etc.

All these sections of processes are termed layers and this concept of arranging different tasks into
various layers is called the Layered Structure of Operating System.

The bottom-most layer (layer 0)is the hardware and the top layer is the user interface.

There are many things such as memory, software, microprocessors, etc that combine to form a proper
system.

The construction and debugging of the layered structure are easy and simple.

Each of the layers relies on a layer that is below it.

The construction of layers is made in such a way that each of the layers uses the function only of its
lower layer levels.

In this approach, the job execution starts to execute from the lowest layer and moves towards the
topmost layer.

If there is any technical fault in any layer or if any layer does not work, then there will be an error only
due to that particular layer.

As we can see there are different `layers of components of a system.

This layering helps the user to modify or update the inner workings and we can
also increase the modularity of a task.

The inner workings can be updated as long as the external interface is not
disturbed by the user.

The main positive point of this structure is its construction and debugging are
simple and easy. But we can get difficulty describing each of these layers.

But there are also some negative points of this structure. We need to modify
that data and pass it on to each layer, which ultimately leads to overhead in
the system. An example of this type of operating system structure is UNIX.
Why Layering is Important in Operating
Systems?

Layering in Operating System provides some significant features to the operating
system.

All the layers of an operating system are defined separately and each of them interacts
with the other as per the requirement.

Layering is easy to create and its maintenance is also simple as there is a specified
layer for a particular type of task.

If we do modification in one layer then it does not affect the other layers. These are
limited to a particular layer only.

The interaction of a particular layer is only done with two layers that are one layer above
it and a second layer below it.

It is a must as it allows one to retain control over workflow or operating system.

This is the rule of the architecture of the layered operating system
Architecture of Layered Structure

This type of OS was created as an improvement over the early monolithic system.

The OS is split into various layers in the layered OS and each of the layers has
different functionalities.

There are some rules in the implementation of the layers as follows:
- a particular layer can access all the layers present below it, but it cannot access
them. That is layer n-1 can access all the layers from n-2 to 0 but it cannot access the
nth.
- layer 0 deals with allocating the processes, switching between processes when
interruptions occurs or the time expires.

Thus if the user layer wants to interact with the hardware layer, the response will be
traveled through all the layers from n-1 to 1.

Each layer must be designed and implemented such that it will need only the services
provided by the layers below it.

There are 6 layers in the layered OS as shown in figure:
1. Hardware:

This layer interacts with the system hardware and coordinates with all the peripheral devices used
such as a printer, mouse, keyboard etc.

This type of hardware devices are managed in the hardware layer.
2. CPU Scheduling:

This layer deals with scheduling the processes for the CPU.

Many scheduling queues are used to handle processes.

When the processes enter the system, they are put into the job queues.

The processes that are ready to execute in the main memory are kept in the ready queue.

This layer is responsible for managing how many processes will allocated to the CPU and how
many will stay out of the CPU.
3. Memory Management:

Deals with memory and moving processes from disk to primary memory for execution and back
again.

All memory management is associated with this layer.

There are various types of memories in the computer like RAM, ROM etc.
4. Process Management:

This layer is responsible for managing the processes i.e. assigning the processor to a
process and deciding how many processes will stay in the waiting schedule.

The priority of the processes is also managed in this layer.

The different algorithms used for process scheduling are FCFS, SJF, RR, etc.

5. I/O buffer:

I/O devices are very important in computer systems.

They provide users with the means of interacting with the system.

This layer handles the buffers for the I/O devices and makes sure that they work correctly.

6. User Programs:

This is the highest layer in the layered OS.

This layer deals with many user programs and applications that run in the OS such as word
processors, games, browser etc.
Advantages of layered structure
1. Modularity: this design promotes modularity as each layer performs only the
tasks it is scheduled to perform.
2. Easy debugging: Suppose an error occurs in the CPU scheduling layer, the
developer can only search that particular layer to debug.
3. Easy update: A modification made in a particular layer will not affect the
other layers.
4. No direct access to hardware: A user can use the services of hardware but
cannot directly modify or access it.
5. Abstraction: Every layer is concerned with its functions. So the functions and
implementation of the other layers are hidden to it.
Disadvantages of Layered Structure
1. Complex and careful implementation: as a layer can access the
services of the layers below it, so the arrangement of the layers must
be done carefully.
2. Slower in execution: if a layer wants to interact with another layer, it
requests to travel through all the layers present between the two
interacting layers. Thus it increases response time.
3. Functionalities: It is not always possible to divide the functionalities.
Many time they are interrelated and cannot be separated.
4. Communication: No communication between non- adjacent layers.
3.4 Protection in OS

Protection is important in a multi user environment when multiple
users use computer resources such as CPU, memory etc.

It is the OS’s responsibility to offer a mechanism that protects
each process from other processes.

In a multi user environment, all assets that require protection are
classified as objects and those that wish to access these objects
are referred to as subjects.

The OS grants different “access right” to different subjects.
Need of protection in OS

There may be security risks like unauthorized
reading, writing, modification or preventing the
system from working effectively for unauthorized
users.

It helps to ensure data security, process security
and program security against unauthorized user
access or program access.
3.5 Kernel

A kernel is the control module of an OS.

It is one which loads first and remains in the main memory.

Since kernel stays in memory, it must be kept as small as possible.

The OS kernel comprises of I/O drivers, CPU scheduler, pager, swapper etc.

In an operating system, the kernel is the core component that acts as a bridge between
the hardware and software.

It is responsible for managing system resources, providing essential services, and
facilitating communication between different parts of the operating system and hardware
devices.

The kernel handles tasks such as process management, memory management, device
drivers, and input/output operations.

It plays a crucial role in ensuring the stability, security, and proper functioning of the
operating system.
Some main functions of kernel are as follows:

It provides a mechanism for creation and deletion of processes.

It provides processor scheduling, memory management I/O management.

It provides mechanism for synchronization of processes.

It provides mechanism for interprocess communication.

There are two types of kernel:


a. Monolithic Kernel
b. Micro Kernel
a. Monolithic Kernel

A monolithic kernel is a type of operating system kernel architecture in which all the operating
system services, such as process management, memory management, file system, device drivers,
and networking, are bundled together into a single executable binary.

In a monolithic kernel, all the kernel functions run in the same privileged kernel address space, and
they can directly invoke each other's functions.

This architecture provides several advantages, including efficient communication between kernel
components, low overhead for system calls, and faster performance due to direct access to
hardware.

However, it also has some drawbacks. Since all the components are tightly coupled, a bug or a
crash in one component can potentially affect the entire system. Additionally, adding or modifying
functionality often requires recompiling and replacing the entire kernel.

Examples of operating systems that use a monolithic kernel architecture include Linux and older
versions of Microsoft Windows (such as Windows 95 and Windows XP).
Advantages of Monolithic Kernel

The execution of the monolithic kernel is quite fast as the service
such as memory management, file management, process scheduling
etc are implemented under the same address space.

A process runs completely in single address space in the monolithic
kernel.

Disadvantages of Monolithic Kernel



If any service fails in the monolithic kernel, it leads to the failure of the
entire system.

The entire OS needs to be modified by the user to add any new
service.
b. Micro kernel

The micro kernel is a type of kernel that allows customization of the operating system.

It runs on privileged mode and provides low level address space management and IPC.

OS service such as file management, virtual memory management and CPU scheduler
are on top of the micro kernel.

Each service has its own address space to make them secure.

The application also has their own address space.

Therefore, there is protection among applications , OS services and kernels.

Communication between components is done by using message passing which is pretty
much slower.

If one components crash then other keeps running.
S.N. Monolithic Kernel Micro Kernel

1. In monolithic kernel, both user In micro kernel, user services and


services and kernel services are kernel services are kept in separate
kept in the same address space. address space.
2. OS is complex to design. OS is easy to design, implement and
install.
3. Request may be serviced faster. Requests may be serviced slower.

4. All operating system services are Only IPC and low level device
included in kernel. management services are included in
kernel.
5. No message passing and no It requires message passing and
context switching is required context switching.
while the kernel is performing a
job.
6 Failure of a single component in a Failure of one component does not
monolithic kernel results in a system affect the working of micro kernel.
failure.
7 It is difficult to extend a monolithic It is simple to extend micro kernel.
kernel.
8 Eg: UNIX, LINUX kernel Eg: Kernel if MAC OS, windows NT.
3.6 Process and Threads
3.6.1 Process

A process is an activity of some kind.

It has a program code,input, output and a state.

We define the process as an instance of a program in execution.

To put it in simple terms, we write our computer programs in a text file and when we execute
this program, it becomes a process which performs all the tasks mentioned in the program.

When a program is loaded into the memory and it becomes a process.

When you launch a web browser, it creates a new process. This process represents the
running instance of the web browser application. It has its own memory space, system
resources, and execution context. The process manages tasks such as rendering web
pages, handling user input, and managing network connections. Each time you open a new
instance of the web browser, a new process is created to handle that instance separately.
Process states/ Process life cycle

When a process executes, it passes through different states.

This stages may differ in different OS.

The life cycle of a process can be divided into several states, each with its own characteristics to
describe the process

Each process may be in one of the following states:
a. New: the process has been created but not yet admitted to the pool of executable processes.
b. Ready: the process is ready for execution and is waiting to be allocated to a processor. All
ready processes are kept in a queue and they keep waiting for CPU time to be allocated by the
OS in order to run.
c. Running: A process is now executing i.e. using the CPU. The instructions within a process are
executing.
d. Waiting: process moves into the waiting state if it needs to wait for a resource, such as waiting
for a file to become available.
e. Terminated: once the process finishes its execution, or it is terminated by the OS , it is moved
to the terminated state where it waits to be removed from main memory.
3.6.2 Threads

A thread is a unit of execution within a process.

A thread is similar to a sequential program like a thread also has a beginning, an
end , a sequence etc. but a thread itself is not a program and it cannot run on its
own. So it runs within a program.

A thread is a single sequential flow of control within a program.

A thread is also known as a light weight process. This is called so because it runs
within a program thus it makes use of the resources that were actually allocated to
the process(or program).

A thread also has its life cycle. They also share processor. A thread executes
sequentially within a process.

There can be more than one thread inside a process. Each thread of the same
process makes use of a separate PC and a stack of activation records and control
blocks.

The process can be split down into so many threads. For example, in a browser
many tabs can be viewed as threads.
Need of threads

It takes less time to create a new thread in an existing process
than to create a new process.

Threads can share a common data.

Context switching is faster when working with threads.

It takes less time to terminate a thread than a process.
Extra point:

Processes: Imagine you have a computer running a word processor, a web browser, and a
media player simultaneously. Each of these applications is a separate process. They have their
own memory space and resources, and they run independently of each other. If one process
crashes, it won't affect the others.

Threads: Within each process, there can be multiple threads. Let's take the example of a web
browser. When you open a new tab and load a webpage, the browser may create a separate
thread to handle that task. This thread runs concurrently with the main thread of the browser,
allowing you to interact with other tabs or perform other actions while the webpage is being
loaded. Threads share the same memory space and resources within a process and can
communicate with each other easily.
Extra point:

Processes: Imagine you have a computer running a word processor, a web browser, and a
media player simultaneously. Each of these applications is a separate process. They have their
own memory space and resources, and they run independently of each other. If one process
crashes, it won't affect the others.

Threads: Within each process, there can be multiple threads. Let's take the example of a web
browser. When you open a new tab and load a webpage, the browser may create a separate
thread to handle that task. This thread runs concurrently with the main thread of the browser,
allowing you to interact with other tabs or perform other actions while the webpage is being
loaded. Threads share the same memory space and resources within a process and can
communicate with each other easily.
S.N. Process Threads

1. Processes cannot share the same Threads can share memory and files.
memory.
2. Process creation is time consuming. Thread creation is not time consuming.

3. Process execution is very slow. Thread execution is very fast.

4. It takes more time to terminate a It takes less time to terminate a threads.


process.
5. It takes more time to switch between two It takes less time to switch between two threads.
processes.
6. Process is loosely coupled i.e. lesser Threads are tightly coupled i.e. more resource
resources sharing. sharing.
7. Communication between processes is Communication between threads is easy and
difficult. efficient.
8. It is a heavy weight process as it It is a light weight process as it requires fewer
requires more resources. resources.
9. They are not suitable for exploiting They are suitable for exploiting parallelism.
parallelism.

You might also like