0% found this document useful (0 votes)
11 views45 pages

OS Unit 1

The document provides an overview of computer systems and operating systems, detailing the components such as the CPU, memory, and input/output devices, as well as their functions. It also describes various types of operating systems, including batch, time-sharing, embedded, multiprogramming, network, distributed, multiprocessing, and real-time operating systems. Additionally, it covers basic terminology, instruction formats, and addressing modes relevant to operating systems.

Uploaded by

malarvizhi k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views45 pages

OS Unit 1

The document provides an overview of computer systems and operating systems, detailing the components such as the CPU, memory, and input/output devices, as well as their functions. It also describes various types of operating systems, including batch, time-sharing, embedded, multiprogramming, network, distributed, multiprocessing, and real-time operating systems. Additionally, it covers basic terminology, instruction formats, and addressing modes relevant to operating systems.

Uploaded by

malarvizhi k
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 45

CS3451-INTRODUCTION TO OPERATING SYSTEMS

UNIT I
INTRODUCTION
COMPUTER SYSTEM - ELEMENTS AND ORGANIZATION
Computer systems consist of three components as shown in below image: Central Processing
Unit, Input devices and Output devices. Input devices provide data input to processor, which
processes data and generates useful information that’s displayed to the user through output
devices. This is stored in computer’s memory.

Central Processing Unit


The Central Processing Unit (CPU) is called "the brain of computer" as it controls operation of
all parts of computer. It consists of two components: Arithmetic Logic Unit (ALU), and Control
Unit.

Arithmetic Logic Unit (ALU)


Data entered into computer is sent to RAM, from where it is then sent to ALU, where rest of data
processing takes place. All types of processing, such as comparisons, decision-making and
processing of non-numeric information takes place here and once again data is moved to RAM.
Control Unit
As name indicates, this part of CPU extracts instructions, performs execution, maintains and
directs operations of entire system.
Functions of Control Unit
Control unit performs following functions −
 It controls all activities of computer
 Supervises flow of data within CPU
 Directs flow of data within CPU
 Transfers data to Arithmetic and Logic Unit
 Transfers results to memory
 Fetches results from memory to output devices
Memory Unit
This is unit in which data and instructions given to computer as well as results given by
computer are stored. Unit of memory is "Byte".
1 Byte = 8 Bits
The computer system is a combination of many parts such as peripheral devices, secondary
memory, CPU etc. This can be explained more clearly using a diagram.
The salient points about the above figure displaying Computer System Organisation is −
 The I/O devices and the CPU both execute concurrently. Some of the processes are
scheduled for the CPU and at the same time, some are undergoing input/output
operations.
 There are multiple device controllers, each in charge of a particular device such as
keyboard, mouse, printer etc.
 There is buffer available for each of the devices. The input and output data can be stored
in these buffers.
 The data is moved from memory to the respective device buffers by the CPU for I/O
operations and then this data is moved back from the buffers to memory.
 The device controllers use an interrupt to inform the CPU that I/O operation is
completed.
Basic Terminology
 Control Unit –
A control unit (CU) handles all processor control signals. It directs all input and output flow,
fetches the code for instructions and controlling how data moves around the system.
 Arithmetic and Logic Unit (ALU) –
The arithmetic logic unit is that part of the CPU that handles all the calculations the CPU may
need, e.g. Addition, Subtraction, Comparisons. It performs Logical Operations, Bit Shifting
Operations, and Arithmetic Operation.
Figure – Basic CPU structure, illustrating ALU
 Main Memory Unit (Registers) –
1. Accumulator: Stores the results of calculations made by ALU.
2. Program Counter (PC): Keeps track of the memory location of the next
instructions to be dealt with. The PC then passes this next address to Memory
Address Register (MAR).
3. Memory Address Register (MAR): It stores the memory locations of
instructions that need to be fetched from memory or stored into memory.
4. Memory Data Register (MDR): It stores instructions fetched from memory or
any data that is to be transferred to, and stored in, memory.
5. Current Instruction Register (CIR): It stores the most recently fetched
instructions while it is waiting to be coded and executed.
6. Instruction Buffer Register (IBR): The instruction that is not to be executed
immediately is placed in the instruction buffer register IBR.
 Input/Output Devices – Program or data is read into main memory from the input
device or secondary storage under the control of CPU input instruction. Output
devices are used to output the information from a computer.
 Buses – Data is transmitted from one part of a computer to another, connecting all major
internal components to the CPU and memory, by the means of Buses. Types:
1. Data Bus: It carries data among the memory unit, the I/O devices, and the
processor.
2. Address Bus: It carries the address of data (not the actual data) between memory
and processor.
3. Control Bus: It carries control commands from the CPU (and status signals from
other devices) in order to control and coordinate all the activities within the
computer.
Instruction Formats (Zero, One, Two and Three Address Instruction)
A instruction is of various length depending upon the number of addresses it contain. Generally
CPU organization are of three types on the basis of number of address fields:
1. Single Accumulator organization
2. General register organization
3. Stack organization
1. Zero Address Instructions –
Address is stored in the opcode, in the zero address instruction. A stack based
organization uses zero address instruction.
2. One Address Instructions –
This use a implied ACCUMULATOR register for data manipulation. One operand is in
accumulator and other is in register or memory location. Implied means that the CPU
already know that one operand is in accumulator so there is no need to specify it. i.e there
will be one opcode field and one address field.
3. Two Address Instructions –
Here two address can be specified in the instruction. Unlike earlier in one address
instruction, the result was stored in accumulator here result can be stored at a different
location rather than just accumulator, but require the number more of the bit to represent
address.
4. Three Address Instructions –
This has three address field to specify a register or a memory location. The program
created is much short in size but the number of bits per instruction increase.
Addressing Modes
The term addressing modes refers to the way in which the operand of an instruction is specified.
The addressing mode specifies a rule for interpreting or modifying the address field of the
instruction before the operand is actually executed.
An assembly language program instruction consists of two parts

IMPORTANT TERMS
 Starting address of memory segment.
 Effective address or Offset: An offset is determined by adding any combination of three
address elements: displacement, base and index.
 Displacement: It is an 8 bit or 16 bit immediate value given in the instruction.
 Base: Contents of base register, BX or BP.
 Index: Content of index register SI or DI.
 Implied mode:In implied addressing the operand is specified in the instruction itself. In
this mode the data is 8 bits or 16 bits long and data is the part of instruction.Zero address
instruction are designed with implied addressing mode.
 Immediate addressing mode (symbol #):In this mode data is present in address field of
instruction .Designed like one address instruction format.
Note:Limitation in the immediate mode is that the range of constants are restricted by
size of address field.
 Register mode: In register addressing the operand is placed in one of 8 bit or 16 bit
general purpose registers. The data is in the register that is specified by the instruction.
Here one register reference is required to access the data.
 Register Indirect mode: In this addressing the operand’s offset is placed in any one of
the registers BX, BP, SI, DI as specified in the instruction. The effective address of the
data is in the base register or an index register that is specified by the instruction.
Here two register reference is required to access the data.
 Auto Indexed (increment mode): Effective address of the operand is the contents of a
register specified in the instruction. After accessing the operand, the contents of this
register are automatically incremented to point to the next consecutive memory location.
(R1)+.
Here one register reference, one memory reference, and one ALU operation is required
to access the data.
 Auto indexed (decrement mode): Effective address of the operand is the contents of a
register specified in the instruction. Before accessing the operand, the contents of this
register are automatically decremented to point to the previous consecutive memory
location. –(R1)
Here one register reference, one memory reference and one ALU operation is required to
access the data.
Auto decrement mode is the same as the auto-increment mode. Both can also be used to
implement a stack as push and pop. Auto increment and Auto-decrement modes are useful for
implementing “Last-In-First-Out” data structures.
 Direct addressing/ Absolute addressing Mode (symbol [ ]): The operand’s offset is
given in the instruction as an 8 bit or 16 bit displacement element. In this addressing
mode, the 16-bit effective address of the data is part of the instruction.
Here only one memory reference operation is required to access the data.
 Indirect addressing Mode (symbol @ or () ):In this mode address field of instruction
contains the address of effective address.Here two references are required.
1st reference to get an effective address.
2nd reference to access the data.
 Indexed addressing mode: The operand’s offset is the sum of the content of an index
register SI or DI and an 8 bit or 16-bit displacement.
 Based Indexed Addressing: The operand’s offset is sum of the content of a base register
BX or BP and an index register SI or DI.
Based on Transfer of control, addressing modes are:
 PC relative addressing mode: PC relative addressing mode is used to implement
intra segment transfer of control, In this mode effective address is obtained by
adding displacement to PC.
 EA= PC + Address field value
PC= PC + Relative value.
 Base register addressing mode:Base register addressing mode is used to
implement inter segment transfer of control.In this mode effective address is
obtained by adding base register value to address field value.
 EA= Base register + Address field value.
 PC= Base register + Relative value.
Note:
1. PC relative and based register both addressing modes are suitable for
program relocation at runtime.
2. Based register addressing mode is best suitable to write position
independent codes.
OPERATING SYSTEM OVERVIEW
An Operating System can be defined as an interface between user and hardware. It is
responsible for the execution of all the processes, Resource Allocation, CPU management, File
Management and many other tasks.
The purpose of an operating system is to provide an environment in which a user can execute
programs in convenient and efficient manner.
An Operating System (OS) is an interface between a computer user and computer hardware. An
operating system is a software which performs all the basic tasks like file management, memory
management, process management, handling input and output, and controlling peripheral devices
such as disk drives and printers.
An operating system is software that enables applications to interact with a computer's hardware.
The software that contains the core components of the operating system is called the kernel.
The primary purposes of an Operating System are to enable applications (software’s) to interact
with a computer's hardware and to manage a system's hardware and software resources.
Some popular Operating Systems include Linux Operating System, Windows Operating System,
VMS, OS/400, AIX, z/OS, etc. Today, Operating systems is found almost in every device like
mobile phones, personal computers, mainframe computers, automobiles, TV, Toys etc.
Structure of a Computer System
A Computer System consists of:
o Users (people who are using the computer)
o Application Programs (Compilers, Databases, Games, Video player, Browsers, etc.)
o System Programs (Shells, Editors, Compilers, etc.)
o Operating System ( A special program which acts as an interface between user and
hardware)
o Hardware (CPU, Disks, Memory, etc)
Architecture
We can draw a generic architecture diagram of an Operating System which is as follows:

Types of Operating System


1. Batch Operating System
2. Time-Sharing Operating System
3. Embedded Operating System
4. Multiprogramming Operating System
5. Network Operating System
6. Distributed Operating System
7. Multiprocessing Operating System
8. Real-Time Operating System
Batch Operating System
In Batch Operating System, there is no direct interaction between user and computer. Therefore,
the user needs to prepare jobs and save offline mode to punch card or paper tape or magnetic
tape. After creating the jobs, hand it over to the computer operator; then the operator sort or
creates the similar types of batches like B2, B3, and B4. Now, the computer operator submits
batches into the CPU to execute the jobs one by one. After that, CPUs start executing jobs, and
when all jobs are finished, the computer operator provides the output to the user.
Time-Sharing Operating System
It is the type of operating system that allows us to connect many people located at different
locations to share and use a specific system at a single time. The time-sharing operating system
is the logical extension of the multiprogramming through which users can run multiple tasks
concurrently. Furthermore, it provides each user his terminal for input or output that impacts the
program or processor currently running on the system. It represents the CPU's time is shared
between many user processes. Or, the processor's time that is shared between multiple users
simultaneously termed as time-sharing.

Embedded Operating System


The Embedded operating system is the specific purpose operating system used in the computer
system's embedded hardware configuration. These operating systems are designed to work on
dedicated devices like automated teller machines (ATMs), airplane systems, digital home
assistants, and the internet of things (IoT) devices.
Multiprogramming Operating System
Due to the CPU's underutilization and the waiting for I/O resource till that CPU remains idle. It
shows the improper use of system resources. Hence, the operating system introduces a new
concept that is known as multiprogramming. A multiprogramming operating system refers to
the concepts wherein two or more processes or programs activate simultaneously to execute the
processes one after another by the same computer system. When a program is in run mode and
uses CPU, another program or file uses I/O resources at the same time or waiting for another
system resources to become available. It improves the use of system resources, thereby
increasing system throughput. Such a system is known as a multiprogramming operating system.
Network Operating System
A network operating system is an important category of the operating system that operates on a
server using network devices like a switch, router, or firewall to handle data, applications and
other network resources. It provides connectivity among the autonomous operating system,
called as a network operating system. The network operating system is also useful to share data,
files, hardware devices and printer resources among multiple computers to communicate with
each other.

Types of network operating system


o Peer-to-peer network operating system: The type of network operating system allows
users to share files, resources between two or more computer machines using a LAN.

o Client-Server network operating system: It is the type of network operating system


that allows the users to access resources, functions, and applications through a common
server or center hub of the resources. The client workstation can access all resources that
exist in the central hub of the network. Multiple clients can access and share different
types of the resource over the network from different locations.

Distributed Operating system


A distributed operating system provides an environment in which multiple independent CPU or
processor communicates with each other through physically separate computational nodes. Each
node contains specific software that communicates with the global aggregate operating system.
With the ease of a distributed system, the programmer or developer can easily access any
operating system and resource to execute the computational tasks and achieve a common goal. It
is the extension of a network operating system that facilitates a high degree of connectivity to
communicate with other users over the network.
Multiprocessing Operating System
It is the type of operating system that refers to using two or more central processing units (CPU)
in a single computer system. However, these multiprocessor systems or parallel operating
systems are used to increase the computer system's efficiency. With the use of a multiprocessor
system, they share computer bus, clock, memory and input or output device for concurrent
execution of process or program and resource management in the CPU.
Real-Time Operating System
A real-time operating system is an important type of operating system used to provide services
and data processing resources for applications in which the time interval required to process &
respond to input/output should be so small without any delay real-time system. For example,
real-life situations governing an automatic car, traffic signal, nuclear reactor or an aircraft require
an immediate response to complete tasks within a specified time delay. Hence, a real-time
operating system must be fast and responsive for an embedded system, weapon system, robots,
scientific research & experiments and various real-time objects.
Types of the real-time operating system:
o Hard Real-Time System
These types of OS are used with those required to complete critical tasks within the
defined time limit. If the response time is high, it is not accepted by the system or may
face serious issues like a system failure. In a hard real-time system, the secondary storage
is either limited or missing, so these system stored data in the ROM.
o Soft Real-Time System
A soft real-time system is a less restrictive system that can accept software and hardware
resources delays by the operating system. In a soft real-time system, a critical task
prioritizes less important tasks, and that priority retains active until completion of the
task. Also, a time limit is set for a specific job, which enables short time delays for
further tasks that are acceptable. For example, computer audio or video, virtual reality,
reservation system, projects like undersea, etc.

OBJECTIVES AND FUNCTIONS OF OPERATING SYSTEMS


The Operating System is a program with the following features −
 An operating system is a program that acts as an interface between the software and the
computer hardware.
 It is an integrated set of specialized programs used to manage overall resources and
operations of the computer.
 It is a specialized software that controls and monitors the execution of all other programs
that reside in the computer, including application programs and other system software.
Objectives 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.
Functions of Operation System
An operating system is a program that acts as a user-computer GUI (Graphical user interface). It
controls the execution of all types of applications.
The operating system performs the following functions in a device.
1. Instruction
2. Input/output Management
3. Memory Management
4. File Management
5. Processor Management
6. Job Priority
7. Special Control Program
8. Scheduling of resources and jobs
9. Security
10. Monitoring activities
11. Job accounting
Instruction: The operating system establishes a mutual understanding between the various
instructions given by the user.
Input/output Management: What output will come from the input given by the user, the
operating system runs this program. This management involves coordinating various input and
output devices. It assigns the functions of those devices where one or more applications are
executed.
Memory Management: The operating system handles the responsibility of storing any data,
system programs, and user programs in memory. This function of the operating system is called
memory management.
File Management: The operating system is helpful in making changes in the stored files and in
replacing them. It also plays an important role in transferring various files to a device.
Processor Management: The processor is the execution of a program that accomplishes the
specified work in that program. It can be defined as an execution unit where a program runs.
Job Priority: The work of job priority is creation and promotion. It determines what action
should be done first in a computer system.
Special Control Program: The operating systems make automatic changes to the task through
specific control programs. These programs are called Special Control Program.
Scheduling of resources and jobs: The operating system prepares the list of tasks to be
performed for the device of the computer system. The operating system decides which device to
use for which task. This action becomes complicated when multiple tasks are to be performed
simultaneously in a computer system. The scheduling programs of the operating system
determine the order in which tasks are completed. It performs these tasks based on the priority of
performing the tasks given by the user. It makes the tasks available based on the priority of the
device.
Security: Computer security is a very important aspect of any operating system. The reliability
of an operating system is determined by how much better security it provides us. Modern
operating systems use a firewall for security. A firewall is a security system that monitors every
activity happening in the computer and blocks that activity in case of any threat.
Monitoring activities: The operating system takes care of the activities of the computer system
during various processes. This aborts the program if there are errors. The operating system sends
instant messages to the user for any unexpected error in the input/output device. It also provides
security to the system when the operating system is used in systems operated by multiple users.
So that illegal users cannot get data from the system.
Job accounting: It keeps track of time & resources used by various jobs and users.
EVOLUTION OF OPERATING SYSTEM
Operating system is divided into four generations, which are explained as follows −
First Generation (1945-1955)
It is the beginning of the development of electronic computing systems which are substitutes for
mechanical computing systems. Because of the drawbacks in mechanical computing systems
like, the speed of humans to calculate is limited and humans can easily make mistakes. In this
generation there is no operating system, so the computer system is given instructions which
must be done directly.
Example − Type of operating system and devices used is Plug Boards.
Second Generation (1955-1965)
The Batch processing system was introduced in the second generation, where a job or a task that
can be done in a series, and then executed sequentially. In this generation, the computer system
is not equipped with an operating system, but several operating system functions exist like FMS
and IBSYS.
Example − Type of operating system and devices used is Batch systems.
Third Generation (1965-1980)
The development of the operating system was developed to serve multiple users at once in the
third generation. Here the interactive users can communicate through an online terminal to a
computer, so the operating system becomes multi-user and multiprogramming.
Example − Type of operating system and devices used is Multiprogramming.
Fourth Generation (1980-Now)
In this generation the operating system is used for computer networks where users are aware of
the existence of computers that are connected to one another.
At this generation users are also comforted with a Graphical User Interface (GUI), which is an
extremely comfortable graphical computer interface, and the era of distributed computing has
also begun.
With the occurrence of new wearable devices like Smart Watches, Smart Glasses, VRGears, and
others, the demand for conventional operating systems has also increased.
And, with the onset of new devices like wearable devices, which includes Smart Watches, Smart
Glasses, VR gears etc, the demand for unconventional operating systems is also rising.
Example − Type of operating system and devices used is personal computers
OPERATING SYSTEM STRUCTURES
The operating system may be implemented with the assistance of several structures. The
structure of the operating system is mostly determined by how the many common components of
the OS are integrated and merged into the kernel. In this article, you will learn the following
structure of the OS. Various structures are used in the design of the operating system. These
structures are as follows:
1. Simple Structure
2. Micro-Kernel Structure
3. Layered Structure
SIMPLE STRUCTURE
Such OS's are small, simple, and limited, with no well-defined structure. There is a lack of
separation between the interfaces and levels of functionality. The MS-DOS is the best example
of such an operating system. Application programs in MS-DOS can access basic I/O functions. If
one of the user programs fails on these OSs, the complete system crashes. Below is the diagram
of the MS-DOS structure that may help you understand the simple structure.

Advantages and Disadvantages of Simple Structure


There are various advantages and disadvantages of the Simple Structure. Some advantages and
disadvantages of the Simple Structure are as follows:
Advantages
1. It provides superior application performance due to the limited interfaces between the
application program and the hardware.
2. It is simple for kernel developers to create such an operating system.
Disadvantages
1. The structure is quite complex because there are no apparent boundaries between
modules.
2. It does not impose data concealment in the operating system.
MICRO-KERNEL STRUCTURE
This micro-kernel structure creates the OS by eliminating all non-essential kernel components
and implementing them as user programs and systems. Therefore, a smaller kernel is known as a
micro-kernel.
The benefits of this micro-kernel structure are that all new services must be added to userspace
rather than the kernel, and the kernel does not require to be updated. Therefore, it is more secure
and trustworthy. If a service fails, the remainder of the OS is unaffected. Mac OS is the best
instance of this type of operating system.
Advantages and Disadvantages of Micro-Kernel Structure
There are various advantages and disadvantages of the Micro-Kernel Structure. Some advantages
and disadvantages of the Micro-Kernel Structure are as follows:
Advantages
1. It allows the OS to be portable across platforms.
2. They can be effectively tested because the microkernels are small.
Disadvantages
1. The performance of the system suffers as the level of inter-module communication rises.
LAYERED STRUCTURE
The layered structure approach breaks up the operating system into different layers and retains
much more control on the system. The bottom layer (layer 0) is the hardware, and the topmost
layer (layer N) is the user interface. These layers are so designed that each layer uses the
functions of the lower-level layers only. It simplifies the debugging process as if lower-level
layers are debugged, and an error occurs during debugging. The error must be on that layer only
as the lower-level layers have already been debugged.
o This allows implementers to change the inner workings and increases modularity.
o As long as the external interface of the routines doesn't change, developers have more
freedom to change the inner workings of the routines.
o The main advantage is the simplicity of construction and debugging. The main difficulty
is defining the various layers.
The main disadvantage of this structure is that the data needs to be modified and passed on at
each layer, which adds overhead to the system. Moreover, careful planning of the layers is
necessary as a layer can use only lower-level layers. UNIX is an example of this structure.
Layering provides a distinct advantage in an operating system. All the layers can be defined
separately and interact with each other as required. Also, it is easier to create, maintain and
update the system if it is done in the form of layers. Change in one layer specification does not
affect the rest of the layers.
Each of the layers in the operating system can only interact with the above and below layers. The
lowest layer handles the hardware, and the uppermost layer deals with the user applications.
Architecture of Layered Structure
This type of operating system was created as an improvement over the early monolithic systems.
The operating system is split into various layers in the layered operating system, and each of the
layers has different functionalities. There are some rules in the implementation of the layers as
follows.
o A particular layer can access all the layers present below it, but it cannot access them.
That is, layer n-1 can access all the layers from n-2 to 0, but it cannot access the nth
o Layer 0 deals with allocating the processes, switching between processes when
interruptions occur or the timer expires. It also deals with the basic multiprogramming of
the CPU.
Thus if the user layer wants to interact with the hardware layer, the response will be traveled
through all the layers from n-1 to 1. Each layer must be designed and implemented such that it
will need only the services provided by the layers below it.
There are six layers in the layered operating system. A diagram demonstrating these layers is as
follows:

1. Hardware: This layer interacts with the system hardware and coordinates with all the
peripheral devices used, such as a printer, mouse, keyboard, scanner, etc. These types of
hardware devices are managed in the hardware layer.
The hardware layer is the lowest and most authoritative layer in the layered operating
system architecture. It is attached directly to the core of the system.
2. CPU Scheduling: This layer deals with scheduling the processes for the CPU. Many
scheduling queues are used to handle processes. When the processes enter the system,
they are put into the job queue. The processes that are ready to execute in the main
memory are kept in the ready queue. This layer is responsible for managing how many
processes will be allocated to the CPU and how many will stay out of the CPU.
3. Memory Management: Memory management deals with memory and moving processes
from disk to primary memory for execution and back again. This is handled by the third
layer of the operating system. All memory management is associated with this layer.
There are various types of memories in the computer like RAM, ROM.
If you consider RAM, then it is concerned with swapping in and swapping out of
memory. When our computer runs, some processes move to the main memory (RAM) for
execution, and when programs, such as calculator, exit, it is removed from the main
memory.
4. Process Management: This layer is responsible for managing the processes, i.e.,
assigning the processor to a process and deciding how many processes will stay in the
waiting schedule. The priority of the processes is also managed in this layer. The
different algorithms used for process scheduling are FCFS (first come, first served), SJF
(shortest job first), priority scheduling, round-robin scheduling, etc.
5. I/O Buffer: I/O devices are very important in computer systems. They provide users with
the means of interacting with the system. This layer handles the buffers for the I/O
devices and makes sure that they work correctly. Suppose you are typing from the
keyboard. There is a keyboard buffer attached with the keyboard, which stores data for a
temporary time. Similarly, all input/output devices have some buffer attached to them.
This is because the input/output devices have slow processing or storing speed. The
computer uses buffers to maintain the good timing speed of the processor and
input/output devices.
6. User Programs: This is the highest layer in the layered operating system. This layer
deals with the many user programs and applications that run in an operating system, such
as word processors, games, browsers, etc. You can also call this an application layer
because it is concerned with application programs.
Advantages of Layered Structure
There are several advantages of the layered structure of operating system design, such as:
1. Modularity: This design promotes modularity as each layer performs only the tasks it is
scheduled to perform.
2. Easy debugging: As the layers are discrete so it is very easy to debug. Suppose an error
occurs in the CPU scheduling layer. The developer can only search that particular layer to
debug, unlike the Monolithic system where all the services are present.
3. Easy update: A modification made in a particular layer will not affect the other layers.
4. No direct access to hardware: The hardware layer is the innermost layer present in the
design. So a user can use the services of hardware but cannot directly modify or access it,
unlike the Simple system in which the user had direct access to the hardware.
5. Abstraction: Every layer is concerned with its functions. So the functions and
implementations of the other layers are abstract to it.
Disadvantages of Layered Structure
Though this system has several advantages over the Monolithic and Simple design, there are also
some disadvantages, such as:
1. Complex and careful implementation: As a layer can access the services of the layers
below it, so the arrangement of the layers must be done carefully. For example, the
backing storage layer uses the services of the memory management layer. So it must be
kept below the memory management layer. Thus with great modularity comes complex
implementation.
2. Slower in execution: If a layer wants to interact with another layer, it requests to travel
through all the layers present between the two interacting layers. Thus it increases
response time, unlike the Monolithic system, which is faster than this. Thus an increase in
the number of layers may lead to a very inefficient design.
3. Functionality: It is not always possible to divide the functionalities. Many times, they
are interrelated and can't be separated.
4. Communication: No communication between non-adjacent layers.
OPERATING SYSTEM SERVICES
It is software that acts as an intermediary between the user and computer hardware. It is a
program with the help of which we are able to run various applications. It is the one program
that is running all the time. Every computer must have an operating system to smoothly
execute other programs. The OS coordinates the use of the hardware and application programs
for various users. It provides a platform for other application programs to work. The operating
system is a set of special programs that run on a computer system that allows it to work
properly. It controls input-output devices, execution of programs, managing files, etc.
Services of Operating System
1. Program Execution
2. Input Output Operations
3. File Management
4. Error Handling
5. Resource Management
6. Communication between Processes
Program Execution:
It is the Operating System that manages how a program is going to be executed. It loads the
program into the memory after which it is executed. The order in which they are executed
depends on the CPU Scheduling Algorithms. A few are FCFS, SJF, etc. When the program is
in execution, the Operating System also handles deadlock i.e. no two processes come for
execution at the same time. The Operating System is responsible for the smooth execution of
both user and system programs. The Operating System utilizes various resources available for
the efficient running of all types of functionalities.
Input Output Operations:
Operating System manages the input-output operations and establishes communication
between the user and device drivers. Device drivers are software that is associated with
hardware that is being managed by the OS so that the sync between the devices works
properly. It also provides access to input-output devices to a program when needed.
File Management:
The operating system helps in managing files also. If a program needs access to a file, it is the
operating system that grants access. These permissions include read-only, read-write, etc. It
also provides a platform for the user to create, and delete files. The Operating System is
responsible for making decisions regarding the storage of all types of data or files, i.e, floppy
disk/hard disk/pen drive, etc. The Operating System decides how the data should be
manipulated and stored.
Error Handling:
The Operating System also handles the error occurring in the CPU, in Input-Output devices,
etc. It also ensures that an error does not occur frequently and fixes the errors. It also prevents
the process from coming to a deadlock. It also looks for any type of error or bugs that can
occur while any task. The well-secured OS sometimes also acts as a countermeasure for
preventing any sort of breach of the Computer System from any external source and probably
handling them.
Resource Management:
System resources are shared between various processes. It is the Operating system that
manages resource sharing. It also manages the CPU time among processes using CPU
Scheduling Algorithms. It also helps in the memory management of the system. It also controls
input-output devices. The OS also ensures the proper use of all the resources available by
deciding which resource to be used by whom.
Communication between Processes:
The Operating system manages the communication between processes. Communication
between processes includes data transfer among them. If the processes are not on the same
computer but connected through a computer network, then also their communication is
managed by the Operating System itself.
Security and Protection:
In an operating system, protection is a mechanism that controls the access of the process,
programs, or users over any resources of the computer system. The operating system ensures
that all access to system resources must be monitored and controlled. It also ensures that the
external resources or peripherals must be protected from invalid access. It provides
authentication by using usernames and passwords.
These were some of the services that an operating system provides.
USER OPERATING SYSTEM INTERFACE
The user and operating system are connected with each other with the help of interface, so
interface is used to connect the user and OS.
In computers there are different types of interface that can be used for connection with
computers to users and their connection is responsible for data transfer.
Also, in computers there are different interfaces. These interfaces are not necessarily used but
can be used in computers whenever it is needed. So, different types of tasks can be performed by
the help of different interfaces.
Command line interface
The command-line interface is an interface whenever the user needs to have different commands
regarding the input and output and then a task is performed so this is called the command-line
argument and it is used to execute the output and create, delete, print, copy, paste, etc.
All these operations are performed with the help of the command-line interface.
The interface is always connected to the OS so that the command given by the user directly
works by the OS and a number of operations can be performed with the help of the command
line interface because multiple commands can be interrupted at same time and execute only one.
The command line interface is necessary because all the basic operations in the computer are
performed with the help of the OS and it is responsible for memory management. By using this
we can divide the memory and we can use the memory.
Command Line Interface advantages −
 Controls OS or application
 faster management
 ability to store scripts which helps in automating regular tasks.
 Troubleshoot network connection issues.
Command Line Interface disadvantages −
 The steeper learning curve is associated with memorizing commands and a complex
syntax.
 Different commands are used in different shells.
Graphical user interface
The graphical user interface is used for playing games, watching videos, etc. these are done with
the help of GUI because all these applications require graphics.
The GUI is one of the necessary interfaces because only by using the user can clearly see the
picture, play videos.
So we need GUI for computers and this can be done only with the help of an operating system.
When a task is performed in the computer then the OS checks the task and defines the interface
which is necessary for the task. So, we need GUI in the OS.
The basic components of GUIs are −
 Start menu with program groups
 Taskbar which showing running programs
 Desktop screen
 Different icons and shortcuts.
Choice of interface
The interface that is used with the help of OS for a particular task and that task can be performed
with minimum possible time and the output is shown on the screen in that case we use the
choice of interface.
The choice of interface means the OS checks the task and finds out which interface can be
suitable for a particular task. So that type of interface is called the choice of interface and this
can be done with the help of an OS.
SYSTEM CALLS
A system call is a way for a user program to interface with the operating system. The program
requests several services, and the OS responds by invoking a series of system calls to satisfy the
request. A system call can be written in assembly language or a high-level language
like C or Pascal. System calls are predefined functions that the operating system may directly
invoke if a high-level language is used.
A system call is a method for a computer program to request a service from the kernel of
the operating system on which it is running. A system call is a method of interacting with the
operating system via programs. A system call is a request from computer software to an
operating system's kernel.
The Application Program Interface (API) connects the operating system's functions to user
programs. It acts as a link between the operating system and a process, allowing user-level
programs to request operating system services. The kernel system can only be accessed using
system calls. System calls are required for any programs that use resources. Will Launch in
When a computer software needs to access the operating system's kernel, it makes a system call.
The system call uses an API to expose the operating system's services to user programs. It is the
only method to access the kernel system. All programs or processes that require resources for
execution must use system calls, as they serve as an interface between the operating system and
user programs.
Below are some examples of how a system call varies from a user function.
1. A system call function may create and use kernel processes to execute the asynchronous
processing.
2. A system call has greater authority than a standard subroutine. A system call with kernel-
mode privilege executes in the kernel protection domain.
3. System calls are not permitted to use shared libraries or any symbols that are not present
in the kernel protection domain.
4. The code and data for system calls are stored in global kernel memory.
There are various situations where you must require system calls in the operating system.
Following of the situations are as follows:
1. It is must require when a file system wants to create or delete a file.
2. Network connections require the system calls to sending and receiving data packets.
3. If you want to read or write a file, you need to system calls.
4. If you want to access hardware devices, including a printer, scanner, you need a system
call.
5. System calls are used to create and manage new processes.
The Applications run in an area of memory known as user space. A system call connects to the
operating system's kernel, which executes in kernel space. When an application creates a system
call, it must first obtain permission from the kernel. It achieves this using an interrupt request,
which pauses the current process and transfers control to the kernel.
If the request is permitted, the kernel performs the requested action, like creating or deleting a
file. As input, the application receives the kernel's output. The application resumes the procedure
after the input is received. When the operation is finished, the kernel returns the results to the
application and then moves data from kernel space to user space in memory.
A simple system call may take few nanoseconds to provide the result, like retrieving the system
date and time. A more complicated system call, such as connecting to a network device, may
take a few seconds. Most operating systems launch a distinct kernel thread for each system call
to avoid bottlenecks. Modern operating systems are multi-threaded, which means they can
handle various system calls at the same time.
Types of System Calls
There are commonly five types of system calls. These are as follows:
1. Process Control
2. File Management
3. Device Management
4. Information Maintenance
5. Communication
Now, you will learn about all the different types of system calls one-by-one.
Process Control
Process control is the system call that is used to direct the processes. Some process control
examples include creating, load, abort, end, execute, process, terminate the process, etc.
File Management
File management is a system call that is used to handle the files. Some file management
examples include creating files, delete files, open, close, read, write, etc.
Device Management
Device management is a system call that is used to deal with devices. Some examples of device
management include read, device, write, get device attributes, release device, etc.
Information Maintenance
Information maintenance is a system call that is used to maintain information. There are some
examples of information maintenance, including getting system data, set time or date, get time or
date, set system data, etc.
Communication
Communication is a system call that is used for communication. There are some examples of
communication, including create, delete communication connections, send, receive messages,
etc.
Examples of Windows and Unix system calls
There are various examples of Windows and Unix system calls. These are as listed below in the
table:

Process Windows Unix

Process Control CreateProcess() Fork()


ExitProcess() Exit()
WaitForSingleObject() Wait()

File Manipulation CreateFile() Open()


ReadFile() Read()
WriteFile() Write()
CloseHandle() Close()

Device Management SetConsoleMode() Ioctl()


ReadConsole() Read()
WriteConsole() Write()

Information GetCurrentProcessID() Getpid()


Maintenance SetTimer() Alarm()
Sleep() Sleep()

Communication CreatePipe() Pipe()


CreateFileMapping() Shmget()
MapViewOfFile() Mmap()

Protection SetFileSecurity() Chmod()


InitializeSecurityDescriptor() Umask()
SetSecurityDescriptorgroup() Chown()

Here, you will learn about some methods briefly:


open()
The open() system call allows you to access a file on a file system. It allocates resources to the
file and provides a handle that the process may refer to. Many processes can open a file at once
or by a single process only. It's all based on the file system and structure.
read()
It is used to obtain data from a file on the file system. It accepts three arguments in general:
o A file descriptor.
o A buffer to store read data.
o The number of bytes to read from the file.
The file descriptor of the file to be read could be used to identify it and open it
using open() before reading.
wait()
In some systems, a process may have to wait for another process to complete its execution before
proceeding. When a parent process makes a child process, the parent process execution is
suspended until the child process is finished. The wait() system call is used to suspend the parent
process. Once the child process has completed its execution, control is returned to the parent
process.
write()
It is used to write data from a user buffer to a device like a file. This system call is one way for a
program to generate data. It takes three arguments in general:
o A file descriptor.
o A pointer to the buffer in which data is saved.
o The number of bytes to be written from the buffer.
fork()
Processes generate clones of themselves using the fork() system call. It is one of the most
common ways to create processes in operating systems. When a parent process spawns a child
process, execution of the parent process is interrupted until the child process completes. Once the
child process has completed its execution, control is returned to the parent process.
close()
It is used to end file system access. When this system call is invoked, it signifies that the program
no longer requires the file, and the buffers are flushed, the file information is altered, and the file
resources are de-allocated as a result.
exec()
When an executable file replaces an earlier executable file in an already executing process, this
system function is invoked. As a new process is not built, the old process identification stays, but
the new process replaces data, stack, data, head, etc.
exit()
The exit() is a system call that is used to end program execution. This call indicates that the
thread execution is complete, which is especially useful in multi-threaded environments. The
operating system reclaims resources spent by the process following the use of the exit() system
function.

SYSTEM PROGRAMS
System programming may be defined as the act of creating System Software by using the
System Programming Languages. A system program offers an environment in which programs
may be developed and run. In simple terms, the system programs serve as a link between the user
interface (UI) and system calls. Some system programs are only user interfaces, and others are
complex. For instance, a compiler is complicated system software.
The system program is a component of the OS, and it typically lies between the user interface
(UI) and system calls. The system user view is defined by the system programs, not the system
call, because the user view interacts with system programs and is closer to the user interface.

Types of the System Program


There are mainly six types of system programs. These are classified as follows:
1. File Management
2. Status Information
3. File Modification
4. Programming-Language support
5. Program Loading and Execution
6. Communication
Now, you will learn all these different types of system programs one by one.
File Management
It is a collection of specific information saved in a computer system's memory. File management
is described as manipulating files in a computer system, including the creation, modification, and
deletion of files.
Status Information
Status information is information about the input, output process, storage, and CPU utilization
time, how the process will be computed in how much memory is necessary to execute a task.
File Modification
These system programs are utilized to change files on hard drives or other storage media.
Besides modification, these programs are also utilized to search for content within a file or to
change content within a file.
Programming-Language Support
The OS includes certain standard system programs that allow programming languages such as C,
Visual Basic, C++, Java, and Pearl. There are various system programs, including compilers,
debuggers, assemblers, interpreters, etc.
Program Loading and Execution
After Assembling and Compiling, the program must be loaded into the memory for execution. A
loader is a component of an operating system responsible for loading programs and libraries, and
it is one of the most important steps to starting a program. The system includes linkage editors,
relocatable loaders, Overlay loaders, and loaders.
Communication
System program offers virtual links between processes, people, and computer systems. Users
may browse websites, log in remotely, communicate messages to other users via their screens,
send emails, and transfer files from one user to another.
Key differences between System Call and System Program in Operating System
There are various key differences between the System Call and System Program in the operating
system. Some main differences between the System Call and System Program are as follows:
1. A user may request access to the operating system's services by using the system call. In
contrast, the system program fulfils a common user request and provides a compatible
environment for a program to create and run effectively.
2. The programmer creates system calls using high-level languages like C and C++.
Assembly level language is used to create the calls that directly interact with the system's
hardware. On the other hand, a programmer solely uses a high-level language to create
system programs.
3. System call defines the interface between the services and the user process provided by
the OS. In contrast, the system program defines the operating system's user interface.
4. The system program satisfies the user program's high-level request. It converts the
request into a series of low-level requests. In contrast, the system call fulfils the low-level
requests of the user program.
5. The user process requests an OS service using a system call. In contrast, the system
program transforms the user request into a set of system calls needed to fulfil the
requirement.
6. The system call may be categorized into file manipulation, device manipulation,
communication, process control, information maintenance, and protection. On the other
hand, a System program may be categorized into file management, program loading and
execution, programming-language support, status information, communication, and file
modification.
Comparison between the System Call and System Program in Operating System
The OS has various head-to-head comparisons between System Call and System Program. Some
comparisons of the System Call and System Program are as follows:

Features System Call System Program

Definition It is a technique in which a It offers an environment for a program


computer system program requests to create and run.
a service from the OS kernel.
Request It fulfils the low-level requests of It fulfils the high-level request or
the user program. requirement of the user program.

Programmin It is usually written in C and C++ It is commonly written in high-level


g Languages programming languages. Assemble- programming languages only.
level language is used in system
calls where direct hardware access
is required.

User View It defines the interface between the It defines the user interface (UI) of the
services and the user process OS.
provided by the OS.

Action The user process requests an OS It transforms the user request into a
service using a system call. set of system calls needed to fulfil the
requirement.

Classification It may be categorized into file It may be categorized into file


manipulation, device manipulation, management, program loading and
communication, process control, execution, programming-language
information maintenance, and support, status information, file
protection. modification, and communication.

DESIGN AND IMPLEMENTATION


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.
There are many problems that can occur while designing and implementing an operating system.
These are covered in operating system design and implementation.
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.
There are basically two types of goals while designing an operating system. These are −
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.
For example - If the mechanism and policy are independent, then few changes are required in
mechanism if policy changes. If a policy favours I/O intensive processes over CPU intensive
processes, then a policy change to preference of CPU intensive processes will not change the
mechanism.
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.
Advantages 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.
Disadvantages 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.
STRUCTURING METHODS
Operating System provides the medium for the user to communicate with the computer
hardware. System software is installed on top of the operating system. Operating System
structure is the basic model which is needed to implement Operating Systems. Different types of
structures implementing Operating Systems are as mentioned below.
o Simple Structure
o Monolithic Structure
o Layered Approach Structure
o Micro-kernel Structure
An operating system has a complex structure, so we need a well-defined structure to assist us in
applying it to our unique requirements. Just as we break down a big problem into smaller, easier-
to-solve subproblems, designing an operating system in parts is a simpler approach to do it. And
each section is an Operating System component. The approach of interconnecting and integrating
multiple operating system components into the kernel can be described as an operating system
structure. As mentioned below, various sorts of structures are used to implement operating
systems.
Simple Structure
It is the simplest Operating System Structure and is not well defined; It can only be used for
small and limited systems. In this structure, the interfaces and levels of functionality are well
separated; hence programs can access I/O routines which can cause unauthorized access to I/O
routines.
This structure is implemented in MS-DOS operating system:
 The MS-DOS operating System is made up of various layers, each with its own set of
functions.
 These layers are:
o Application Program
o System Program
o MS-DOS device drivers
o ROM BIOS device drivers
 Layering has an advantage in the MS-DOS operating system since all the levels can be
defined separately and can interact with each other when needed.
 It is easier to design, maintain, and update the system if it is made in layers. So that's why
limited systems with less complexity can be constructed easily using Simple Structure.
 If one user program fails, the entire operating system gets crashed.
 The abstraction level in MS-DOS systems is low, so programs and I/O routines are
visible to the end-user, so the user can have unauthorized access.
Layering in simple structure is shown below:
Advantages of Simple Structure
 It is easy to develop because of the limited number of interfaces and layers.
 Offers good performance due to lesser layers between hardware and applications.
Disadvantages of Simple Structure
 If one user program fails, the entire operating system crashes.
 Abstraction or data hiding is not present as layers are connected and communicate with
each other.
 Layers can access the processes going in the Operating System, which can lead to data
modification and can cause Operating System to crash.
Monolithic Structure
The Monolithic operating System in which the kernel acts as a manager by managing all things
like file management, memory management, device management, and operational processes of
the Operating System.
The kernel is the heart of a computer operating system (OS). Kernel delivers basic services to all
other elements of the System. It serves as the primary interface between the Operating System
and the hardware.
In monolithic systems, kernels can directly access all the resources of the operating System
like physical hardware, exp Keyboard, Mouse etc.
The monolithic kernel is another name for the monolithic operating system. Batch
processing and time-sharing maximize the usability of a processor by multiprogramming. The
monolithic kernel functions as a virtual machine by working on top of the Operating System and
controlling all hardware components. This is an outdated operating system that was used in
banks to accomplish minor activities such as batch processing and time-sharing, which enables
many people at various terminals to access the Operating System.
A Diagram of the Monolithic structure is shown below:

Advantages of Monolithic structure:


 It is simple to design and implement because all operations are managed by kernel only,
and layering is not needed.
 As services such as memory management, file management, process scheduling, etc., are
implemented in the same address space, the execution of the monolithic kernel is
relatively fast as compared to normal systems. Using the same address saves time for
address allocation for new processes and makes it faster.
Disadvantages of Monolithic structure:
 If any service in the monolithic kernel fails, the entire System fails because, in address
space, the services are connected to each other and affect each other.
 It is not flexible, and to introduce a new service
Layered Approach
In this type of structure, OS is divided into layers or levels. The hardware is on the bottom
layer (layer 0), while the user interface is on the top layer (layer N). These layers are arranged in
a hierarchical way in which the top-level layers use the functionalities of their lower-level levels.
In this approach, functionalities of each layer are isolated, and abstraction is also available. In
layered structure, debugging is easier as it is a hierarchical model, so all lower-level layered is
debugged, and then the upper layer is checked. So all the lower layers are already checked, and
the current layer is to be checked only.
Below is the Image illustrating the Layered structure in OS:

Advantages of Layered Structure


 Each layer has its functionalities, so work tasks are isolated, and abstraction is present up
to some level.
 Debugging is easier as lower layers are debugged, and then upper layers are checked.
Disadvantages of Layered Structure
 In Layered Structure, layering causes degradation in performance.
 It takes careful planning to construct the layers since higher layers only utilize the
functions of lower layers.
Micro-kernel
Micro-Kernel structure designs the Operating System by removing all non-essential components
of the kernel. These non-essential components of kernels are implemented as systems and user
programs. Hence these implemented systems are called as Micro-Kernels.
Each Micro-Kernel is made independently and is isolated from other Micro-Kernels. So this
makes the system more secure and reliable. If any Micro-Kernel fails, then the remaining
operating System remains untouched and works fine.

Advantages of Micro-kernel structure:


 It allows the operating system to be portable between platforms.
 As each Micro-Kernel is isolated, it is safe and trustworthy.
 Because Micro-Kernels are smaller, they can be successfully tested.
 If any component or Micro-Kernel fails, the remaining operating System is unaffected
and continues to function normally.
Disadvantages of Micro-kernel structure:
 Increased inter-module communication reduces system performance.
 System is complex to be constructed.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy