BCS - SEM II - OS Unit I

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

Operating System (OS) UNIT I

UNIT – I
INTRODUCTION
Introduction
An Operating System (OS) is an interface between computer user and computer hardware.
An operating system is software which performs all the basic tasks like file management,
memory management, process management, handing input and output, and controlling
peripheral devices.
Some popular Operating System include Linux Operating System, Windows Operating
System, VMS, OS/400, AIX, z/OS, etc.
An amazing aspect of operating systems is how varied they are in accomplishing these tasks.
Mainframe operating systems are designed primarily to optimize utilization of hardware.
Personal computer (PC) operating systems support complex games, business applications, and
everything in between. Operating systems for handheld computers are designed to provide an
environment in which a user can easily interface with the computer to execute programs.
An operating system is large and complex, it must be created piece by piece. Each of
these pieces should be a well-delineated portion of the system, with carefully defined inputs,
outputs, and functions.
“An operating system is a program that acts as an interface between the user and the
computer hardware and controls the execution of all kinds of programs.”

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

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 1


www.nandigramiit.org
Operating System (OS) UNIT I

In the above figure:


 The Computer Hardware contains a central processing unit (CPU), the memory, and
the input/output (I/O) devices and it provides the basic computing resources for the
system.
 The Application programs like spreadsheets, Web browsers, word processors, etc. are
used to define the ways in which these resources are used to solve the computing
problems of the users. And the System program mainly consists of compilers, loaders,
editors, OS etc.
 The Operating System is mainly used to control the hardware and coordinate its use
among the various application programs for the different users.
 Basically, Computer System mainly consists of hardware, software, and data.

Two Views of Operating System

An operating system is a construct that allows the user application program 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.

The operating system can be observed from the point of view of the user or the system. This is
known as the user view and the system view respectively. More details about these are given
as follows –

1) User View

The user view depends on the system interface that is used by the users. The different types of
user view experiences can be explained as follows –

 If the user is using a personal computer, the operating system is largely designed to
make the interaction easy. Some attention is also paid to the performance utilization.
This is because the personal computer uses all the resources available and there is no
sharing.
 If the user is using a system connected to a mainframe or a minicomputer, the operating
system is largely concerned with resource utilization. This is because there may be
multiple terminals connected to the mainframe and the operating system makes sure
that all the resources such as CPU, memory, I/O devices etc. are divided uniformly
between them.
NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 2
www.nandigramiit.org
Operating System (OS) UNIT I

 If the user is sitting on a workstation connected to other workstations through networks,


then the operating system needs to focus on both individual usage of resources and
sharing though the network. This happens because the workstation exclusively uses its
own resources but it also needs to share files etc. with other workstations across the
network.
 If the user is using a handheld computer such as a mobile, then the operating system
handles the usability of the device including a few remote operating. The battery level
of the device is also take into account.

There are some devices that contain very or no user view because there is no interaction
with the users. Examples are embedded computers in home devices, automobiles etc.

Operating
User View System View
System

2) System View

According to the computer system, the operating system is the bridge between applications and
hardware. It is most intimate with the hardware and is used to control it as required.

The different types of system view for operating system can be explained as follows:

 The system views the operating system as a resource allocator. There are many
resources such as CPU time, memory space, file storage space, I/O devices etc. that are
required by processes for execution. It is the duty of the operating system to allocate
these resources judiciously to the processes so that the computer system can run as
smoothly as possible.
 The operating system can also work as a control program. It manages all the processes
and I/O devices so that the I/O devices work in a proper manner without creating
problems.
 Operating systems can also be viewed as a way to make using hardware easier.
 Computers were required to easily solve user problems. However, it is not easy to work
directly with the computer hardware. So, operating systems were developed to easily
communicate with the hardware,

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 3


www.nandigramiit.org
Operating System (OS) UNIT I

 An operating system can also be considered as a program running at all times in the
background of a computer system (known as the kernel) and handling all the application
programs. This is the definition of the operating system that is generally followed.

3) Computer-System Organization
The computer system is a combination of many parts such as peripheral
devices, secondary memory, CPU, etc. This can be explained more clearly using a
diagram.

The salient points about the above figure displaying Computer System Organisation is

 Each device controller is in charge of a specific type of device.


 The I/O devices and the CPU both execute concurrently. Some of the processes are
scheduled for the CPU and at the same time, some are undergoing input/output
operations.
 There are multiple device controllers, each in charge of a particular device such as
keyboard, mouse, printer etc.
 There is buffer available for each of the devices. The input and output data can be stored
in these buffers.
 The data is moved from memory to the respective device buffers by the CPU for I/O
operations and then this data is moved back from the buffers to memory.
 The device controllers use an interrupt to inform the CPU that I/O operation is
completed.
 Hardware may trigger an interrupt at any time by sending a signal to the CPU, usually
by way of the system bus.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 4


www.nandigramiit.org
Operating System (OS) UNIT I

 Software may trigger an interrupt by executing a special operation called a system


call (also called a monitor call).
 Interrupts are an important part of a computer architecture. Each computer design has
its own interrupt mechanism, but several functions are common.
Storage Structure
 Computer programs must be in main memory (RAM) to be executed.
 Main memory is the only large storage area that the processor can access directly.
 Dynamic random-access memory (DRAM) is implemented in a semiconductor
technology which forms an array of memory words.
 A typical instruction-execution cycle, as executed on a system, first fetches an
instruction from memory and stores that instruction in the instruction register.
 Secondary storage which most computer systems provide as an extension of main
memory. The main requirement for secondary storage is that it be able to hold large
quantities of data permanently.
 Magnetic disk is the most common secondary-storage device which provides storage
for both programs and data. Most programs (web browsers, compilers, word
processors, spreadsheets, and so on) are stored on a disk until they are loaded into
memory.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 5


www.nandigramiit.org
Operating System (OS) UNIT I

1.2 Computer System Architecture


A computer system may be organized in a number of different ways, which we can categorize
roughly according to the number of general-purpose processors used.

1.2.1 Single-Processor Systems


 Most systems contend a single processor.
 The variety of single-processor systems may be surprising, however, since these
systems range from PDAs through mainframes.
 On a single-processor system, there is one main CPU capable of executing a general-
purpose instruction set, including instructions from user processes.
 Almost all systems have other special-purpose processors as well. They may come in
the form of device-specific processors, such as disk, keyboard, and graphics controllers;
or, on mainframes, they may come in the form of more general-purpose processors,
such as I/O processors that move data rapidly among the components of the system.
 All of these special-purpose processors run a limited instruction set and do not run user
processes.
 Sometimes they are managed by the operating system, in that the operating system
sends them information about their next task and monitors their status.

1.2.2 Multiprocessor Systems


Although single-processor systems are most common, multiprocessor systems (also known
as parallel systems or tightly coupled systems) are growing in importance. Such systems have

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 6


www.nandigramiit.org
Operating System (OS) UNIT I

two or more processors in close communication, sharing the computer bus and sometimes the
clock, memory, and peripheral devices.

Multiprocessor systems have three main advantages:


1. Increased throughput. By increasing the number of processors, we expect to get more
work done in less time. When multiple processors cooperate on a task, a certain amount
of overhead is incurred in keeping all the parts working correctly.
2. Economy of scale. Multiprocessor systems can cost less than equivalent multiple
single-processor systems, because they can share peripherals, mass storage, and power
supplies. If several programs operate on the same set of data, it is cheaper to store those
data on one disk and to have all the processors share them than to have many computers
with local disks and many copies of the data.
3. Increased reliability. If functions can be distributed properly among several
processors, then the failure of one processor will not halt the system, only slow it down.
If we have ten processors and one fails, then each of the remaining nine processors can
pick up a share of the work of the failed processor. Thus, the entire system runs only
10 percent slower, rather than failing altogether.

1.3 Operating System – Extended Machine View:


Bare marine is a computer without software to execute the in traction or programs along
with computer it needs several resurge such as memory and I/O.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 7


www.nandigramiit.org
Operating System (OS) UNIT I

The instructors to program defy kinds of resource management functions are usually
provided by the Operating System. The use program can request these Sevier by issuing
sepal supervisor call instructions that are similar to subroutine calls but transfer control
to OS rather than to one of the user’s subroutine.
Operating System provides many instructions in addition to the Basie hardware
instruction the sum of these instruction is Calles, as instruction set of extended machine.
The kernel of OS runs on brave machine will user programs run on the extended
machine.

Process 3 Process 1

Extended Machine

Bare
User Program
Machine

(OS)

Process 4 Process 2

1.4 Operating-System Structure


An operating system provides the environment within which programs are executed. Internally,
operating systems vary greatly in their makeup, since they are organized along many different
lines
1.4.1 Multiprogramming
Sharing the processor, when two or more programs reside in memory at the same time, is
referred as multiprogramming. Multiprogramming assumes a single shared processor.
Multiprogramming increases CPU utilization by organizing jobs so that the CPU always has
one to execute.
The following figure shows the memory layout for a multiprogramming system

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 8


www.nandigramiit.org
Operating System (OS) UNIT I

An OS does the following activities related to multiprogramming.


 The operating system keeps several jobs in memory at a time.
 This set of jobs is a subset of the jobs kept in the job pool.
 The operating system picks and begins to execute one of the jobs in the memory.
 Multiprogramming operating systems monitor 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 to process.
Advantage
 High and efficient CPU utilization.
 User feels that many programs are allotted CPU almost simultaneously.
Disadvantages
 CPU scheduling is required.
 To accommodate many jobs in memory, memory management is required.
1.4.2 Interactivity
Interactivity refers to the ability of users to interact with a computer system. An Operating
system does the following activities related to interactivity:
 Provides the user an interface to interact with the system.
 Manages input devices to take inputs from the user. For example, keyboard.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 9


www.nandigramiit.org
Operating System (OS) UNIT I

 Manages output devices to show outputs to the user. For example, Monitor. The
response time of the OS needs to be short, since the user submits and waits for the
result.
1.4.3 Multitasking
Multitasking is when multiple jobs are executed by the CPU simultaneously by switching
between them. Switches occur so frequently that the users may interact with each program
while it is running. An OS does the following activities related to multitasking:
 The user gives instructions to the operating system or to a program directly, and
receives an immediate response.
 The OS handles multitasking in the way that it can handle multiple operations / executes
multiple programs at a time.
 Multitasking Operating Systems are also known as Time-sharing systems.
 These Operating Systems were developed to provide interactive use of a computer
system at a reasonable cost.
 A time-shared operating system uses the concept of CPU scheduling and
multiprogramming to provide each user with a small portion of a time-shared CPU.
 Each user has at least one separate program in memory.
 A program that is loaded into memory and is executing is commonly referred to as
a process.

 When a process executes, it typically executes for only a very short time before it
either finishes or needs to perform I/O.
 Since interactive I/O typically runs at slower speeds, it may take a long time to
complete. During this time, a CPU can be utilized by another process.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 10


www.nandigramiit.org
Operating System (OS) UNIT I

 The operating system allows the users to share the computer simultaneously. Since
each action or command in a time-shared system tends to be short, only a little CPU
time is needed for each user.
 As the system switches CPU rapidly from one user/program to the next, each user is
given the impression that he/she has his/her own CPU, whereas actually one CPU is
being shared among many users.
1.4.4 Job pool.
Time-sharing and multiprogramming require several jobs to be kept simultaneously in
memory. Since in general main memory is too small to accommodate all jobs, the jobs are kept
initially on the disk in the job pool. This pool consists of all processes residing on disk awaiting
allocation of main memory. If several jobs are ready to be brought into memory, and if there is not
enough room for all of them, then the system must choose among them.

1.4.5 Job Scheduling.


When the operating system selects a job from the job pool, it loads that job into memory for
execution. Having several programs in memory at the same time requires some form of
memory management.

1.4.6 CPU Scheduling


if several jobs are ready to run at the same time, the system must choose among them. Making
this decision is CPU scheduling.

1.5 Operating System as a Resource Manager


 The Operating system of a Computer works as an interface between be user, and
hardware devices.
 Application software is designed to achieve specific tasks whereas the hardware helps
in achieving the task.
 The computer system provides all this with the use of available resources.
 The hard disk, primary memory and the processor can be thought of as resources.
 The Operating System provides an ordered and controlled allocation of the processor,
memories and I/O devices among the various programs.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 11


www.nandigramiit.org
Operating System (OS) UNIT I

Take for example, a computer system with a printer and two applications programs running. If
both programs wish to print a document at the same time, will those be printed by the primer
or will there be a contention? Here, the operating system comes into play: it manages to queue
the outputs to the printer. In short, this means that it is the ask of the operating system to manage
a computer's resources. Some of the resources that the operating system manages are:
Processor, Memory, Devices, Information

It manages the hardware and software resources of the system. In a desktop computer, these
resources include such things as the processor, memory, disk space and more (On a cell phone
they include the keypad, the screen, the address book, the phone dialer, the battery and the
network connection).

It provides a stable, consistent way for applications to deal with the hardware without having
to know all the details of the hardware.

Viewing the OS as a Resource Manager, each manager must do the following:

 Keep track of the resources


 Enforce the policy that determines who gets what, when, and how much
 Allocate the resource
 Reclaim the resource

Major Functions of OS are:

Memory Management

 Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part are
not in use.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 12


www.nandigramiit.org
Operating System (OS) UNIT I

 In multiprogramming, the OS decides which process will get memory when and how
much.
 Allocates the memory when a process requests it to do so.
 De-allocates the memory when a process no longer needs it or has been terminated

Processor Management

 Keeps tracks of processor and status of process. The program responsible for this task
is known as traffic controller.
 Allocates the processor (CPU) to a process.
 De-allocates processor when a process is no longer required.

Device Management

 Keeps tracks of all devices. Program responsible for this task is known as the I/O
controller.
 Decides which process gets the device when and for how much time.
 Allocates the device in the efficient way.
 De-allocates devices.

Information Management

 Keeps track of information, location, uses, status etc. The collective facilities are often
known as file system.
 Decides who gets the resources.
 Allocates the resources.
 De-allocates the resources.

NANDIGRAM INSTITUTE OF INFORMATION TECHNOLOGY, NANDED 13


www.nandigramiit.org

You might also like