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

Unit 2 – Operating System Structures

Module Learning Objectives:

At the end of this, students are expected to:


1. Define the concepts of Operating System
2. Describe the Components of Computer System
3. Discuss the importance of the evolution of Operating System and
Computer Environments
Operating System
Components
Kernel
• The kernel in the OS provides the basic level of control on all
the computer peripherals. In the operating system, the kernel
is an essential component that loads firstly and remains
within the main memory. So that memory accessibility can be
managed for the programs within the RAM, it creates the
programs to get access from the hardware resources. It
resets the operating states of the CPU for the best operation
at all times.
Process Execution
• The OS gives an interface between the hardware as
well as an application program so that the program can
connect through the hardware device by simply
following procedures & principles configured into the
OS. The program execution mainly includes a process
created through an OS kernel that uses memory space
as well as different types of other resources.
Interrupt
• In the operating system, interrupts are essential because they give a
reliable technique for the OS to communicate & react to their
surroundings. An interrupt is nothing but one kind of signal between a
device as well as a computer system otherwise from a program in the
computer that requires the OS to leave and decide accurately what to
do subsequently. Whenever an interrupt signal is received, then the
hardware of the computer puts on hold automatically whatever
computer program is running presently, keeps its status & runs a
computer program which is connected previously with the interrupt.
Memory Management
• The functionality of an OS is nothing but memory management which manages
main memory & moves processes backward and forward between disk & main
memory during implementation. This tracks each & every memory position; until it is
assigned to some process otherwise it is open. It verifies how much memory can be
allocated to processes and also makes a decision to know which process will obtain
memory at what time. Whenever memory is unallocated, then it tracks
correspondingly to update the status. Memory management work can be divided into
three important groups like memory management of hardware, OS and application
memory management.
Multitasking
• It describes the working of several independent computer
programs on a similar computer system. Multitasking in an OS
allows an operator to execute one or more computer tasks at a
time. Since many computers can perform one or two tasks at a
time, usually this can be done with the help of time-sharing,
where each program uses the time of a computer to execute.
Security
• If a computer has numerous individuals to allow the immediate process of
various processes, then the many processes have to be protected from other
activities. This system security mainly depends upon a variety of technologies
that work effectively. Current operating systems give an entrée to a number of
resources, which are obtainable to work the software on the system, and to
external devices like networks by means of the kernel. The operating system
should be capable of distinguishing between demands which have to be
allowed for progressing & others that don’t need to be processed.
User Interface
•A GUI or user interface (UI) is the part of an OS
that permits an operator to get the information. A
user interface based on text displays the text as
well as its commands which are typed over a
command line with the help of a keyboard.
Operating System Services
List of common services offered by an almost all operating systems:
1. Program Execution
2. File system manipulation
3. Input / Output Operations
4. Communication
5. Resource Allocation
6. Error Detection
7. Accounting
8. Security and protection
Program Execution
The operating system must have the capability to
load a program into memory and execute that
program. Furthermore, the program must be able to
end its execution, either normally or abnormally /
forcefully.
File system manipulation
Programs need has to be read and then write them as files
and directories. File handling portion of operating system
also allows users to create and delete files by specific
name along with extension, search for a given file and / or
list file information. Some programs comprise of
permissions management for allowing or denying access
to files or directories based on file ownership.
Input / Output Operations

• A program which is currently executing may require I/O,


which may involve file or another I/O device. For
efficiency and protection, users cannot directly govern the
I/O devices. So, the OS provide a means to do I/O Input /
Output operation which means read or write operation
with any file.
Communication

• Process needs to swap over information with other process.


Processes executing on same computer system or on different
computer systems can communicate using operating system
support. Communication between two processes can be done
using shared memory or via message passing.
Resource Allocation

• When multiple jobs running concurrently, resources must


need to be allocated to each of them. Resources can be
CPU cycles, main memory storage, file storage and I/O
devices. CPU scheduling routines are used here to
establish how best the CPU can be used.
Error Detection

• Errors may occur within CPU, memory hardware, I/O


devices and in the user program. For each type of error,
the OS takes adequate action for ensuring correct and
consistent computing.
Accounting

•This service of the operating system keeps track of


which users are using how much and what kinds of
computer resources have been used for
accounting or simply to accumulate usage
statistics.
Security and protection

•Protection includes in ensuring all access to


system resources in a controlled manner. For
making a system secure, the user needs to
authenticate him or her to the system before using
(usually via login ID and password).
Types of System Calls
• Device Management

These system calls are responsible for device manipulation such


as reading from device buffers, writing into device buffers etc.

• Information Maintenance

These system calls handle information and its transfer between


the operating system and the user program.
Types of System Calls


open( )

The open() system call is used to provide access to a file in a


file system. This system call allocates resources to the file and
provides a handle that the process uses to refer to the file. A
file can be opened by multiple processes at the same time or
be restricted to one process. It all depends on the file
organization and file system.
read( )

The read() system call is used to access data from a file that is
stored in the file system. The file to read can be identified by
its file descriptor and it should be opened using open() before
it can be read. In general, the read() system calls takes three
arguments i.e. the file descriptor, buffer which stores read data
and number of bytes to be read from the file.
write( )

The write() system calls writes the data from a user


buffer into a device such as a file. This system call is one
of the ways to output data from a program. In general,
the write system calls takes three arguments i.e. file
descriptor, pointer to the buffer where data is stored and
number of bytes to write from the buffer.
close()

The close() system call is used to terminate access


to a file system. Using this system call means that
the file is no longer required by the program and so
the buffers are flushed, the file metadata is updated
and the file resources are de-allocated.
System Programs

System Programming can be defined as act of building Systems


Software using System Programming Languages. According to
Computer Hierarchy, one which comes at last is Hardware. Then it
is Operating System, System Programs, and finally Application
Programs. Program Development and Execution can be done
conveniently in System Programs. Some of System Programs are
simply user interfaces, others are complex. It traditionally lies
between user interface and system calls.
Categories of System Programs
1. File Management

A file is a collection of specific information stored in memory of computer system.


File management is defined as process of manipulating files in computer system, it
management includes process of creating, modifying and deleting files.

• It helps to create new files in computer system and placing them at specific
locations.

• It helps in easily and quickly locating these files in computer system.

• It makes process of sharing of files among different users very easy and user
friendly.
Categories of System Programs
• It helps to stores files in separate folders known as directories.

• These directories help users to search file quickly or to manage files


according to their types or uses.

• It helps user to modify data of files or to modify the name of file in


directories.
Status Information


System Structure
The design of an operating system architecture traditionally follows
the separation of concerns principle. This principle suggests
structuring the operating system into relatively independent parts
that provide simple individual features, thus keeping the complexity
of the design manageable.
System Structure
• The operating system possesses various privileges that allow it to access
otherwise protected resources such as physical devices or application memory.
When these privileges are granted to the individual parts of the operating system
that require them, rather than to the operating system as a whole, the potential for
both accidental and malicious privileges misuse is reduced.
• Breaking the operating system into parts can have adverse effect on efficiency
because of the overhead associated with communication between the individual
parts. This overhead can be exacerbated when coupled with hardware
mechanisms used to grant privileges.
Monolithic System
Layered Systems

A layered design of the operating system architecture attempts to


achieve robustness by structuring the architecture into layers with
different privileges. The most privileged layer would contain code
dealing with interrupt handling and context switching, the layers
above that would follow with device drivers, memory management,
file systems, user interface, and finally the least privileged layer
would contain the applications.
Microkernel Systems

A microkernel design of the operating system architecture targets


robustness. The privileges granted to the individual parts of the
operating system are restricted as much as possible and the
communication between the parts relies on a specialized
communication mechanisms that enforce the privileges as necessary.
The communication overhead inside the microkernel operating system
can be higher than the communication overhead inside other software,
however, research has shown this overhead to be manageable.
Virtualized Systems

Attempts to simplify maintenance and improve utilization of


operating systems that host multiple independent applications
have lead to the idea of running multiple operating systems on the
same computer. Similar to the manner in which the operating
system kernel provides an isolated environment to each hosted
application, virtualized systems introduce a hypervisor that
provides an isolated environment to each hosted operating system.
Virtual Machines
VM Management
The use of virtual machines also comes with several important management
considerations, many of which can be addressed through general systems
administration best practices and tools that are designed to manage VMs.
There are some risks to consolidation, including overtaxing resources or
potentially experiencing outages on multiple VMs due to one physical
hardware outage. While these cost savings increase as more virtual machines
share the same hardware platform, it does add risk. It is possible to place
hundreds of virtual machines on the same hardware, but if the hardware
platform fails, it could take out dozens or hundreds of virtual machines.
VM Uses

VMs have multiple uses, but in general they are deployed


when the need for different operating systems and processing
power are needed for different applications running
simultaneously. For example, if an enterprise wants to test
multiple web servers and small databases at the same time.
Similarly, if an enterprise wants to use the same server to run
graphics-intensive gaming software and customer service
database.
VM vs. Dual Boot

Before the arrival of virtualization , an operator wanting to run two


operating systems, say, Windows and Linux, had to run two full
operating systems and toggle between them. While only one could
be used at a time, it used the full power of the hardware. In some
instances, particularly when the computer is not that powerful and
the tasks are very demanding, some operators still prefer to use
dual boot.
VM vs emulators

An emulator is software that allows one application


to take on the characteristics of another. For
example, emulation software can be used to make a
PC operate as a game console.
VM vs. containers

• Containers are like VMs, except that they only virtualize the operating
system, rather than the rest of the underlying hardware. Containers
contain the code, system tools, runtime, system libraries and settings
needed for multiple applications. That's why containers are often used
when multiple applications using the same operating system are
needed. Containers are used to create cloud-native , distributed
applications, and to package legacy applications for increased
portability and deployment simplicity. One of the leading container
developers as of mid-2019 was Docker, which first arrived in the
market in 2013 as a Linux-based container platform.
Virtual Machines

An operating system is a construct that allows the user


application programs to interact with the system hardware.
Operating system by itself does not provide any function
but it provides an atmosphere in which different
applications and programs can do useful work.
Figure 7 Layered Operating System Design
Operating System Design Goals

It is quite complicated to define all the goals and


specifications of the operating system while designing it.
The design changes depending on the type of the
operating system i.e if it is batch system, time shared
system, single user system, multi user system, distributed
system etc.
User Goals

The operating system should be convenient, easy to use,


reliable, safe and fast according to the users. However,
these specifications are not very useful as there is no set
method to achieve these goals.
System Goals

The operating system should be easy to design,


implement and maintain. These are specifications required
by those who create, maintain and operate the operating
system. But there is not specific method to achieve these
goals as well.
Operating System Mechanisms and Policies
• There is no specific way to design an operating system as it is a highly
creative task. However, there are general software principles that are
applicable to all operating systems.

• A subtle difference between mechanism and policy is that mechanism


shows how to do something and policy shows what to do. Policies may
change over time and this would lead to changes in mechanism. So, it is
better to have a general mechanism that would require few changes even
when a policy change occurs.
Operating System Implementation

The operating system needs to be implemented after it is


designed. Earlier they were written in assembly language
but now higher level languages are used. The first system
not written in assembly language was the Master Control
Program (MCP) for Burroughs Computers.
Advantage of Higher-Level Language

There are multiple advantages to implementing an


operating system using a higher level language such as:
the code is written more fast, it is compact and also
easier to debug and understand. Also, the operating
system can be easily moved from one hardware to
another if it is written in a high level language.
Disadvantage of Higher-Level Language

Using high level language for implementing an operating system


leads to a loss in speed and increase in storage requirements.
However in modern systems only a small amount of code is
needed for high performance, such as the CPU scheduler and
memory manager. Also, the bottleneck routines in the system can
be replaced by assembly language equivalents if required.
Operating System Generation

System generation or sysgen is the process of creating a


particular unique instance of an operating system by
combining user-specified options and parameters with
manufacturer-supplied general-purpose program code to
produce an operating system tailored for a particular
hardware and software environment.
Leaning Activity 1

1.What are the advantage and disadvantages of


implementing virtual machines?
2.What is Kernel in Operating System?

You might also like