Unit 1 Overview of Operating System
Unit 1 Overview of Operating System
For example − It is easier to deal with photos, emails, songs, and Web pages than with the
details of these files on disks.
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.
Every process has its own set of registers which are used to hold the data which is generated
during the execution of the process.
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.
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
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.
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.
(1) control, (2) status, (3) data-in, and (4) data-out registers.
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
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.
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.
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
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.
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:
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.
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.
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.
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
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.