Os Unit 1 Material

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

SUB : OPERATING SYSTEM 4TH SEM CE/IT

I/C NAME : PROF. MEGHAL PRAJAPATI

GROW MORE FACULTY OF ENGINEERING


UNIT – 1 MATERIAL

➢ Computer System Overview

A computer consists of processor, memory, and I/O components, with one or more modules of each type.
These components are interconnected in some fashion to achieve the main function of the computer,
which is to execute programs.
There are four main structural elements:
• Processor: Controls the operation of the computer and performs its data processing functions.
When there is only one processor, it is often referred to as the central processing unit (CPU).
• Main memory: Stores data and programs. This memory is typically volatile; that is, when the
computer is shut down, the contents of the memory are lost. In contrast, the contents of disk
memory are retained even when the computer system is shut down. Main memory is also referred
to as real memory or primary memory.
• I/O modules: Move data between the computer and its external environment. The external
environment consists of a variety of devices, including secondary memory devices (e.g., disks),
communications equipment, and terminals.
• System bus: Provides for communication among processors, main memory, and I/O modules.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

▪ INSTRUCTION EXECUTION:
A program to be executed by a processor consists of a set of instructions stored
in memory. In its simplest form, instruction processing consists of two steps: The
processor reads ( fetches ) instructions from memory one at a time and executes each
instruction.

Program execution consists of repeating the process of instruction fetch


and instruction execution. Instruction execution may involve several operations and depends
on the nature of the instruction.

▪ INTERRUPTS
The occurrence of an event is usually signaled by an Interrupt from either the hardware or
the software. Hardware may trigger an interrupt at any time by sending a signal to the CPU,
usually by way of the system bus. Software may trigger an interrupt executing a special
operation called a System call (also called a monitor call)

Common Functions of Interrupts

Interrupt transfers control to the interrupt service routine generally, through the interrupt
vector, which contains the addresses of all the service routines

Interrupt architecture must save the address of the interrupted instruction


Incoming interrupts are disabled while another interrupt is being processed to prevent a lost
interrupt. A trap is a software-generated interrupt caused either by an error or a user request
An operating system is interrupt driven

Interrupt Handling

The operating system preserves the state of the CPU by storing registers and the program counter.
Determines which type of interrupt has occurred:
Separate segments of code determine what action should be taken for each type of interrupt

▪ CACHE MEMORY
Cache memory, also called cache, supplementary memory system that temporarily stores
frequently used instructions and data for quicker processing by the central processing
unit (CPU) of a computer.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Both main memory and cache are internal random-access memories (RAMs) that use
semiconductor-based transistor circuits. Cache holds a copy of only the most frequently used
information or program codes stored in the main memory. The smaller capacity of the cache
reduces the time required to locate data within it and provide it to the CPU for processing.
When a computer’s CPU accesses its internal memory, it first checks to see if the information
it needs is stored in the cache. If it is, the cache returns the data to the CPU. If the information
is not in the cache, the CPU retrieves it from the main memory.

Goals of Operating System


The objectives of the operating system are −
• To make the computer system convenient to use in an efficient manner.
• To hide the details of the hardware resources from the users.
• To provide users a convenient interface to use the computer system.
• To act as an intermediary between the hardware and its users, making it easier for the users to
access and use other resources.
• To manage the resources of a computer system.
• To keep track of who is using which resource, granting resource requests, and mediating
conflicting requests from different programs and users.
• To provide efficient and fair sharing of resources among users and programs.

Structure of OS
A system as large and complex as a modern operating system must be engineered carefully if it
is to function properly and be modified easily. A common approach is to partition the task into small
components, or modules, rather than have one monolithic system. Each of these modules should be
a well-defined portion of the system, with carefully defined inputs, outputs, and functions.
• Simple structure
• Layered approach
• Microkernels
• Modules
• Hybrid systems

▪ Simple structure:
The Simple structured operating systems do not have a well-defined structure. These systems
will be simple, small and limited systems.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Example: MS-DOS.

There are four layers that make up the MS-DOS operating system, and each has its own set of features.

These layers include ROM BIOS device drivers, MS-DOS device drivers, application programs, and
system programs.

The MS-DOS operating system benefits from layering because each level can be defined independently
and, when necessary, can interact with one another.

If the system is built in layers, it will be simpler to design, manage, and update. Because of this, simple
structures can be used to build constrained systems that are less complex.

When a user program fails, the operating system as whole crashes.

Because MS-DOS systems have a low level of abstraction, programs and I/O procedures are visible to
end users, giving them the potential for unwanted access.

Advantages of Simple Structure:

o Because there are only a few interfaces and levels, it is simple to develop.
o Because there are fewer layers between the hardware and the applications, it offers superior
performance.

Disadvantages of Simple Structure:

o The entire operating system breaks if just one user program malfunctions.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

o Since the layers are interconnected, and in communication with one another, there is no abstraction
or data hiding.
o The operating system's operations are accessible to layers, which can result in data tampering and
system failure.

▪ Monolithic Structure:

The monolithic operating system controls all aspects of the operating system's operation, including file
management, memory management, device management, and operational operations.

The core of an operating system for computers is called the kernel (OS). All other System components
are provided with fundamental services by the kernel. The operating system and the hardware use it as
their main interface. When an operating system is built into a single piece of hardware, such as a keyboard
or mouse, the kernel can directly access all of its resources.

The monolithic operating system is often referred to as the monolithic kernel. Multiple programming
techniques such as batch processing and time-sharing increase a processor's usability. Working on top of
the operating system and under complete command of all hardware, the monolithic kernel performs the
role of a virtual computer. This is an old operating system that was used in banks to carry out simple
tasks like batch processing and time-sharing, which allows numerous users at different terminals to access
the Operating System.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Advantages of Monolithic Structure:

o Because layering is unnecessary and the kernel alone is responsible for managing all operations, it
is easy to design and execute.
o Due to the fact that functions like memory management, file management, process scheduling, etc.,
are implemented in the same address area, the monolithic kernel runs rather quickly when compared
to other systems. Utilizing the same address speeds up and reduces the time required for address
allocation for new processes.

Disadvantages of Monolithic Structure:

o The monolithic kernel's services are interconnected in address space and have an impact on one
another, so if any of them malfunctions, the entire system does as well.
o It is not adaptable. Therefore, launching a new service is difficult.

▪ Layered Structure:

The OS is separated into layers or levels in this kind of arrangement. Layer 0 (the lowest layer)
contains the hardware, and layer 1 (the highest layer) contains the user interface (layer N). These
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

layers are organized hierarchically, with the top-level layers making use of the capabilities of the
lower-level ones.
The functionalities of each layer are separated in this method, and abstraction is also an option. Because
layered structures are hierarchical, debugging is simpler, therefore all lower-level layers are debugged
before the upper layer is examined. As a result, the present layer alone has to be reviewed since all the
lower layers have already been examined.

Advantages of Layered Structure:

o Work duties are separated since each layer has its own functionality, and there is some amount of
abstraction.
o Debugging is simpler because the lower layers are examined first, followed by the top layers.

Disadvantages of Layered Structure:

o Performance is compromised in layered structures due to layering.


o Construction of the layers requires careful design because upper layers only make use of lower
layers' capabilities.

▪ Microkernels Structure:
The operating system is created using a micro-kernel framework that strips the kernel of any
unnecessary parts. Systems and user applications are used to implement these optional kernel
components. So, Micro-Kernels is the name given to these systems that have been developed.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Each Micro-Kernel is created separately and is kept apart from the others. As a result, the system is now
more trustworthy and secure. If one Micro-Kernel malfunctions, the remaining operating system is
unaffected and continues to function normally.

Advantages of Micro-Kernel Structure:

o It enables portability of the operating system across platforms.


o Due to the isolation of each Micro-Kernel, it is reliable and secure.
o The reduced size of Micro-Kernels allows for successful testing.
o The remaining operating system remains unaffected and keeps running properly even if a component
or Micro-Kernel fails.

Disadvantages of Micro-Kernel Structure:

o The performance of the system is decreased by increased inter-module communication.


o The construction of a system is complicated.

▪ Modules:
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

The best current methodology for operating-system design involves using loadable kernel modules
The kernel has a set of core components and links in additional services via modules, either at boot time
or during run time.
The kernel provides core services while other services are implemented dynamically, as the kernel is
running.
Linking services dynamically is more comfortable than adding new features directly to the kernel, which
would require recompiling the kernel every time a change was made.

Example: Solaris OS

The Solaris operating system structure is organized around a core kernel with seven types of loadable
kernel modules:

• Scheduling classes
• File systems
• Loadable system calls
• Executable formats
• STREAMS modules
• Miscellaneous
• Device and bus drivers

▪ Hybrid Systems:

The Operating System combines different structures, resulting in hybrid systems that address performance,
security, and usability issues.
They are monolithic, because having the operating system in a single address space provides very efficient
performance.
However, they are also modular, so that new functionality can be dynamically added to the kernel.

Example: Linux and Solaris are monolithic (simple) and also modular, IOS.

Basic Function of OS
The main operation performed by operating system is to carries out is the allocation of resources
and services, such as allocation of the following −
• Memory
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

• Devices
• Processors
• Information
The operating system includes programs that are helpful to manage these resources, such as a traffic
controller, a scheduler, memory management module, I/O programs, and a file system.

Functions of Operating Systems


Security
The operating system uses a password protection to protect user data it also prevents unauthorized access
to programs and user data, but for external functionality we need to install malware software to protect
the system.

Control over system performance


The operating system monitors overall system setup to help in improving the performance and it also
records the response time between service requests and system response so that it has a complete view
of the system. This can help improve performance by providing important information that is needed at
the time of troubleshooting problems.

Job Accounting
Operating systems always keep track of time and resources that are used by various tasks and users, this
information can be used to track resource usage for a particular user or a group of users.

Error detecting aids


Operating systems constantly monitor the system which helps us to detect errors and also avoid the
malfunctioning of computer systems.

Coordination between other software and users


Operating systems help in coordinate and assign interpreters, compilers, assemblers, and other software
to the various users of the computer systems.

Memory Management
The operating system controls the primary memory or main memory. Primary memory is a large array
of bytes or words where each byte or word is assigned a certain address. It is a fast storage, and it can
be accessed directly by the CPU which is present inside the system. If a program wants to be executed,
it should be first loaded in the main memory.
The following activities are performed by operating system for memory management −
• It keeps track of primary memory.
• Memory addresses that have already been allocated and the memory addresses of the memory
that has not yet been used.
• In multiprogramming, the OS decides for how long the process must stay and the order in which
processes are granted access to memory.
• It allocates the memory to a process when the process requests it and deallocates the memory
when the process has terminated.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Processor Management
The OS manages the order in which processes have access to the processor, and how much processing
time that each process must stay in the multiprogramming environment. This is called process
scheduling.
The following activities are performed by operating system for processor management −
• Keeps track of the status of processes.
• The program to track the status is known as traffic controller.
• It allocates the CPU and deallocates the processor when it is not required.
Device Management
An OS manages device communication through respective drivers.
The following activities are performed by the operating system for device management.
• Keeping track of all devices connected to the system.
• The OS designates a program that is responsible for every device which is called the Input/output
controller.
• It decides which process gets access to which device and for how long. It then allocates the
devices in an effective and efficient way and de-allocates devices when they are not required.
File Management
A file system is arranged into directories for efficient navigation and usage. These directories contain
other directories and other files.
The following activities are performed by operating system for file management activities −
• It keeps track of where information is stored, user access settings and status of every file and
more.
• These facilities are called the file system.

System Calls
The interface between a process and an operating system is provided by system calls. In general,
system calls are available as assembly language instructions.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

System calls are usually made when a process in user mode requires access to a resource. Then it
requests the kernel to provide the resource via a system call.

As can be seen from this diagram, the processes execute normally in the user mode until a system call
interrupts this. Then the system call is executed on a priority basis in the kernel mode. After the
execution of the system call, the control returns to the user mode and execution of user processes can
be resumed.
System calls are required in the following situations −

• If a file system requires the creation or deletion of files. Reading and writing from files also
require a system call.
• Creation and management of new processes.
• Network connections also require system calls. This includes sending and receiving packets.
• Access to a hardware devices such as a printer, scanner etc. requires a system call.

Types of System Calls


There are mainly five types of system calls. These are explained in detail as follows −
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Process Control
These system calls deal with processes such as process creation, process termination etc.
File Management
These system calls are responsible for file manipulation such as creating a file, reading a file, writing
into a file etc.
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.
Communication
These system calls are useful for inter-process communication. They also deal with creating and
deleting a communication connection.

Types of OS
An operating system is a well-organized collection of programs that manages the computer hardware.
It is a type of system software that is responsible for the smooth functioning of the computer system.

Batch Operating System


SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

In the 1970s, Batch processing was very popular. In this technique, similar types of jobs were batched
together and executed in time. People were used to having a single computer which was called a
mainframe.

In Batch operating system, access is given to more than one person; they submit their respective jobs to
the system for the execution.

The system put all of the jobs in a queue on the basis of first come first serve and then executes the jobs
one by one. The users collect their respective output when all the jobs get executed.

Disadvantages of Batch OS

1. Starvation

Batch processing suffers from starvation.

For Example:

2. Not Interactive
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Batch Processing is not suitable for jobs that are dependent on the user's input. If a job requires the input
of two numbers from the console, then it will never get it in the batch processing scenario since the user
is not present at the time of execution.

Multiprogramming Operating System


Multiprogramming is an extension to batch processing where the CPU is always kept busy. Each process
needs two types of system time: CPU time and IO time.

In a multiprogramming environment, when a process does its I/O, The CPU can start the execution of
other processes. Therefore, multiprogramming improves the efficiency of the system.

Advantages of Multiprogramming OS
o Throughout the system, it increased as the CPU always had one program to execute.
o Response time can also be reduced.

Disadvantages of Multiprogramming OS
o Multiprogramming systems provide an environment in which various systems resources are used
efficiently, but they do not provide any user interaction with the computer system.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Multiprocessing Operating System


In Multiprocessing, Parallel computing is achieved. There are more than one processors present in
the system which can execute more than one process at the same time. This will increase the
throughput of the system.

In Multiprocessing, Parallel computing is achieved. More than one processor present in the
system can execute more than one process simultaneously, which will increase the throughput
of the system.

Advantages of Multiprocessing operating system:


SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

o Increased reliability: Due to the multiprocessing system, processing tasks can be distributed
among several processors. This increases reliability as if one processor fails, the task can be
given to another processor for completion.
o Increased throughout: As several processors increase, more work can be done in less.

Disadvantages of Multiprocessing operating System

o Multiprocessing operating system is more complex and sophisticated as it takes care of multiple CPUs
simultaneously.

Multitasking Operating System

The multitasking operating system is a logical extension of a multiprogramming system that


enables multiple programs simultaneously. It allows a user to perform more than one
computer task at the same time.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Advantages of Multitasking operating system


o This operating system is more suited to supporting multiple users simultaneously.
o The multitasking operating systems have well-defined memory management.

Disadvantages of Multitasking operating system


o The multiple processors are busier at the same time to complete any task in a multitasking environment,
so the CPU generates more heat.

Real Time Operating System


In Real-Time Systems, each job carries a certain deadline within which the job is supposed to be
completed, otherwise, the huge loss will be there, or even if the result is produced, it will be
completely useless.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

The Application of a Real-Time system exists in the case of military applications, if you want to
drop a missile, then the missile is supposed to be dropped with a certain precision.

Advantages of Real-time operating system:


o Easy to layout, develop and execute real-time applications under the real-time operating system.
o In a Real-time operating system, the maximum utilization of devices and systems.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Disadvantages of Real-time operating system:


o Real-time operating systems are very costly to develop.
o Real-time operating systems are very complex and can consume critical CPU cycles.

Time-Sharing Operating System


In the Time Sharing operating system, computer resources are allocated in a time-dependent
fashion to several programs simultaneously. Thus it helps to provide a large number of user's direct
access to the main computer. It is a logical extension of multiprogramming. In time-sharing, the
CPU is switched among multiple programs given by different users on a scheduled basis.

A time-sharing operating system allows many users to be served simultaneously, so


sophisticated CPU scheduling schemes and Input/output management are required.

Time-sharing operating systems are very difficult and expensive to build.

Advantages of Time Sharing Operating System


o The time-sharing operating system provides effective utilization and sharing of resources.
o This system reduces CPU idle and response time.
SUB : OPERATING SYSTEM 4TH SEM CE/IT
I/C NAME : PROF. MEGHAL PRAJAPATI

Disadvantages of Time Sharing Operating System


o Data transmission rates are very high in comparison to other methods.
o Security and integrity of user programs loaded in memory and data need to be maintained as many
users access the system at the same time.

Distributed Operating System


The Distributed Operating system is not installed on a single machine, it is divided into parts, and
these parts are loaded on different machines. A part of the distributed Operating system is installed
on each machine to make their communication possible. Distributed Operating systems are much
more complex, large, and sophisticated than Network operating systems because they also have
to take care of varying networking protocols.

Advantages of Distributed Operating System


o The distributed operating system provides sharing of resources.
o This type of system is fault-tolerant.

Disadvantages of Distributed Operating System


o Protocol overhead can dominate computation cost.

You might also like