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

OS Unit1

The document summarizes the key elements and organization of a computer system. It discusses how a modern system consists of CPUs, device controllers, and shared memory connected via a common bus. Interrupts are used to signal devices needing attention, and can be maskable or non-maskable. Memory is hierarchical, ranging from fast CPU registers to slower hard disks. I/O uses interrupt-driven or direct memory access techniques. The document outlines storage structures, interrupts, and I/O in a computer system at a high level.

Uploaded by

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

OS Unit1

The document summarizes the key elements and organization of a computer system. It discusses how a modern system consists of CPUs, device controllers, and shared memory connected via a common bus. Interrupts are used to signal devices needing attention, and can be maskable or non-maskable. Memory is hierarchical, ranging from fast CPU registers to slower hard disks. I/O uses interrupt-driven or direct memory access techniques. The document outlines storage structures, interrupts, and I/O in a computer system at a high level.

Uploaded by

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

1

INTRODUCTION
Computer System - Elements and organization; Operating System Overview - Objectives and
Functions - Evolution of Operating System; Operating System Structures – Operating System
Services - User Operating System Interface - System Calls – System Programs - Design and
Implementation - Structuring methods.

1.1COMPUTER SYSTEM- ORGANIZATION


➢ A modern general-purpose computer system consists of one or more CPUs and a
number of device controllers connected through a common bus that provides access
between components and shared memory.
➢ Each device controller is in charge of a specific type of device (for example, a disk
drive, audio device, or graphics display).
➢ Depending on the controller, more than one device may be attached. For instance, one
system USB port can connect to a USB hub, to which several devices can connect.
➢ A device controller maintains some local buffer storage and a set of special-purpose
registers. The device controller is responsible for moving the data between the
peripheral devices that it controls and its local buffer storage.
➢ Typically, operating systems have a device driver for each device controller. This
device driver understands the device controller and provides the rest of the operating
system with a uniform interface to the device.
Figure 1.1 A typical PC computer system

1.1.1 INTERRUPTS

1.1.1.1 What is Interrupts?


➢ Interrupts are the event that can be caused by hardware or software that signals the
processor to complete the ongoing instruction and immediately handle the Interrupt
Service Routine (ISR) which contains the information for dealing with the interrupt.
1.1.1.2 Implementation
➢ The CPU hardware has a wire called the interrupt-request line that the CPU senses after
executing every instruction.
➢ When the CPU detects that a controller has asserted a signal on the interrupt-request
line, it reads the interrupt number and jumps to the interrupt-handler routine by using
that interrupt number as an index into the interrupt vector.
➢ It then starts execution at the address associated with that index. The interrupt handler
saves any state it will be changing during its operation, determines the cause of the
interrupt, performs the necessary processing, performs a state restore, and executes a
return from interrupt instruction to return the CPU to the execution state prior to the
interrupt.
➢ The Device controller raises an interrupt by asserting a signal on the interrupt request
line, the CPU catches the interrupt and dispatches it to the interrupt handler, and the
handler clears the interrupt by servicing the device.
Figure 1.2 Interrupt-driven I/O cycle

1.1.1.3 Maskable and Non Maskable Interrupts


➢ Most CPUs have two interrupt request lines. One is the nonmaskable interrupt, which
is reserved for events such as unrecoverable memory errors.
➢ The second interrupt line is maskable: it can be turned off by the CPU before the
execution of critical instruction sequences that must not be interrupted. The maskable
interrupt is used by device controllers to request service.
1.1.1.4 Intel processor event-vector table
➢ Figure 1.3 illustrates the design of the interrupt vector for Intel processors. The events
from 0 to 31, which are nonmaskable, are used to signal various error conditions. The
events from 32 to 255, which are maskable, are used for purposes such as device-
generated interrupts.
Table 1.1 Intel processor event-vector table.
1.1.1.5 Interrupt handling features

➢ The ability to defer interrupt handling during critical processing.


➢ An efficient way to dispatch to the proper interrupt handler for a device.
➢ Nee for Multilevel interrupts, so that the operating system can distinguish between
high- and low-priority interrupts and can respond with the appropriate degree of
urgency.
1.1.2 STORAGE STRUCTURE
➢ The CPU can load instructions only from memory, so any programs must first be loaded
into memory to run.
➢ General-purpose computers run most of their programs from rewritable memory, called
main memory (also called random-access memory, or RAM).
➢ Main memory commonly is implemented in a semiconductor technology called
dynamic random-access memory (DRAM).
➢ Computers use other forms of memory as well. For example, the first program to run
on computer power-on is a bootstrap program, which then loads the operating system.
➢ Since RAM is volatile i.e.) it loses its content when power is turned off or otherwise
lost so we cannot trust it to hold the bootstrap program.
➢ The computer uses electrically erasable programmable read-only memory (EEPROM)
and other forms of firmware storage that is infrequently written to and is non-volatile.
➢ All forms of memory provide an array of bytes. Each byte has its own address.
Interaction is achieved through a sequence of load or store instructions to specific
memory addresses.
➢ The load instruction moves a byte or word from main memory to an internal register
within the CPU, whereas the store instruction moves the content of a register to main
memory.
1.1.2.1 A Typical Instruction Execution Cycle
➢ A typical instruction–execution cycle, as executed on a system with a von Neumann
architecture, first fetches an instruction from memory and stores that instruction in the
instruction register.
➢ The instruction is then decoded and may cause operands to be fetched from memory
and stored in some internal register.
➢ After the instruction on the operands has been executed, the result may be stored back
in memory.

1.1.2.2 Secondary Storage Devices

➢ Most computer systems provide secondary storage as an extension of main memory.


The main requirement for secondary storage is that it be able to hold large quantities of
data permanently.
➢ The most common secondary-storage devices are hard-disk drives (HDDs) and
nonvolatile memory (NVM) devices, which provide storage for both programs and
data.
➢ Most programs (system and application) are stored in secondary storage until they are
loaded into memory.
➢ Many programs then use secondary storage as both the source and the destination of
their processing.
➢ Secondary storage is also much slower than main memory. Hence, the proper
management of secondary storage is of central importance to a computer system.
1.1.2.2 Hierarchy of Storage-device
➢ The wide variety of storage systems can be organized in a hierarchy (Figure 1.6)
according to storage capacity and access time.
➢ These five hierarchies in a system's memory are register, cache memory, main memory,
magnetic disc, and magnetic tape.
➢ The top four levels of memory in the figure are constructed using semiconductor
memory, which consists of semiconductor-based electronic circuits.
➢ NVM devices, at the fourth level, have several variants but in general are faster than
hard disks. The most common form of NVM device is flash memory, which is popular
in mobile devices such as smartphones and tablets. Increasingly, flash memory is being
used for long-term storage on laptops, desktops, and servers as well.
➢ External or Secondary Memory
❖ It consists of Magnetic Tape, Optical Disk, Magnetic Disk, i.e., it includes
peripheral storage devices that are accessible by the system’s processor via
I/O Module.
➢ Internal Memory or Primary Memory
❖ It consists of CPU registers, Cache Memory, and Main Memory. It is
accessible directly by the processor.

Figure 1.3 Storage-device hierarchy


1.1.3 I/O STRUCTURE
➢ A large portion of operating system code is dedicated to managing I/O, both because of
its importance to the reliability and performance of a system and because of the varying
nature of the devices.

Figure 1.4 How a modern computer system works.

➢ A general-purpose computer system consists of multiple devices, all of which exchange


data via a common bus.
➢ The form of interrupt-driven I/O is fine for moving small amounts of data but can
produce high overhead when used for bulk data movement.
➢ To solve this problem, direct memory access (DMA) is used. After setting up buffers,
pointers, and counters for the I/O device, the device controller transfers an entire block
of data directly to or from the device and main memory, with no intervention by the
CPU.
➢ Only one interrupt is generated per block, to tell the device driver that the operation has
completed, rather than the one interrupt per byte generated for low-speed devices.
➢ While the device controller is performing these operations, the CPU is available to
accomplish other work.
➢ Some high-end systems use switch rather than bus architecture. On these systems,
multiple components can talk to other components concurrently, rather than competing
for cycles on a shared bus.
1.2 COMPUTER SYSTEM- ELEMENTS
➢ A computer system can be organized in different ways, which we can categorize
roughly according to the number of general-purpose processors used.
1.2.1 Single-Processor Systems
➢ Many years ago, most computer systems used a single processor containing one
CPU with a single processing core.
➢ If there is only one general-purpose CPU with a single processing core, then the
system is a single-processor system. So only one process can be executed at a time
and then the process is selected from the ready queue.

Figure 1.5 Single Processor System.

1.2.2 Multiprocessor Systems

➢ The Multiprocessor Systems have two (or more) processors, each with a single-core
CPU.
➢ The processors share the computer bus and sometimes the clock, memory, and
peripheral devices.
➢ The primary advantage of multiprocessor systems is increased throughput. That is,
by increasing the number of processors, we expect to get more work done in less
time.
Figure 1.6 Multicore Chip

➢ Advantages of Multicore Chip


❖ Simultaneous execution
❖ Higher performance
❖ Multithreaded application
❖ Instruction level parallelism
❖ Moore’s law supportive
❖ Lesser heat generation
❖ Reduced power consumption

1.2.2.1 Shared Memory Multiprocessors


➢ In a shared memory system, a collection of autonomous processors is connected to a
memory system through interconnection network, and each processor can access each
memory location.
➢ Processors communicate through shared variables in memory, with all processors
capable of accessing any memory location via loads and stores.

Fig 1.7 Symmetric multiprocessing architecture


1.2.2.2 A Dual Core Processor
➢ In Figure 1.11, we show a dual-core design with two cores on the same processor chip.
In this design, each core has its own register set, as well as its own local cache, often
known as a level 1, or L1, cache.
➢ Notice, too, that a level 2 (L2) cache is local to the chip but is shared by the two
processing cores.
➢ Most architectures adopt this approach, combining local and shared caches, where
local, lower-level caches are generally smaller and faster than higher-level shared
caches.

Fig 1.8 A dual-core design with two cores on the same chip.

➢ Single address space multiprocessors come in two styles.


❖ Uniform memory access (UMA)
❖ Nonuniform memory access (NUMA)

1.2.2.1.1 Uniform memory access (UMA)

➢ Uniform memory access (UMA) is a shared memory architecture used


in parallel computers.
➢ All the processors are identical and have equal access times to all memory
regions. These are also sometimes known as Symmetric Multiprocessor (SMP)
machines.
➢ All the processors in the UMA model share the physical memory uniformly.
➢ UMA systems are easier to program, since the programmer doesn’t need to
worry about the access time for different memory locations.
➢ Interconnect can connect all the processors directly to main memory

Figure 1.9 UMA multiprocessing architecture.

1.2.2.1.2 Nonuniform memory access (NUMA)

➢ NUMA represents Non-uniform Memory Access. NUMA is a multiprocessor model in


which each processor is connected with the dedicated memory.
➢ Non-uniform memory access (NUMA) machines were intended to prevent the memory
access bottleneck of UMA machines.
➢ Memory access between processor core to main memory is not uniform.

Figure 1.10 NUMA multiprocessing architecture.


➢ The memory access time depends on the memory location relative to the processor.
Under NUMA, a processor can access its own local memory faster than non-local
memory.
1.2.3 Clustered Systems
➢ The clustered system is a group of computers in the local area network that is connected
together. They share common storage. They work on a common task.
➢ They have independent input devices like a mouse, keyboard, processor, and memory.
The computers which are clustered together are also known as nodes.
➢ Each node is typically a multicore system. Such systems are considered loosely
coupled.
➢ Clustering is usually used to provide high-availability service—that is, service that will
continue even if one or more systems in the cluster fail.
➢ A layer of cluster software runs on the cluster nodes. Each node can monitor one or
more of the others (over the network).
➢ If the monitored machine fails, the monitoring machine can take ownership of its
storage and restart the applications that were running on the failed machine.
➢ High availability provides increased reliability, which is crucial in many applications.
The ability to continue providing service proportional to the level of surviving hardware
is called graceful degradation.
➢ Some systems go beyond graceful degradation and are called fault tolerant, because
they can suffer a failure of any single component and still continue operation.
➢ Fault tolerance requires a mechanism to allow the failure to be detected, diagnosed,
and, if possible, corrected.

Figure 1.11 Clustered Systems


1.2.3.1 Types of clustered system
There are three main types of clustered systems.
➢ Asymmetric clustering system
❖ In this system, node X is idle (standby mode) and monitor other nodes in the
network. All other nodes work together. If any node fails, then node X will take the
task of the failed node.
➢ Symmetric clustering system
❖ In this system, no node is idle in the network. All nodes work together, and they
also monitor other nodes. If any node fails, then the nearest node will take its task
➢ Parallel clustering system
❖ In a parallel system, multiple users give the tasks to the system and all the tasks are
completed in parallel like in asymmetric and symmetric systems.

1.2.3.2 Benefits of clustered system


Some advantages of the clustered system are: -
➢ High performance:
❖ The nodes work together on large tasks and the overall performance of the system is
improved. The large task is completed in less time.
➢ Reliable:
❖ The tasks are completed without errors and if any problem occurs in the system then it
is easy to fix the problem.
➢ Easy configuration:
❖ These systems have high data travel speed, and all computers are connected to the local
area network (LAN). As all the computers are placed near to each other so they are easy
to configure.
➢ Problem recovering:
❖ If any problem occurs in the system, then it is self-recoverable without user
intervention.
1.2.3.3 Drawbacks of clustered system

Some disadvantages of the clustered system are: -


➢ Technical look after:
❖ It needs technical staff to look after the system and extra hardware is needed to maintain
this system.
➢ Costly:
❖ Building this type of system is costly because the network devices are expensive and
the programming and design that it needs are complex.
1.3 OPERATING SYSTEM OVERVIEW
➢ An operating system acts as an intermediary between the user of a computer and the
computer hardware. The purpose of an operating system is to provide an environment
in which a user can execute programs in a convenient and efficient manner.
➢ An operating system is software that manages the computer hardware. The hardware
must provide appropriate mechanisms to ensure the correct operation of the computer
system and to prevent programs from interfering with the proper operation of the
system.
➢ A fundamental responsibility of an operating system is to allocate these resources to
programs.
1.3.1 What Operating Systems Do
➢ A computer system can be divided roughly into four components: the hardware, the
operating system, the application programs, and a user.
➢ The hardware—the central processing unit (CPU), the memory, and the input/output
(I/O) devices—provides the basic computing resources for the system.
➢ The application programs—such as word processors, spreadsheets, compilers, and
web browsers—define the ways in which these resources are used to solve users’
computing problems.
➢ The operating system controls the hardware and coordinates its use among the various
application programs for the various users.
1.3.1.1 User View
➢ The user’s view of the computer varies according to the interface being used.
➢ Many computer users sit with a laptop or in front of a PC consisting of a monitor,
keyboard, and mouse.
➢ Such a system is designed for one user to monopolize its resources. The goal is to
maximize the work (or play) that the user is performing.
➢ In this case, the operating system is designed mostly for ease of use, with some attention
paid to performance and security and none paid to resource utilization—how various
hardware and software resources are shared.

Fig 1.12 Abstract view of the components of a computer system.

1.3.1.2 System View


➢ From the computer’s point of view, the operating system is the program most intimately
involved with the hardware. In this context, we can view an operating system as a
resource allocator.
➢ A computer system has many resources that may be required to solve a problem: CPU
time, memory space, storage space, I/O devices, and so on. The operating system acts
as the manager of these resources.
➢ An operating system is a control program. A control program manages the execution
of user programs to prevent errors and improper use of the computer. It is especially
concerned with the operation and control of I/O devices.
1.4 OBJECTIVES AND FUNCTIONS
1.4.1 Objectives
➢ Convenience
❖ An operating System works on the utilization of machine. It lets the user
start with the processes that the user wants to accomplish using the machine
in a very quick manner.
➢ Efficiency
❖ An OS allows the computer system resources to be used in an efficient
manner.
➢ Ability to evolve
❖ An OS should be constructed in such a way as to permit the effective
development, testing, and introduction of new system functions without
interfering with service.

1.4.2 Functions of Operating Systems


➢ 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.
1.5 EVOLUTION OF OPERATING SYSTEM
1.5.1 BATCH SYSTEMS
➢ Batch operating system is the operating system which analyses your input and groups
them into batches i.e.) data in each batch is of similar characteristics and then it
performs operation on each individual batch.
➢ The users of batch operating system do not interact with the computer directly. Each
user prepares his job on an off-line device like punch cards and submits it to the
computer operator.
➢ The operator then sorts programs into batches with similar requirements and submit
each group of job into computer.
➢ Jobs are processed in the order of submission i.e first come first served fashion
➢ OS keeps a number a jobs in memory and executes them without any manual
information
➢ When job completes its execution, its memory is released and the output for the job gets
copied into an output spool for later printing or processing.
➢ Batch system process a collection of jobs, called a batch. Batch is a sequence of user
jobs.
➢ Job is a predefined sequence of commands, programs and data that are combined into
single unit
➢ Spooling refers to putting jobs in buffer, a special area in memory or on a disk where
a device can access them when it is ready.
➢ The most common spooling application is print spooling
➢ Example of Batch Operating System is as follows.
❖ DOS (Disk operating system).
❖ IBM OS/2.
❖ Windows 1,2,3 95, 98 and ME

Fig 1.13 Batch Systems


Advantages of Batch System

➢ Move much of the work of the operator to the computer


➢ Increased performance as a new job get started as soon as the previous job finished
without any manual intervention.
Disadvantages of Batch System
➢ Lack of interaction between the user and job.
➢ CPU is often idle, because the speeds of the mechanical I/O devices is slower than CPU.
➢ Difficult to provide the desired priority.
➢ Difficult to debug program

1.5.2 MULTIPROGRAMMING OPERATING SYSTEMS

➢ Execution of multiple jobs in an interleaved manner is known as multiprogramming


➢ In multiprogramming system, when one program is waiting for I/O transfer; there is
another program ready to utilize the CPU. So it is possible for several jobs to share
the time of the CPU.
➢ Jobs are organized in such a way that CPU always has one to execute. This increases
CPU utilization by minimizing CPU idle time.
➢ Operating system loads multiple jobs into memory form job pool on the disk.
➢ The operating system then picks one job form memory and start executing it.
➢ When job need to perform some other activity, such as I/O, operating system simply
picks up another job and starts executing it. When job needs to perform some other
activity, the operating system switches to next job and so on. When I/O activity is
finished it gets the CPU back.
➢ This type of execution of multiple processes is called concurrent execution.
➢ Multiprogramming assumes a single shared processor
➢ Multiprogramming operating system monitors the state of all active programs and
system resources using memory management programs to ensures that the CPU is never
idle unless there are no jobs.
Fig:1.14 Working of Multiprogramming OS

➢ As shown in fig 1.14, at the particular situation, job' A' is not utilizing the CPU time
because it is busy in I/ 0 operations. Hence the CPU becomes busy to execute the job
'B'. Another job C is waiting for the CPU for getting its execution time. So, in this state
the CPU will never be idle and utilizes maximum of its time. A program in execution is
called a "Process", "Job" or a "Task". The concurrent execution of programs improves
the utilization of system resources and enhances the system throughput as compared to
batch and serial processing.

1.5.3 TIME SHARING SYSTEMS


➢ Time sharing refers to allocation of computer resources in time slots to several
programs simultaneously.
➢ Users share these computer resources simultaneously.
➢ Time sharing systems uses CPU scheduling and multiprogramming.
➢ As the system switches rapidly from one user to other, a short time slot is given to each
user for their execution.
➢ CPU time is divided among all the users on a scheduling basics. Round robin algorithm
is used in Time sharing systems.
➢ The OS allocates a set of time to each user. When the time expires it passes control to
the next user on the system.
➢ The time allowed is extremely small and the users are given an impression that they
have their own CPU and they are the sole owner of the CPU
➢ This shortest period of time during a user gets attention of the CPU is known as time
slice or a quantum.

Figure 1.15 Time Sharing Systems

➢ In the above figure user 5 is active but user 1, user 2, user 3, and user 4 are in waiting
state whereas user 6 is in ready status.
➢ As soon as the time slice of user 5 is completed, the control moves on to the next ready
user i.e., user 6. In this state user 2, user 3, user 4, and user 5 are in waiting state and
user 1 is in ready state. The process continues in the same way and so on.
➢ The time-shared systems are more complex than the multi-programming systems. In
time-shared systems multiple processes are managed simultaneously which requires an
adequate management of main memory so that the processes can be swapped in or
swapped out within a short time.
1.5.4 MULTIPROCESSOR OPERATING SYSTEMS
➢ More than one processor in close communication. All the processor share common
bus, clock, memory and peripheral devices.
➢ Increases system throughput buy getting more work done in less time.
➢ More Reliable i.e.) if one processor fails then the remaining processor will share the
work of the failed processor, thus preventing the failure of entire system
➢ Multiprocessor system is of two types
❖ Symmetric multiprocessing
❖ Asymmetric multiprocessing
1.5.4.1 Symmetric multiprocessor system (SMP)

➢ Symmetric multiprocessor system (SMP) is a multiprocessor system with a centralized


shared memory called main memory operating under a single operating system with
two or more homogenous processor
➢ Each processor shares a single copy of operating system.
➢ There is no Master-Slave relationship between processor
➢ Parallelism can be achieved by using multiprocessor operating systems

Figure 1.16 Symmetric multiprocessor system

1.5.4.1 Asymmetric Multiprocessor


➢ Asymmetric Multiprocessing (AMP) allows a multiprocessor system to run multiple
Operating Systems (OS) that are independent of each other. In other words, each CPU
has its own private memory space, which contains the OS and the applications that are
to run on that CPU.
➢ All CPUs are not equal.
➢ There is one master processor and the remaining or slave processor. Master processor
controls the whole operations.
➢ Slave processor either wait for the master instructions to perform any task or have
predefined tasks. This scheme defines master-slave relationship.
➢ Difficult to implement
➢ Failure of the master processor will make entire system to fail.
1.5.5 REAL TIME SYSTEMS
➢ When user gives input to a system, it must process within the time limit and the result
is sent back. Such systems are called Real time systems
➢ Real time system fails if it does not give result within the time limits.
➢ Time constraints is the key parameter in real time systems. It controls autonomous
system such as robots, satellites, air traffic control etc.
➢ Real time systems are of two types.
❖ Hard Real Time
❖ Soft Real Time
1.5.5.1 Hard Real Time System
➢ Critical task is completed within the time limit in hard real time system
➢ Hard real time system is purely deterministic and time constraint system ,for example
users expected the output for the given input in 10sec then system should process the
input data and give the output exactly by 10th second.
➢ In the hard real time system meeting the deadline is very important if deadline is not
met the system performance will fail.
➢ Priority scheduling algorithm is used in hard real time systems
➢ Disabling of all other interrupts of lower priority when running the hard real time tasks.
➢ Response in all the time slots for the given events in the system and thus providing the
guarantee that the task will be completed within the deadline.
➢ video transmission, each picture frame and audio must be transferred at fixed rate
➢ Another example is defence system if a country launched a missile to another country
the missile system should reach the destiny at 4:00 to touch the ground what if missile
is launched at correct time but it reached the destination ground by 4:05 because of
performance of the system, with 5 minutes of difference destination is changed from
one place to another place or even to another country.
1.5.5.2 Soft real time system
➢ In soft real time system, the meeting of deadline is not compulsory for every time for
every task, but process should get processed and give the result.
➢ Even the soft real time systems cannot miss the deadline for every task or process
according to the priority it should meet the deadline or can miss the deadline.
➢ If system is missing the deadline for every time the performance of the system will be
worse and cannot be used by the users.
➢ The best example for soft real time system is personal computer, audio and video
systems, etc.
1.5.6 CLUSTERED SYSTEMS

➢ Clustered system is a group of computer systems connected with a high speed


communication link.
➢ Each computer system has its own memory and peripheral devices.
➢ Clustering provides high availability
➢ A clustered system uses multiple CPUs to complete a task.
➢ A layer of cluster software runs on cluster nodes. Each node can monitor one or more
nodes over the LAN.
➢ The monitored machine can fail in some cases. The monitoring machine can take
ownership of its storage. The monitoring machine can also restart applications that were
running on the failed machine- The failed machine can remain down but the users will
see a brief of the service.
➢ The clustered system can be of the following forms:
Asymmetric Clustering:
❖ In this form, one machine is in hot standby mode and other machine is running
the application. The hot standby machine performs nothing. It only monitors the
server. It becomes the active server if the server fails.
Symmetric Clustering:
❖ In this mode, two or more machines run the applications. They also monitor
each other at the same time. This mode is more efficient because it uses all
available machines. It can be used only if multiple applications are available to
be executed.

Fig:1.17 Cluster System


1.5.7 DISTRIBUTED SYSTEMS
➢ Distributed Operating System is a model where distributed applications are running on
multiple computers linked by communications. A distributed operating system is an
extension of the network operating system that supports higher levels of
communication and integration of the machines on the network.
➢ This system looks to its users like an ordinary centralized operating system but runs
on multiple, independent central processing units (CPUs).
Advantages of distributed OS
✓ Resource sharing
❖ Sharing of software resources such as software libraries, database and
hardware resources such as hard disks, printers, CDROM.
✓ Higher reliability
❖ Reliability refers to degree of tolerance against errors and component
failures
✓ Availability
❖ Fraction of time for which a system is available for use
❖ Availability of hard disk can be increased by having multiple hard disks
located at different sites. If one hard disk fails the program can use some
other hard disk.
✓ Better price performance ratio
❖ Reduction in price of microprocessor and increasing computing power
gives good price-performance ratio
✓ Shortest response time and higher throughput
✓ Incremental growth

Fig:1.18 Distributed System Architecture


1.5.8 HANDHELD SYSTEMS
➢ Very small, lightweight device (such as the Palm Pilot) which provides functionality
approaching that of a laptop computer.
➢ Handheld system contains slow processor, small display and less memory.
➢ Maximum memory supported by handheld system is 2gb
➢ Physical size is the main constraint for handheld system.
➢ Operating system and application must manage memory more efficiently.
➢ Memory manager takes care of allocating and de-allocating of memory. Makes
memory immediately free when task is completed
➢ Processor speed is limited because of power supply
➢ Handheld system operates on battery and battery power is limited.
➢ To increase processor speed, battery capacity must be increased or recharged more
frequently.
➢ Operating system used now a days are Blackberry, Android, Windows
➢ Designing the display screen for such type of device is critial job
➢ Handheld device must support wireless technology. Bluetooth, wi-fi connectivity is
the major features of Handheld device.

1.6 OPERATING SYSTEM STRUCTURES


➢ Every operating system has its own internal structure in terms of file arrangement,
memory management, storage management etc.
➢ The performance of the system depends on its structure
➢ Modern operating system structure is complex in nature
1.6.2 Simple Structure
➢ Structure of the operating system was not well defined.
➢ MS-DOS is an example of simple structure operating system.
➢ Initially DOS is small and simple in size. When new versions are introduced, size goes
on increasing.
➢ There is no CPU execution mode(user and kernel),so errors in application can cause the
whole system to crash.
Fig:1.19 Structure of MS-DOS System

➢ The fig shows the layers present in MS-DOS operating system.


➢ In DOS, application program directly interacts with BIOS device driver. If user makes
changes in BIOS device driver, it creates problems and affects the whole system.
➢ Memory size is also limited so after use, memory must made free for other users.
1.6.3 Layered Approach
➢ A system can be made modular in many ways. One method is the layered approach,
in which the OS is broken up into a number of layers (levels). The bottom layer (layer
0) is the hardware; the highest (layer N) is the user interface.
➢ The first system constructed in this way was the THE system built by E. W. Dijkstra
(1968) and his students.
➢ The system had 6 layers

Table:1.2 Structure of THE Operating System


➢ Layer 0 dealt with allocation of the processor, switching between processes when
interrupts occurred, or timers expired. Layer 0 provided the basic multiprogramming of
the CPU.
➢ Layer 1 did the memory management. It allocated space for processes in main memory.
Layer 1 software took care of making sure pages were brought into memory whenever
they were needed.
➢ Layer 2 handled communication between each process and the operator console.
➢ Layer 3 took care of managing the I/O devices and buffering the information streams
to and from them.
➢ Layer 4 was where the user programs were found. They did not have to worry about
process, memory, console, or I/O management.
➢ The system operator process was located in layer 5.
➢ The main advantage of the layered approach is simplicity of construction and
debugging. The layers are selected so that each uses functions (operations) and
services of only lower-level layers. This approach simplifies debugging and system
verification.
➢ Each layer is implemented with only those operations provided by lower-level layers.
A layer does not need to know how these operations are implemented; it needs to
know only what these operations do. Hence, each layer hides the existence of certain
data structures, operations, and hardware from higher-level layers.
➢ A problem with layered implementations is that they tend to be less efficient than
other types. For instance, when a user program executes an I/O operation, it executes
a system call that is trapped to the I/O layer, which calls the memory-management
layer, which in turn calls the CPU-scheduling layer, which is then passed to the
hardware. Each layer adds overhead to the system call; the net result is a system call
that takes longer than does one on a non-layered system.
1.6.4 Kernel
➢ The kernel is the central module of an operating system (OS). It is otherwise called
as heart of the Operating System (OS).
➢ It is the part of the operating system that loads first, and it remains in main memory.
➢ Because it stays in memory, it is important for the kernel to be as small as possible
while still providing all the essential services required by other parts of the operating
system and applications.
➢ The kernel code is usually loaded into a protected area of memory to prevent it from
being overwritten by programs or other parts of the operating system.
➢ A kernel connects the application software to the hardware of a computer

Fig:1.20 Structure of Kernel

➢ The kernel provides services for memory management, process management, file
management, and disk management.
➢ The kernel performs tasks in Kernel space. Executing processes and handling interrupts
are performed by kernel in kernel space.
➢ User performs his task in user area in memory.
➢ Memory is divided into user area and system area. This memory separation is made in
order to prevent user data and kernel data from interfering with each other.
➢ When a computer crashes it actually means the kernel has crashed. When a user
application program crashes it doesn’t meant kernel got crashed.
➢ A Kernel includes
❖ Scheduler
❖ Supervisor
❖ Interrupt Handler
❖ Memory Manager
➢ Scheduler allocates Kernels processing time to various processes.
➢ Supervisor grants permission to use computer system resources to each process
➢ Interrupt handler handles all requests from various hardware devices which compete
for Kernels services.
Fig:1.21 Main Components of OS

➢ The Kernel does not interact directly with the user. But it interacts with the shell, other
programs and hardware.
➢ Memory manager allocates space in memory for processes that requires the services of
kernel
➢ Types of Kernel
❖ Monolithic Kernel
❖ Micro Kernel
❖ Hybrid Kernel
❖ Exo-Kernel

1.6.4.1 Monolithic Kernel

➢ Monolithic kernel is a single large process running entirely in a single address space.
➢ The entire operating systems run as a single program in kernel mode.
➢ Basic OS services such as process management, memory management, interrupt
handling, IO communication, file system, device drivers, networking, etc all run in
kernel space. All kernel services exist and execute in kernel address space.
➢ Entire services are loaded on boot up and reside in memory and work is done using
system calls.
➢ Most of the operation performed by Kernel is via system call.ie)The kernel
communicates with the user process through system calls.
➢ A monolithic kernel can be easy to implement if we are ready to accept very high
latency [i.e. we service requests without worrying about the urgency of other requests.
➢ The examples of monolithic kernel based OSs are Linux, Unix.

Fig:1.22 Monolithic Kernel based Operating Systems

Advantages:
➢ Simple to design and implement
➢ Simplicity provides speed on simple hardware
➢ Monolithic OS kernel is faster due to small source and compiled code size.
➢ Less code means also less bugs and security issues.
Disadvantages:
➢ The inclusion of all basic services in Kernel space has three big drawbacks
❖ Kernel size
❖ Lack of extensibility
❖ Bad Maintainability
❖ Fault tolerance is low
1.6.4.2 Microkernel

➢ The idea behind microkernel OS is to reduce the kernel to only basic process
communication and IO control and let other system services run in user space just like
any other normal processes.
➢ These services are called servers and kept separate and run in different address spaces.
➢ It provides facilities to various services which are running in user mode.
➢ There is a server for managing memory issues, one server does process management,
and another one manages drivers, and so on.
➢ Because the servers do not run in kernel space anymore, so called” context switches”
are needed, to allow user processes to enter privileged mode (and to exit again).
➢ Message passing method is used for communication between two processes.
➢ Mac OS and WinNT are two examples on microkernel OS architecture.
User Application

User Space
Libraries

Process File Systems Device Virtual …………..


Driver Memory

Kernel Space Microkernel

Computer Hardware

Fig:1.23 Microkernel bases Operating Systems

Advantages:

➢ Service separation has the advantage that if one service (called a server) fails others
can still work so reliability is the primary feature. For example, if a device driver
crashes does not cause the entire system to crash. Only that driver needs to be
restarted rather than having the entire system die. This means more persistence as
one server can be substituted with another.
➢ Maintenance is easier.
➢ Different services are built into special modules which can be loaded or unloaded
when needed.
➢ Message passing allows independent communication and allows extensibility
➢ Microkernel architecture supports object oriented operating systems.
➢ Modular design helps to improve reliability.
➢ Microkernel architecture support flexibility ie) User can add or remove services
according to requirement
S.NO Monolithic Kernel Micro Kernel
1 Kernel size is large Kernel size is small
2 OS is complex to design OS is easy to design and
install
3 Request may be serviced Request is serviced
faster slower than Monolithic
Kernel
4 All the operating system Kernel provides only
services are included in IPC and low level
Kernel device management
services
5 No message passing and no Microkernel requires
context switching are required message passing and
while kernel is performing the context switches
job

Table 1.3 Comparison between Monolithic Kernel and Microkernel

1.6.4.3 Hybrid Kernel


➢ Hybrid kernel is a kernel architecture based on a combination of microkernel and
monolithic kernel architecture used in computer operating systems.
➢ This kernel approach combines the speed and simpler design of monolithic kernel with
the modularity and execution safety of microkernel.
➢ A hybrid kernel runs some services in the kernel space to reduce the performance
overhead of a traditional microkernel, while still running kernel code as servers in the
user space.
➢ For instance, a hybrid kernel design may keep the virtual files system and bus
controllers inside the kernel and the file system drivers and storage drivers as user
mode programs outside the kernel.
➢ Hybrid kernels usually have structure similar to microkernel but implemented as a
monolithic kernel.
➢ Hybrid Kernels, similar to microkernel, use separate sever programs for file systems,
device drivers, etc. However, like Monolithic Kernels, these severs execute as part of
the Kernel, instead of user space.
➢ Hybrid kernels are not in their own design; they are just modified Microkernel with
some aspects from monolithic kernels.
➢ The Microsoft NT kernel is a well-known example of a hybrid kernel that powers
Windows NT, Windows 2000, Windows XP, Windows Server 2003, Windows Vista,
Windows Server 2008 and Windows 7.

Fig:1.24 Hybrid kernels

1.7 OPERATING SYSTEM SERVICES

➢ An Operating System provides services to both the users and to the programs.
❖ It provides programs an environment to execute.
❖ It provides users the services to execute the programs in a convenient manner.
➢ Following are a few common services provided by an operating system −
❖ Program execution
❖ I/O operations
❖ File System manipulation
❖ Communication
❖ Error Detection
❖ Resource Allocation
❖ Protection
1.7.1 Program execution
➢ Operating systems handle many kinds of activities from user programs to system
programs like printer spooler, name servers, file server, etc. Each of these activities is
encapsulated as a process.
➢ A process includes the complete execution context (code to execute, data to manipulate,
registers, OS resources in use). Following are the major activities of an operating
system with respect to program management −
❖ Loads a program into memory.
❖ Executes the program.
❖ Handles program's execution.
❖ Provides a mechanism for process synchronization.
❖ Provides a mechanism for process communication.
❖ Provides a mechanism for deadlock handling.
1.7.2 I/O Operation

➢ An I/O subsystem comprises of I/O devices and their corresponding driver software.
Drivers hide the peculiarities of specific hardware devices from the users.
➢ An Operating System manages the communication between user and device drivers.
❖ I/O operation means read or write operation with any file or any specific I/O
device.
❖ Operating system provides the access to the required I/O device when required.
1.7.3 File system manipulation
➢ A file represents a collection of related information. Computers can store files on the
disk (secondary storage), for long-term storage purpose. Examples of storage media
include magnetic tape, magnetic disk and optical disk drives like CD, DVD. Each of
these media has its own properties like speed, capacity, data transfer rate and data
access methods.
➢ A file system is normally organized into directories for easy navigation and usage.
These directories may contain files and other directions. Following are the major
activities of an operating system with respect to file management −

❖ Program needs to read a file or write a file.


❖ The operating system gives the permission to the program for operation on file.
❖ Permission varies from read-only, read-write, denied and so on.
❖ Operating System provides an interface to the user to create/delete files.
❖ Operating System provides an interface to the user to create/delete directories.
❖ Operating System provides an interface to create the backup of file system.
1.7.4 Communication

➢ In case of distributed systems which are a collection of processors that do not share
memory, peripheral devices, or a clock, the operating system manages communications
between all the processes. Multiple processes communicate with one another through
communication lines in the network.
➢ The OS handles routing and connection strategies, and the problems of contention and
security. Following are the major activities of an operating system with respect to
communication −
❖ Two processes often require data to be transferred between them
❖ Both the processes can be on one computer or on different computers but are
connected through a computer network.
❖ Communication may be implemented by two methods, either by Shared
Memory or by Message Passing.
1.7.5 Error handling
➢ Errors can occur anytime and anywhere. An error may occur in CPU, in I/O devices or
in the memory hardware. Following are the major activities of an operating system with
respect to error handling −
❖ The OS constantly checks for possible errors.
❖ The OS takes an appropriate action to ensure correct and consistent computing.
1.7.6 Resource Management
➢ In case of multi-user or multi-tasking environment, resources such as main memory,
CPU cycles and files storage are to be allocated to each user or job. Following are the
major activities of an operating system with respect to resource management −
❖ The OS manages all kinds of resources using schedulers.
❖ CPU scheduling algorithms are used for better utilization of CPU.
1.7.7 Protection
➢ Considering a computer system having multiple users and concurrent execution of
multiple processes, the various processes must be protected from each other's activities.
➢ Protection refers to a mechanism or a way to control the access of programs, processes,
or users to the resources defined by a computer system. Following are the major
activities of an operating system with respect to protection −
❖ The OS ensures that all access to system resources is controlled.
❖ The OS ensures that external I/O devices are protected from invalid access
attempts.
❖ The OS provides authentication features for each user by means of passwords.

1.8 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.
1.8.1 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.
1.8.2 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.
1.8.3 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.

1.9 SYSTEM CALLS


➢ System call is how a user program requests a service from an operating system's kernel
that it does not normally have permission to run. System calls provide the interface
between a process and the operating system.
1.9.1 Example for System Call
➢ Consider that there is a user program that will read the content of one file and will copy
it into another file. Here the first information that the system requires is the name of
two files, the first file from where the data has to be read (input file) and the second file
where the data has to be copied (output file).
➢ Depending on the different types of operating systems a sequence of system calls will
be required.
➢ A sequence of system calls in an interactive system will be like this:
Fig:1.25 Examples of System Calls
1.9.2 Working of System Call
➢ Initially, a processor executes a user program in the user mode.
➢ Then if the program needs the services of the operating system the processor is
interrupted by the system call.
➢ A system call is always prioritized over the other executions and the system call is then
executed in the kernel mode.
➢ Once the system call is executed completely the control goes back to the user mode.
➢ And the execution of the program resumes back in the user mode.
➢ Three most common APIs are
❖ Win32 API for Windows,
❖ POSIX API (all versions of UNIX, Linux, and Mac OS X), and
❖ Java API for the Java virtual machine (JVM)
Fig:1.26 System Call Handled by the Kernel

1.9.3 Three general methods exist for passing parameters to the OS:
1. Parameters can be passed in registers.
2. When there are more parameters than registers, parameters can be stored in a block and
the block address can be passed as a parameter to a register.
3. Parameters can also be pushed on or popped off the stack by the operating system.

Fig:1.27 Passing Parameters to the Operating Systems

1.9.1 TYPES OF SYSTEM CALLS

➢ There are 5 different categories of system calls:


❖ Process control,
❖ File manipulation
❖ Device management
❖ Information maintenance
❖ Communication.
1.9.1.1 Process Control

➢ System call under this category includes calls to create a new process, terminate a
process, setting and retrieving process attributes (such as process priority, its maximum
allowable execution time, etc), forcing a process to wait for some time or some event
to occur, etc.
➢ A running program needs to be able to stop execution either normally or abnormally.
When execution is stopped abnormally, often a dump of memory is taken and can be
examined with a debugger.
1.9.1.2 File manipulation
➢ System call under this category include calls to create, delete, open ,close read and
write a file.
1.9.1.3 Device Management
➢ System calls under this category includes calls to request for device, releasing it and
performing some operations (such as read or write) with the device.
1.9.1.4 Information Maintenance
➢ System calls under this category includes calls to return information about the
system, such as systems current date and time, number of current users, version of
operating systems, amount of free memory, etc.
1.9.1.5 Communication
➢ There are two models of interprocess communication, the message-passing model
and the shared memory model.
➢ In a shared memory model, a process uses memory for communication. One process
will create a memory partition which other processes can access. A shared segment
can be attached multiple times by the same process
➢ In message passing communication is done either direct or indirect
❖ In direct communication process address each other by their PID assigned
to them by OS.
❖ In indirect communication messages are sent and received via mailbox
Table 1.4: Examples of WINDOWS and UNIX system calls

1.9 SYSTEM PROGRAMS


➢ In addition to system calls, modern systems also provide variety of system
programs. These programs act as an interface between the operating system and
application programs.
➢ They provide an environment in which application programs can be developed and
executed in a convenient manner.
➢ The system programs can be classified into following categories
1.10.1 File Management
➢ The System programs under this category provide commands, such as cut, copy,
save, print, etc to perform various operations on files and directories.
1.10.2 File modification
➢ The system programs under this category allow creating or modifying the contents
of a file stored on disk or some other storage devices.
➢ Text editor is a system program that belongs to this category. Vi is the text editor
used in Unix operating systems.
1.10.3 Communications
➢ The system programs under this category enable communication among different
users, processes, or systems by establishing virtual connection between them.
➢ With the help of these programs, user can send messages to other users, log on some
remote systems or transfer data from other system to its own systems.
1.10.4 Status information
➢ The system programs under this category are used to present the status of the
computer system, such as system date and time, number of users connected, CPU
utilization, disk and memory usage, Configuration information, etc.
1.10.5 Programming Language Support
➢ Several programming languages support different system programs, such as
compilers, assemblers and interpreters.
➢ These system programs are generally provided to users along with OS.
1.10.6 Program loading and execution
➢ After the user program has been compiled, it needs to be in main memory for
execution.
➢ The task of loading a program into memory is performed by loader, a system
program.
➢ The successful execution of the program also requires debugging, which is
performed by debugger (a system program under this category).

1.11 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.
Figure 1.28 Layered Operating System Design

1.11.1 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
1.11.1.1 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.
1.11.1.2 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.
1.11.2 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.

1.11.3 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.
1.11.4 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.
1.11.5 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.

1.12 STRUCTURING METHODS


1.12.1 What is the Operating System 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.
1.12.2 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:
❖ Application Program
❖ System Program
❖ MS-DOS device drivers
❖ 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.

Figure 1.29 Layering in Simple Structure


1.12.2.1 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.
1.12.2.2 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.
1.12.3 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.
Figure 1.30 Monolithic Structure

1.12.3.1 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.

1.12.3.2 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
1.12.4 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.

Figure 1.31 Layered structure in OS

1.12.4.1 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.
1.12.4.2 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.
1.12.5 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.

Figure 1.32 Structure of Microkernel bases Operating Systems

1.12.5.1 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.
1.12.5.2 Disadvantages of Micro-kernel structure:
➢ Increased inter-module communication reduces system performance.
➢ System is complex to be constructed.
REVIEW QUESTION
PART-A
1. What does a modern general-purpose computer system consist of?
➢ A modern general-purpose computer system consists of one or more CPUs and a
number of device controllers connected through a common bus that provides access
between components and shared memory.
2. What is Interrupts?
➢ Interrupts are the event that can be caused by hardware or software that signals the
processor to complete the ongoing instruction and immediately handle the Interrupt
Service Routine (ISR) which contains the information for dealing with the interrupt.
3. What are Maskable and Non Maskable Interrupts?
➢ Most CPUs have two interrupt request lines. One is the nonmaskable interrupt,
which is reserved for events such as unrecoverable memory errors.
➢ The second interrupt line is maskable: it can be turned off by the CPU before the
execution of critical instruction sequences that must not be interrupted. The
maskable interrupt is used by device controllers to request service.
4. Outline the Hierarchy of Storage-device with neat diagram.

Fig: Storage Device Hierarchy


5. Compare between Single-Processor and Multi-Processor System
Single-Processor
➢ If there is only one general-purpose CPU with a single processing core, then the
system is a single-processor system. So only one process can be executed at a time
and then the process is selected from the ready queue.

Fig: Single Processor System.


Multi-Processor

➢ The Multiprocessor Systems have two (or more) processors, each with a single-core
CPU.
➢ The processors share the computer bus and sometimes the clock, memory, and
peripheral devices.

Fig: Multi Processor System.

6. List the advantages of Multicore chip


➢ Simultaneous execution
➢ Higher performance
➢ Multithreaded application
➢ Instruction level parallelism
➢ Moore’s law supportive
➢ Lesser heat generation
➢ Reduced power consumption
7. What are Shared Memory Multiprocessors?
➢ In a shared memory system, a collection of autonomous processors is connected to a
memory system through interconnection network, and each processor can access each
memory location.
➢ Processors communicate through shared variables in memory, with all processors
capable of accessing any memory location via loads and stores.

Fig: Shared Memory Multiprocessors

8. What is NUMA
➢ NUMA represents Non-uniform Memory Access. NUMA is a multiprocessor
model in which each processor is connected with the dedicated memory.
➢ Memory access between processor core to main memory is not uniform.

Fig: NUMA Multiprocessing Architecture


9. Compare between UMA and NUMA.
UMA NUMA
All the processors in the UMA model share NUMA is a multiprocessor model in which
the physical memory uniformly. each processor is connected with the
dedicated memory.
All the processors are identical and have Memory access between processor core to
equal access times to all memory regions. main memory is not uniform.
Offers Limited Bandwidth Offers relatively more bandwidth than
UMA
Since it uses a single memory controller it It uses multiple memory controls to speed
is slower than NUMA up operations compared to UMA
Table: Difference between UMA and NUMA

10. What are Clustered Systems?


➢ The clustered system is a group of computers in the local area network that is
connected together. They share common storage. They work on a common task.
➢ The computers which are clustered together are also known as nodes. Each node is
typically a multicore system. Such systems are considered loosely coupled.

Fig: Clustered Systems


11. Define the term “OS”
➢ An operating system acts as an intermediary between the user of a computer and
the computer hardware.
➢ The purpose of an operating system is to provide an environment in which a user
can execute programs in a convenient and efficient manner.
➢ The operating system controls the hardware and coordinates its use among the
various application programs for the various users.
12. List out few common goals of any Operating Systems.
➢ Execute user programs and make solving user problems easier
➢ Make the computer system convenient to use
➢ Use the computer hardware in an efficient manner
13. What are the objectives of an Operating Systems?
Convenience
➢ An operating System works on the utilization of machine. It lets the user start with
the processes that the user wants to accomplish using the machine in a very quick
manner.
Efficiency
➢ An OS allows the computer system resources to be used in an efficient manner.
Ability to evolve
➢ An OS should be constructed in such a way as to permit the effective
development, testing, and introduction of new system functions without
interfering with service.
14. What are Batch Operating Systems?
➢ Batch operating system is the operating system which analyses your input and
groups them into batches i.e.) data in each batch is of similar characteristics and
then it performs operation on each individual batch.
➢ Examples of Batch OS
❖ DOS (Disk operating system
❖ IBM OS/2
❖ Windows 1,2,3 95, 98 and ME
Fig: Batch Operating System

15. List out the drawbacks of Batch Systems


➢ Lack of interaction between the user and job.
➢ CPU is often idle because the speeds of the mechanical I/O devices is slower than
CPU.
➢ Difficult to provide the desired priority.
➢ Difficult to debug program
16. What are Multiprogramming Operating Systems?
➢ Execution of multiple jobs in an interleaved manner is known as multiprogramming
➢ In multiprogramming system, when one program is waiting for I/O transfer; there
is another program ready to utilize the CPU. So it is possible for several jobs to
share the time of the CPU.
17. What is Time Sharing Systems?
➢ Time sharing refers to allocation of computer resources in time slots to several
programs simultaneously.
➢ The OS allocates a set of time to each user. When the time expires it passes control
to the next user on the system.
➢ Users share these computer resources simultaneously.
➢ Time sharing systems uses CPU scheduling and multiprogramming.

Fig: Time Sharing Systems


18. What is Symmetric Multiprocessor System?
➢ Symmetric multiprocessor system (SMP) is a multiprocessor system with a
centralized shared memory called main memory operating under a single operating
system with two or more homogenous processor
➢ Each processor shares a single copy of operating system.
➢ There is no Master-Slave relationship between processors.

Fig: Symmetric Multiprocessor System


19. What are Real Time Systems?
➢ When user gives input to a system, it must process within the time limit and the result
is sent back. Such systems are called Real time systems
➢ Real time system fails if it does not give result within the time limits.
➢ Real time systems are of two types.
❖ Hard Real Time Systems
❖ Soft Real Time Systems
20. What are Hard Real Time Systems?
➢ Critical task is completed within the time limit in hard real time system
➢ Hard real time system is purely deterministic and time constraint system, for
example users expected the output for the given input in 10sec then system should
process the input data and give the output exactly by 10th second.
21. What are Soft Real Time Systems?
➢ In soft real time system, the meeting of deadline is not compulsory for every time
for every task, but process should get processed and give the result.
➢ Even the soft real time systems cannot miss the deadline for every task or process
according to the priority it should meet the deadline or can miss the deadline.
22. What are Distributed Systems?
➢ Distributed Operating System is a model where distributed applications are running
on multiple computers linked by communications.
➢ A distributed operating system is an extension of the network operating system that
supports higher levels of communication and integration of the machines on the
network.

Fig: Distributed System


23. List the advantages of Distributed Operating Systems.
➢ Resource sharing
➢ Higher reliability
➢ Availability
24. List out the difference between Monolithic Kernel and Micro Kernel

S.NO Monolithic Kernel Micro Kernel


1 Kernel size is large Kernel size is small
2 OS is complex to design OS is easy to design and
install
3 Request may be serviced Request is serviced
faster slower than Monolithic
Kernel
4 All the operating system Kernel provides only
services are included in IPC and low-level
Kernel device management
services
5 No message passing and no Microkernel requires
context switching are required message passing and
while kernel is performing the context switches
job

25. Write short notes on Operating System Services.


➢ An Operating System provides services to both the users and to the programs.
➢ It provides programs an environment to execute.
➢ It provides users the services to execute the programs in a convenient manner.
➢ Following are a few common services provided by an operating system −
❖ Program execution
❖ I/O operations
❖ File System manipulation
❖ Communication
❖ Error Detection
❖ Resource Allocation
❖ Protection
26. What are System Calls?
➢ System call is how a user program requests a service from an operating system's
kernel that it does not normally have permission to run. System calls provide the
interface between a process and the operating system.

Fig: System Calls

27. List out the different categories of System Calls.


➢ Process control,
➢ File manipulation
➢ Device manipulation
➢ Information maintenance and Communication.
28. Write short notes on System Programs.
➢ In addition to system calls, modern systems also provide variety of system
programs. These programs act as an interface between the operating system and
application programs.
➢ They provide an environment in which application programs can be developed and
executed in a convenient manner.
29. Write short notes on Kernel.
➢ The kernel is the central module of an operating system (OS). It is otherwise called
as heart of the Operating System (OS).
➢ It is the part of the operating system that loads first, and it remains in main memory.
➢ A kernel connects the application software to the hardware of a computer
Fig: Kernel based Operating System
30. What is 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.

Fig: Structure of Micro Kernel based Operating System

31. List out the advantages and disadvantages of Microkernel.


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.
32. Write short notes on 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.
➢ In monolithic systems, kernels can directly access all the resources of the operating
System like physical hardware, exp Keyboard, Mouse etc.

Fig: Monolithic Kernel

33. What are the disadvantages of Monolithic Kernel


➢ 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
34. Write short notes on GUI.
➢ GUI stands for Graphical User Interface. It is a visual representation of
communication presented to the user for easy interaction with the machine.
➢ The basic components of GUIs are −
❖ Start menu with program groups
❖ Taskbar which showing running programs
❖ Desktop screen
❖ Different icons and shortcuts.
35. List out the different types of Kernels.
➢ Monolithic Kernel
➢ Micro Kernel
➢ Hybrid Kernel
➢ Exo-Kernel
36. List out the important components present in a Kernel.
➢ Scheduler
➢ Supervisor
➢ Interrupt Handler
➢ Memory Manager
37. Distinguish between Multicore and Multiprocessor.

Multiprocessor Multicore
Multiprocessors are systems with two or A Multicore Processor combines two or
more processing units. Each Processor share more Multi Processor on a Single Chip. It is
the Main memory and I/O Devices also called as Chip Multiprocessor
Processor performance is high. Processor performance is low.
Processor power consumption is high Processor power consumption is low
Executes multiple programs faster. Executes a single program faster.
Have more traffic Have less traffic.
38. Differentiate System calls and System programs.

System Calls System Programs


System calls provide the interface between a System programs act as an interface between
user process and the operating system. the operating system and application
programs.
The System Call uses Application They provide an environment in which
Programming interface (API) to provide application programs can be developed and
services to user programs executed in a convenient manner.

39. List the 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.
40. List out the different layers present in MS DOS operating systems.
➢ The MS-DOS operating System is made up of various layers, each with its own set
of functions.
➢ These layers are:
❖ Application Program
❖ System Program
❖ MS-DOS device drivers
❖ ROM BIOS device drivers
PART-B (16 MARKS)

1. Explain briefly about Evolution of Operating Systems.


2. Demonstrate briefly about the Computer System Elements.
3. Write short notes on Objectives and Functions of Operating Systems.
4. Illustrate briefly about the Operating System Structure.
5. Write short notes on Operating System Services.
6. What is System Call? Explain the working and different types of system calls with neat
diagrams and examples.
7. What is System Program? Explain the different types of system programs with examples.
8. Elaborate briefly on Operating System Interface.
9. Elaborate on different types of kernels with neat diagram.
10. Explain the different types of Operating System Structuring methods with neat diagrams.

You might also like