BCS303 Module1
BCS303 Module1
i n
OPERATING SYSTEMS(BCS303)
Module 1
What is operating systems
and printers
An operating system is a program that manages the computer hardware. It also provides a
basis for application programs and acts as an intermediary between the computer user and
An Operating System, or OS, is low-level software that enables a user and higher-level
application software to interact with a computer’s hardware and the data and other
Click
[Link] Edit
of ISE
programs stored on the computer.
Click
[Link] Edit
of ISE
Secondary Storage Device
Click to Edit
Types of OS
• Batch OS
• Time-sharing OS
• Distributed OS
• Network OS
• Real time OS
• Multi programming
/Tasking/processing OS
Goals of OS
• Convenient
Click
[Link] Edit
of ISE • Efficiency
• Both
Functions of OS
• It is an interface between user and
hardware
• Allocation of resources
• Management of memory, security
etc
What Operating Systems Do?
A computer system can be divided roughly into four components: the hardware, the
operating system, the application programs, and the users (as shown in figure)
Click
[Link] Edit
of ISE
Computer System Components
2. Operating system − controls and coordinates the use of the hardware among the
3. Applications programs − define the ways in which the system resources are used to
Click
[Link] Edit
of ISE solve the computing problems of the users (compilers, database systems, video games,
business programs).
Click
[Link] Edit
of ISE
The operating system controls and coordinates the use of the hardware among
the various application programs for the various users.
• User view
• System view
User View
• The user's view of the computer varies according to the interface being used. Most
computer users sit in front of a PC, consisting of a monitor, keyboard, mouse, and
system unit.
The goal is to maximize the work (or play) that the user is performing.
Click
[Link] Edit
of ISE
• Ease of use
• Resource Utilization.
User View
These users share resources and may exchange information. The operating
Click
[Link] Edit
of ISE
system in such cases is designed to maximize resource utilization to
assure that all available CPU time, memory, and I/O are used efficiently
and that no individual user takes more than her fair share.
User View
These users have dedicated resources at their disposal, but they also share
resources such as networking and servers-file. Therefore, their operating
Click
[Link] Edit
of ISE
system is designed to compromise between individual usability and
resource utilization.
System View
• In this context, we can view an operating system as a resource
allocator.
Operating systems exist because they offer a reasonable way to solve the problem of
The fundamental goal of computer systems is to execute user programs and to make
solving user problems easier. Toward this goal, computer hardware is constructed. Since
bare hardware alone is not particularly easy to use, so application programs are
Click
[Link] Edit
of ISE
developed.
These programs require certain common operations, such as those controlling the I/O
devices. The common functions of controlling and allocating resources are then brought
Computer-System Operation
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 to shared memory
(as shown in figure).
Click
[Link] Edit
of ISE
Each device controller is in charge of a specific type of device (for example, disk drives, audio
devices, and video displays).
It initializes all aspects of the system, from CPU registers to device controllers
to memory contents
A modern computer system.
Click
[Link] Edit
of ISE
• The CPU and the device controllers can execute concurrently, competing for
memory cycles.
Click to Edit
• It must know how to load the OS and start executing that system.
• It must locate and load into memory the OS kernel.
Interrupt
• The occurrence of an event is usually signalled by an interrupt from the
hardware or software
• Hardware may trigger an interrupt at any time by sending a signal to CPU,
usually by the way of system bus.
System call or Monitor call
Software may trigger an interrupt by executing a special operation called system
call.
When the CPU is interrupted, it stops what it is doing and immediately
Click
[Link] Edit
of ISE
transfers execution to a fixed location
The fixed location usually contains the starting address where the service
routine of the interrupt is located
The interrupt service routine executes
On completion the CPU resumes the interrupted computation
Click to Edit
Interrupt in OS
Click to Edit
Storage Structure
• Main memory is the only large storage area (millions to billions of bytes)
that the processor can access directly.
• Each storage system provides the basic functions of storing a datum and
Click
[Link] Edit
of ISE of holding that datum until it is retrieved at a later time.
• The main differences among the various storage systems lie in speed,
cost, size, and volatility.
• The wide variety of storage systems in a computer system can be
organized in a hierarchy (as shown in figure 6) according to speed and
cost.
• The higher levels are expensive, but they are fast. As we move down the
hierarchy, the cost per bit generally decreases, whereas the access time
generally increases.
Click
[Link] Edit
of ISE
• This trade-off is reasonable; if a given storage system were both faster
and less expensive than another-other properties being the same-then
there would be no reason to use the slower, more expensive memory
Storage-device hierarchy
Click
[Link] Edit
of ISE
computer.
Click
[Link] Edit
of ISE and performance of a system and because of the varying nature
Click
[Link] Edit
of ISE
• Typically operating system have device driver for each device
controller.
I/O Structure
Click
[Link] Edit
of ISE
Working of I/O Operation
• To start an I/O operation, the device driver loads the appropriate
registers within the device controller.
• The controller starts the transfer of data from the device to its local
buffer.
Working of I/O Operation
• Once the transfer of data is complete, the device controller informs
the device driver via an interrupt that it has finished its operation.
Click
[Link] Edit
of ISE
information.
• This form of interrupt driven I/O is fine for moving small amount of
data but can produce high overhead when used for bulk data
movement.
• To solve this problem DMA(Direct memory access) is used.
Click
• Single processors system
[Link] Edit
of ISE
• Multi-processor system
• Clustered systems
Single processor system
• Most systems use a single processor.
• In symmetric mode
• A single user cannot, in general, keep either the CPU or the I/O devices
busy at all times.
• Multiprogramming increases CPU utilization by organizing jobs (code and
data) so that the CPU always has one to execute.
• This set of jobs can be a subset of the jobs kept in the job pool-which
contains all jobs that enter the system-since the number of jobs that can
Click
[Link] Edit
of ISE
• The operating system picks and begins to execute one of the jobs in
memory
• Multiprogrammed systems provide an environment in which the various system
resources (for example, CPU, memory, and peripheral devices) are utilized
effectively, but they do not provide for user interaction with the computer
system.
Time sharing(Multitasking)
• Time sharing (or multitasking) is a logical extension of multiprogramming. In
time-sharing systems, the CPU executes multiple jobs by switching among them,
Click
[Link] Edit
of ISE
but the switches occur so frequently that the users can interact with each
program while it is running.
• Time sharing requires an interactive computer system, which provides
direct communication between the user and system.
It uses CPU scheduling and multiprogramming to provide each user with
Click
[Link] Edit
of ISE
a small portion of time shared computer.
Click
[Link] Edit
of ISE
• A trap is a software-generated interrupt caused either by an error or by a
specific request from a user program that an operating-system service be
performed.
• The interrupt-driven nature of an operating system defines that
system's general structure. For each type of interrupt, separate
segments of code in the operating system determine what action
should be taken. An interrupt service routine is provided that is
responsible for dealing with the interrupt.
• Since the operating system and the users share the hardware and
Click
[Link] Edit
of ISE
software resources of the computer system, we need to make sure
that an error in a user program could cause problems only for the
one program that was running. With sharing, many processes could
be adversely affected by a bug in one program.
Dual-Mode Operation
• In order to ensure the proper execution of the operating system, we must
be able to distinguish between the execution of operating-system code
and user defined code. The approach taken by most computer systems is
to provide hardware support that allows us to differentiate among various
modes of execution.
• At the very least, we need two separate modes of operation: user mode
Click
[Link] Edit
of ISE
and kernel mode (also called supervisor mode, system mode, or
privileged mode).
• A bit, called the mode bit is added to the hardware of the computer
to indicate the current mode: kernel (0) or user (1). With the mode
bit, we are able to distinguish between a task that is executed on
behalf of the operating system and one that is executed on behalf of
the user.
Click
[Link] Edit
of ISE The protection is achieved by special machine instructions called privileged
instructions.
• When control is given to a user application, the mode is set to user mode.
Eventually, control is switched back to the operating system via an interrupt, a
trap, or a system call.
• The kernel examines the interrupting instruction to determine what system call
has occurred; a parameter indicates what type of service the user program is
requesting.
Timer
• OS does not allow the user program to get stuck in an infinite loop or to
fail to call system services.
• It is treated as either fatal error or may give the program more time.
• When the counter becomes negative, the OS terminates the program for
exceeding the assigned time limit.
Process Management
• A program does nothing unless its instructions are executed by a CPU. A
program in execution is called a process.
The operating system is responsible for the following activities in connection with
process management:
Click
[Link] Edit
of ISE
• Suspending and resuming processes.
Each word or byte has its own address. Main memory is a repository of quickly
accessible data shared by the CPU and I/O devices.
The central processor reads instructions from main memory during the
Click
[Link] Edit
of ISE
instruction-fetch cycle and both reads and writes data from main memory during
the data-fetch cycle.
• Keeping track of which parts of memory are currently being used and by
whom.
• Deciding which processes (or parts thereof) and data to move into and
out of memory.
Click
[Link] Edit
of ISE
• Allocating and deallocating memory space as needed.
Click
[Link] Edit
of ISE
Storage Management
To make the computer system convenient for users, the operating system
provides a uniform, logical view of information storage.
The operating system abstracts from the physical properties of its storage
devices to define a logical storage unit, the file. The operating system
maps files onto physical media and accesses these files via the storage
devices.
Click
[Link] Edit
of ISE File-System Management
File management is one of the most visible components of an operating
system. Computers can store information on several different types of
physical media. Magnetic disk, optical disk, and magnetic tape are the
most common.
File management is one of the basic and important feature of OS.
The operating system is responsible for the following activities in connection with
file management:
Click
[Link] Edit
of ISE
• Creating and deleting files.
• Free-space management.
• Storage allocation.
Click
[Link] Edit
of ISE
• Disk scheduling.
Disk scheduling.
Click
[Link] Edit
of ISE we first check whether it is in the cache. If it is, we use the
information directly from the cache; if it is not, we use the
information from the source, putting a copy in the cache under the
assumption that we will need it again soon.
Because caches have limited size, cache management is an important
design problem.
Main memory can be viewed as a fast cache for secondary storage, since
data in secondary storage must be copied into main memory for use, and
data must be in main memory before being moved to secondary storage for
safekeeping
Click
[Link] Edit
of ISE This operation is followed by copying A to the cache and to an internal
register. Thus, the copy of A appears in several places: on the magnetic
disk, in main memory, in the cache, and in an internal register as shown in
the figure.
Once the increment takes place in the internal register, the value of A
differs in the various storage systems. The value of A becomes the same
only after the new value of A is written from the internal register back to
the magnetic disk.
Click
[Link] Edit
of ISE
I/O Systems
One of the purposes of an operating system is to hide the peculiarities of
specific hardware devices from the user.
Click
[Link] Edit
of ISE
Protection and security requires the system to be able to distinguish
among all its users.
Click
[Link] Edit
of ISE
Special-Purpose Systems
The discussion thus far has focused on general-purpose computer systems
that we are all familiar with. There are, however, different classes of
computer systems whose functions are more limited and whose objective
is to deal with limited computation domains.
Sensors bring data to the computer. The computer must analyze the data
and possibly adjust controls to modify the sensor inputs.
Multimedia Systems
Click
[Link] Edit
of ISE For example, a PDA is typically about 5 inches in height and 3 inches in
width, and it weighs less than one-half pound. Because of their size, most
handheld devices have a small amount of memory, slow processors, and
small display screens.
Traditional Computing
Click
[Link] Edit
of ISE As computing matures, the lines separating many of the traditional
computing environments are blurring. Consider the "typical office
environment.“
Just a' few years ago, this environment consisted of PCs connected to a
network, with servers providing file and print services.
Remote access was awkward, and portability was achieved by use of laptop
computers.
Client-Server Computing
As PCs have become faster, more powerful, and cheaper, designers have
Click
[Link] Edit
of ISE
shifted away from centralized system architecture. Terminals connected to
centralized systems are now being replaced by PCs.
Correspondingly, user interface functionality once handled directly by the
centralized systems is increasingly being handled by the PCs. As a result,
many of today’s systems act as server systems to satisfy requests
generated by client systems. This form of specialized distributed system,
called client-server system, has the general structure depicted in figure.
Click
[Link] Edit
of ISE
Server systems can be broadly categorized as compute servers and file
servers:
Peer-to-Peer Computing
Click
[Link] Edit
of ISE • Another structure for a distributed system is the peer-to-peer (P2P)
system model. In this model, clients and servers are not distinguished
from one another; instead, all nodes within the system are considered
peers, and each may act as either a client or a server, depending on
whether it is requesting or providing a service.
• Peer-to-peer systems offer an advantage over traditional client-server systems.
In a client-server system, the server is a bottleneck; but in a peer-to-peer
system, services can be provided by several nodes distributed throughout the
network.
• Peer-to-peer networks gained wide spread popularity in the late 1990s with
several file-sharing services, such as Napster and Gnutella, that enable peers to
exchange files with one another.
Web-based computing
Click
[Link] Edit
of ISE
The Web has become ubiquitous, leading to more access by a wider variety of
devices than was dreamt of a few years ago. PCs are still the most prevalent access
devices, with workstations, handheld PDAs, and even cell phones also providing
access.
Web computing has increased the emphasis on networking.