0% found this document useful (0 votes)
3 views

Unit 1 Overview of Operating System

The document provides an overview of operating systems, detailing their functions as both an extended machine and a resource manager. It explains key concepts such as process management, file management, and system calls, as well as the structure of operating systems including monolithic and microkernel architectures. Additionally, it covers important attributes of processes, files, and input/output operations, emphasizing the role of the operating system in managing hardware and software interactions.

Uploaded by

r38868925
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Unit 1 Overview of Operating System

The document provides an overview of operating systems, detailing their functions as both an extended machine and a resource manager. It explains key concepts such as process management, file management, and system calls, as well as the structure of operating systems including monolithic and microkernel architectures. Additionally, it covers important attributes of processes, files, and input/output operations, emphasizing the role of the operating system in managing hardware and software interactions.

Uploaded by

r38868925
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

MCA-R201- Understanding Operating Systems Shri V.D.

Deshmukh College of MCA Kolpa ,Latur

Unit 1:Overview of Operating System

Operating System as Extended Machine

Let us understand how the operating system works as an Extended Machine.

 At the Machine level the structure of a computer’s system is complicated to program,


mainly for input or output. Programmers do not deal with hardware. They will always
mainly focus on implementing software. Therefore, a level of abstraction is supposed to
be maintained.
 Operating systems provide a layer of abstraction for using disk such as files.
 This level of abstraction allows a program to create, write, and read files, without dealing
with the details of how the hardware actually works.
 The level of abstraction is the key to managing the complexity.
 Good abstractions turn an impossible task into two manageable tasks.
 The first is to define and implement the abstractions.
 The second is to solve the problem at hand.
 Operating system provides abstractions to application programs in a top down view.

For example − It is easier to deal with photos, emails, songs, and Web pages than with the
details of these files on disks.

The diagram given below shows the functioning of OS as an extended machine


Operating System as Resource Manager

Let us understand how the operating system works as a Resource Manager.

 Now-a-days all modern computers consist of processors, memories, timers, network


interfaces, printers, and so many other devices.
 The operating system provides for an orderly and controlled allocation of the processors,
memories, and I/O devices among the various programs in the bottom-up view.
 Operating system allows multiple programs to be in memory and run at the same time.
 Resource management includes multiplexing or sharing resources in two different ways:
in time and in space.
 In time multiplexed, different programs take a chance of using CPU. First one tries to use
the resource, then the next one that is ready in the queue and so on. For example: Sharing
the printer one after another.
 In space multiplexing, Instead of the customers taking a chance, each one gets part of the
resource. For example − Main memory is divided into several running programs, so each
one can be resident at the same time.

The diagram given below shows the functioning of OS as a resource manager −


 Process:

The Attributes of the process are used by the Operating System to create the process control
block (PCB) for each of them. This is also called context of the process. Attributes which are
stored in the PCB are described below.

1. Process ID

When a process is created, a unique id is assigned to the process which is used for unique
identification of the process in the system.

2. Program counter

A program counter stores the address of the last instruction of the process on which the process
was suspended. The CPU uses this address when the execution of this process is resumed.

3. Process State

The Process, from its creation to the completion, goes through various states which are new,
ready, running and waiting. We will discuss about them later in detail.

4. Priority

Every process has its own priority. The process with the highest priority among the processes
gets the CPU first. This is also stored on the process control block.

5. General Purpose Registers

Every process has its own set of registers which are used to hold the data which is generated
during the execution of the process.

6. List of open files

During the Execution, Every process uses some files which need to be present in the main
memory. OS also maintains a list of open files in the PCB.

7. List of open devices

OS also maintain the list of all open devices which are used during the execution of the process.

 Address spaces:
Address space is a space in computer memory. And process Address Space means a space that is
allocated in memory for a process. Every process has an address space
Address Space can be of two types

1. Physical Address Space


2. Virtual Address Space

Physical address space


physical address is the actual location in the memory that exist physically. System access the
data in the main memory, with the help of physical address. Every thing in the computer has a
unique physical address. We needs to mapped it to make the address accessible. MMU is
responsible for mapping.

Virtual Address Space


Virtual Address Space is an address space that is created outside the main memory inside the
virtual memory, and it is created in the hard disk.
When our main memory is less and we want to get more benefit from this less memory, then we
create virtual memory.
Logical Address is the address is always generated by CPU while running a program. The logical
address is also called virtual address. Virtual address does not exist physically, so we can say that
physical address is the logical address.

 File:

A file can be defined as a data structure which stores the sequence of records. Files are stored in
a file system, which may exist on a disk or in the main memory. Files can be simple (plain text)
or complex (specially-formatted).

The collection of files is known as Directory. The collection of directories at the different levels,
is known as File System.
Attributes of the File

1.Name

Every file carries a name by which the file is recognized in the file system. One directory cannot
have two files with the same name.

2.Identifier

Along with the name, Each File has its own extension which identifies the type of the file. For
example, a text file has the extension .txt, A video file can have the extension .mp4.

3.Type

In a File System, the Files are classified in different types such as video files, audio files, text
files, executable files, etc.

4.Location

In the File System, there are several locations on which, the files can be stored. Each file carries
its location as its attribute.

5.Size

The Size of the File is one of its most important attribute. By size of the file, we mean the
number of bytes acquired by the file in the memory.

6.Protection

The Admin of the computer may want the different protections for the different files. Therefore
each file carries its own set of permissions to the different group of Users.

7.Time and Date

Every file carries a time stamp which contains the time and date on which the file is last
modified.

 Input output:

The three main jobs of a computer are Input, Output, and Processing. In most of the cases, the
most important job is Input / Output, and the processing is simply incidental. For an example,
when we browse a web page or edit any file, our immediate attention is to read or enter some
information, not for computing an answer. The fundamental role of the operating system in
computer Input / Output is to manage and organize I/O operations and all I/O devices.
The various devices that are connected to the computer need to be controlled and it is a key
concern of operating-system designers. This is as I/O devices vary so widely in their
functionality and speed (for example a mouse, a hard disk and a CD-ROM), varied methods are
required for controlling them. These methods form the I/O sub-system of the kernel of OS that
separates the rest of the kernel from the complications of managing I/O devices.

I/O Hardware

Computers operate many huge kinds of devices. General categories of storage devices are like
disks, tapes, transmission devices (like network interface cards, modems) and human interface
devices (like screen, keyboard, etc.).

A device which communicates with the operating system of a computer by transferring signals
over cable or even through the air. The Peripheral devices that communicate with the machine
through a connection point also called ports- (one example is a serial port). Whenever devices
use a set of wires or cables, that connecting cables are called a "bus". Simply, a bus is a
collection of wires and a firmly defined protocol that describes a set of messages that can be sent
on the wires.

An I/O port usually contains four different registers −

(1) control, (2) status, (3) data-in, and (4) data-out registers.

 The data-in register is read by the host for getting input.


 The data-out register is written by the host for sending output.
 The status register holds bits which can be read by the host.
 The control register is written by the host for starting a command or for changing the
mode of any device.
 The data registers are usually 1 to 4 bytes in size. Some of the controllers have FIFO
chips which hold several bytes of input or output data for expanding the capacity of the
controller beyond the size of the data register.

 Protection
A mechanism that controls the access of programs, processes, or users to the resources
defined by a computer system is referred to as protection. You may utilize protection as a
tool for multi-programming operating systems, allowing multiple users to safely share a
common logical namespace, including a directory or files.
It needs the protection of computer resources like the software, memory, processor, etc.
Users should take protective measures as a helper to multiprogramming OS so that
multiple users may safely use a common logical namespace like a directory or data.
Protection may be achieved by maintaining confidentiality, honesty and availability in the
OS. It is critical to secure the device from unauthorized access, viruses, worms, and other
malware.

 Shell

Your interface to the operating system is called a shell.

The shell is the outermost layer of the operating system. Shells incorporate a programming
language to control processes and files, as well as to start and control other programs. The shell
manages the interaction between you and the operating system by prompting you for input,
interpreting that input for the operating system, and then handling any resulting output from the
operating system.

Shells provide a way for you to communicate with the operating system. This communication is
carried out either interactively (input from the keyboard is acted upon immediately) or as a shell
script. A shell script is a sequence of shell and operating system commands that is stored in a
file.

When you log in to the system, the system locates the name of a shell program to execute. After
it is executed, the shell displays a command prompt. This prompt is usually a $ (dollar sign).
When you type a command at the prompt and press the Enter key, the shell evaluates the
command and attempts to carry it out. Depending on your command instructions, the shell writes
the command output to the screen or redirects the output. It then returns the command prompt
and waits for you to type another command.

 Process Management System Calls

System call provides an interface between user program and operating system. The
structure of system call is as follows –
When the user wants to give an instruction to the OS then it will do it through system calls. Or a
user program can access the kernel which is a part of the OS through system calls.

It is a programmatic way in which a computer program requests a service from the kernel of the
operating system.

Types of system calls

The different system calls are as follows −

 System calls for Process management


 System calls for File management
 System calls for Directory management

Now let us discuss process management system calls.

System calls for Process management

A system is used to create a new process or a duplicate process called a fork.

The duplicate process consists of all data in the file description and registers common. The
original process is also called the parent process and the duplicate is called the child process.

The fork call returns a value, which is zero in the child and equal to the child’s PID (Process
Identifier) in the parent. The system calls like exit would request the services for terminating a
process.
Loading of programs or changing of the original image with duplicate needs execution of exec.
Pid would help to distinguish between child and parent processes.

Example

Process management system calls in Linux.

 fork − For creating a duplicate process from the parent process.


 wait − Processes are supposed to wait for other processes to complete their work.
 exec − Loads the selected program into the memory.
 exit − Terminates the process.

The pictorial representation of process management system calls is as follows –

ork() − A parent process always uses a fork for creating a new child process. The child process
is generally called a copy of the parent. After execution of fork, both parent and child execute the
same program in separate processes.

exec() − This function is used to replace the program executed by a process. The child
sometimes may use exec after a fork for replacing the process memory space with a new
program executable making the child execute a different program than the parent.

exit() − This function is used to terminate the process.

wait() − The parent uses a wait function to suspend execution till a child terminates. Using wait
the parent can obtain the exit status of a terminated child.
 System call for File Management:

The System calls for File management are as follows −

A file is open using a system call open. The mode in which the file is supposed to be open is
specified using the parameter.

Parameters also consist of the names of the file to open or a new one to be created. The files are
closed using the close systems.

Associated with each file is a pointer that indicates the current position in the file. When reading
or writing sequentially, points to the next byte to be read or written.

The Lseek call changes the value of the position pointer so that subsequent calls to read or write
can begin anywhere in the file.

Lseek has three parameters which are as follows −

 File descriptor for the file


 File position
 File position is relative to the beginning of the file, the current position, or the end of the
file.
Example

The systems calls for file management include the following −

 open − for opening the file for reading, writing.


 close − to close the opened file.
 read − for reading the data from the file into the buffer.
 write − for writing the data from the buffer into file.

Now let us see about each system call in detail. We know a file is used to store a large volume of
data. A file is treated as a single entity.

The main functions are as follows −


Create a file

Whenever you want to work on a file, the very first step is to create a file. A file is a space in
memory where data is stored.

You can follow the steps to create a file −

 Right click anywhere in the folder where you want to create a file.
 Select new file.
 Name the file and a file will be created.
Open a file

After creating a file, you can work on it whenever you want to and open it from the memory of
the file system by accessing the path of the file.

For example − cd ./user/file1 -------file1 being the name of the file that you created. Also you
can double click on the file to open it wherever you have created it.

Close a file

You can close a file by clicking on the close button in the toolbar of a file.

Delete a file

Delete a file by following these steps −

 Right click on the file.


 Click on delete.
 Click yes/confirm on the confirmation block.
Monolithic Structure of Operating System:

The monolithic operating system is a very basic operating system in which file management,
memory management, device management, and process management are directly controlled
within the kernel. The kernel can access all the resources present in the system. In monolithic
systems, each component of the operating system is contained within the kernel. Operating
systems that use monolithic architecture were first time used in the 1970s.

The monolithic operating system is also known as the monolithic kernel. This is an old operating
system used to perform small tasks like batch processing and time-sharing tasks in banks. The
monolithic kernel acts as a virtual machine that controls all hardware parts.
It is different from a microkernel, which has limited tasks. A microkernel is divided into two
parts, kernel space, and user space. Both parts communicate with each other through IPC (Inter-
process communication). Microkernel's advantage is that if one server fails, then the other server
takes control of it.

Monolithic kernel

A monolithic kernel is an operating system architecture where the entire operating system is
working in kernel space. The monolithic model differs from other operating system architectures,
such as the microkernel architecture, in that it alone defines a high-level virtual interface over
computer hardware.

A set of primitives or system calls implement all operating system services such as process
management, concurrency, and memory management. Device drivers can be added to the kernel
as modules.

Advantages of Monolithic Kernel

Here are the following advantages of a monolithic kernel, such as:

o The execution of the monolithic kernel is quite fast as the services such as memory
management, file management, process scheduling, etc., are implemented under the same
address space.
o A process runs completely in single address space in the monolithic kernel.
o The monolithic kernel is a static single binary file.

Disadvantages of Monolithic Kernel

Here are some disadvantages of the monolithic kernel, such as:

o If any service fails in the monolithic kernel, it leads to the failure of the entire system.
o The entire operating system needs to be modified by the user to add any new service.

Monolithic System Architecture

A monolithic design of the operating system architecture makes no special accommodation for
the special nature of the operating system. Although the design follows the separation of
concerns, no attempt is made to restrict the privileges granted to the individual parts of the
operating system. The entire operating system executes with maximum privileges. The
communication overhead inside the monolithic operating system is the same as that of any other
software, considered relatively low.
CP/M and DOS are simple examples of monolithic operating systems. Both CP/M and DOS are
operating systems that share a single address space with the applications.

o In CP/M, the 16-bit address space starts with system variables and the application area. It
ends with three parts of the operating system, namely CCP (Console Command
Processor), BDOS (Basic Disk Operating System), and BIOS (Basic Input/Output
System).
o In DOS, the 20-bit address space starts with the array of interrupt vectors and the system
variables, followed by the resident part of DOS and the application area and ending with
a memory block used by the video card and BIOS.

Advantages of Monolithic Architecture:

Monolithic architecture has the following advantages, such as:

o Simple and easy to implement structure.


o Faster execution due to direct access to all the services

Disadvantages of Monolithic Architecture:

Here are some disadvantages of monolithic architecture:


o The addition of new features or removal of obsolete features is very difficult.
o Security issues are always there because there is no isolation among various servers
present in the kernel.

Modular Monolithic Systems

Modular operating systems and most modern monolithic operating systems such as OS-9
OpenVMS, Linux, BSD, SunOS, AIX, and MULTICS can dynamically load (and unload)
executable modules at runtime.

This modularity of the operating system is at the binary level and not at the architecture level.
Modular monolithic operating systems are not confused with the architectural level of modularity
inherent in server-client operating systems (and its derivatives sometimes marketed as the hybrid
kernel) that use microkernels and servers.

Practically, dynamically loading modules is simply a more flexible way of handling the
operating system image at runtime instead of rebooting with a different operating system image.
The modules allow easy extension of the operating systems' capabilities as required.
Dynamically loadable modules incur a small overhead when compared to building the module
into the operating system image.

However, in some cases, loading modules dynamically helps keep the amount of code running in
kernel space to a minimum. For example, to minimize operating system footprint for embedded
devices or those with limited hardware resources. Namely, an unloaded module need not be
stored in scarce random access memory.

Limitations of Monolithic System


The monolithic operating system has the following limitations, such as:

o Code written in this operating system (OS) is difficult to port.


o Monolithic OS has more tendencies to generate errors and bugs. The reason is that user
processes use the same address locations as the kernel.
o Adding and removing features from monolithic OS is very difficult. All the code needs to
be rewritten and recompiled to add or remove any feature.

Features of Monolithic System

The monolithic operating system provides the following features to the users, such as:

1. Simple structure: This type of operating system has a simple structure. All the
components needed for processing are embedded into the kernel.
2. Works for smaller tasks: It works better for performing smaller tasks as it can handle
limited resources.
3. Communication between components: All the components can directly communicate
with each other and also with the kernel.
4. Fast operating system: The code to make a monolithic kernel is very fast and robust.

Difference between Monolithic Kernel and Microkernel

A kernel is the core part of an operating system, and it manages the system resources. A kernel is
like a bridge between the application and hardware of the computer. The kernel can be classified
further into two categories, Microkernel and Monolithic Kernel.

The microkernel 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 Inter-Process
Communication (IPC). Moreover, OS services such as file system, virtual memory manager, and
CPU scheduler are on top of the microkernel. Each service has its own address space to make
them secure. Besides, the applications also have their own address spaces. Therefore, there is
protection among applications, OS Services, and kernels.

A monolithic kernel is another classification of the kernel. In monolithic kernel-based systems,


each application has its own address space. Like microkernel, this one also manages system
resources between application and hardware, but user services and kernel services are
implemented under the same address space. It increases the size of the kernel, thus increases the
size of the operating system as well.
 Client and Server model
o A client and server networking model is a model in which computers such as servers
provide the network services to the other computers such as clients to perform a user
based tasks. This model is known as client-server networking model.
o The application programs using the client-server model should follow the given below
strategies:

o
o An application program is known as a client program, running on the local machine that
requests for a service from an application program known as a server program, running
on the remote machine.
o A client program runs only when it requests for a service from the server while the server
program runs all time as it does not know when its service is required.
o A server provides a service for many clients not just for a single client. Therefore, we can
say that client-server follows the many-to-one relationship. Many clients can use the
service of one server.
o Services are required frequently, and many users have a specific client-server application
program. For example, the client-server application program allows the user to access the
files, send e-mail, and so on. If the services are more customized, then we should have
one generic application program that allows the user to access the services available on
the remote computer.

Client

A client is a program that runs on the local machine requesting service from the server. A client
program is a finite program means that the service started by the user and terminates when the
service is completed.
Server

A server is a program that runs on the remote machine providing services to the clients. When
the client requests for a service, then the server opens the door for the incoming requests, but it
never initiates the service.

A server program is an infinite program means that when it starts, it runs infinitely unless the
problem arises. The server waits for the incoming requests from the clients. When the request
arrives at the server, then it responds to the request.

 Virtual Machines

A virtual machine (VM) is a virtual environment which functions as a virtual computer system
with its own CPU, memory, network interface, and storage, created on a physical hardware
system.

VMs are isolated from the rest of the system, and multiple VMs can exist on a single piece of
hardware, like a server. That means, it as a simulated image of application software and
operating system which is executed on a host computer or a server.

It has its own operating system and software that will facilitate the resources to virtual
computers.

Characteristics of virtual machines

The characteristics of the virtual machines are as follows −

 Multiple OS systems use the same hardware and partition resources between virtual
computers.
 Separate Security and configuration identity.
 Ability to move the virtual computers between the physical host computers as holistically
integrated files.

The below diagram shows you the difference between the single OS with no VM and Multiple
OS with VM −
Benefits

Let us see the major benefits of virtual machines for operating-system designers and users which
are as follows −

 The multiple Operating system environments exist simultaneously on the same machine,
which is isolated from each other.
 Virtual machine offers an instruction set architecture which differs from real computer.
 Using virtual machines, there is easy maintenance, application provisioning, availability
and convenient recovery.

Virtual Machine encourages the users to go beyond the limitations of hardware to achieve their
goals.

The operating system achieves virtualization with the help of a specialized software called a
hypervisor, which emulates the PC client or server CPU, memory, hard disk, network and other
hardware resources completely, enabling virtual machines to share resources.

The hypervisor can emulate multiple virtual hardware platforms that are isolated from each other
allowing virtual machines to run Linux and window server operating machines on the same
underlying physical host.

Basis for developing the OS

Create the illusion of having one or more objects to emulate the real object. It is closely related
to abstraction. In developing the OS, abstraction provides simplification by combining multiple
simple objects into a single complex object

Virtualization provides diversification and replication by creating the illusion of objects with
desired characteristics.
 Exokernel:
 Significant advancements have been made in the field of operating systems (OS) over
the years. The idea of an Exokernel is one such innovation that has evolved in recent
decades. This ground-breaking method of OS design challenges conventional
monolithic and microkernel architectures by giving system designers and users more
flexibility, performance, and control.
 We will go into exokernels in this article, decoding essential terms, comprehending the
underlying ideas, and investigating both their benefits and drawbacks. To fully assist
you in understanding this fascinating OS paradigm, we will also offer examples and
respond to frequently asked questions.
 Understanding Key Terminologies
 Before we dive into Exokernels, let’s define some essential terminologies:
 1. Kernel
 A kernel is the central component of an operating system that regulates system resource
access, maintains hardware resources, and provides critical services.
2. Microkernel
A microkernel is an OS design that limits the kernel’s functionality by delegating the majority
of work to servers or user-level processes. This design aims to improve dependability and
modularity.
3. Monolithic Kernel
In contrast to microkernels, a monolithic kernel consolidates the majority of OS functionality
within a single kernel process. Although this architecture is known for its simplicity, concerns
with performance and robustness can develop.
4. Exokernel
An Exokernel OS design pushes the boundaries of minimalism. Applications are given direct
access to hardware resources, allowing them to manage resources and make decisions that the
kernel previously made.

The Exokernel Architecture


Now, let’s explore the Exokernel architecture and its core principles:
1. Resource Exposure
In an Exokernel, programs have direct access to hardware resources such the CPU, memory,
and I/O units. Applications may now handle these resources with greater precision because
they have fine-grained control over them.
2. Protection and Isolation
Exokernels provide robust isolation and protection features despite exposing resources.
Applications are protected from illegal access and intervention by running in separate address
spaces.
3. Minimalism
Exokernels take a straightforward stance. They leave high-level services and resource
management to application-level libraries and only offer the absolute necessities in
abstractions. This minimalism encourages adaptability and effectiveness.
4. Flexibility
Exokernels adopt a direct posture. They only provide the bare minimum in abstractions,
leaving high-level services and resource management to application-level libraries. This
minimalism promotes efficacy and adaptability.

Examples of Exokernel Concepts


To illustrate Exokernel concepts, consider the following example:
Resource Management
 Traditional operating systems: Fixed time slices are allotted to processes by a single kernel.
 Exokernel: Applications directly control CPU, determining how to divide up CPU time
between threads or activities.
File System Access
 Traditional OS: High-level file system APIs are provided by a monolithic kernel.
 Exokernel: Applications implement own file systems, choosing caching techniques and file
access rules.

You might also like