Sunteți pe pagina 1din 12

UNIT – I

NECESSITY OF OPERATING SYSTEM:


 Definition:
 An operating system is a program that controls the execution of programs and acts as
an interface between the user of a computer and the computer hardware.
 Example: Linux, Windows, OS X, OS/400, AIX, etc.
 Operating system performs three functions:
 Convenience:
 An OS makes a computer more convenient to use.
 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 at the
same time interfacing with service.
 Operating System as a User Interface:
 Every general-purpose computer consists of the hardware, operating system, system
programs, application programs.
Hardware – Memory, CPU, ALU, I/O devices, Peripheral devices and storage
device.
Operating System – Windows, Linux, Unix, etc.
System Program – Compiler, Loaders, Editors, etc.
Application Program – Business program, Database Program.
 Every computer must have an operating system to run other programs. The Operating
System controls and co-ordinates the use of the hardware among the various system
programs and application program for a various user.
 It simply provides an environment within which other programs can do useful work.

 The Operating System is a set of special programs that run on a computer system that
allow it to work properly.
 It performs basic tasks such as recognizing input from the keyboard, keeping track of
files and directories on the disk, sending output to the display screen and controlling a
peripheral device.
 OS is designed to serve two basic purposes:
 It controls the allocations and use of the computing system’s resources among the
various users and tasks.
 It provides an interface between the computer hardware and the programmer that
simplifies and makes feasible for coding, creation, debugging of application programs.
 OS supports the following task:
 Provides the facilities to create, modification of program and data files using an editor.
 Access to the compiler for translating the user program from high level language to
machine language.
 Provide a loader program to move the compiled program code to the computer’s
memory for execution.
 Provide routines that handle the details of I/O programming.
 Need of Operating System:
 OS as a platform for Application Programs:
 Operating system provides a platform, on top of which, other program called
Application Programs can run. These application programs help the users to
perform a specific task easily. It acts as an interface between the computer and
the user. It is designed in such a manner that it operates, controls and executes
various applications on the computer.
 Managing input-output unit:
 Operating system allows the computer to manage its own resources such as
memory, monitor, keyboard, printer, etc. Management of these resources is
required for an effective utilization. The operating system controls the various
system input-output resources and allocates them to the users or programs as
per their requirement.
 Consistent user interface:
 Operating system provides the user an easy-to-work user interface, so the user
doesn’t have to learn a different UI every time and can focus on the content and
be productive as quickly as possible. Operating system provides templates, UI
components to make the working of a computer, really easy for the user.
 Multitasking:
 Operating system manages memory and allow multiple programs to run in their
own space and even communicate with each other through shared memory.
Multitasking gives users a good experience as they can perform several tasks on
a computer at a time.

 Functions of Operating system – Operating system performs three functions:


 Convenience:
 An OS makes a computer more convenient to use.
 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 at the
same time interfering with service.

 History of Operating System:


 Operating system has been evolving through the years. Following Table shows the
history of OS.
 Types of Operating System:
 Batch Operating System - Sequence of jobs in a program on a computer without
manual interventions.
 Time sharing operating System - Allows many users to share the computer resources.
(Max utilization of the resources).
 Distributed operating System - Manages a group of different computers and make
appear to be a single computer.
 Network operating system - Computers running in different operating system can
participate in common network (It is used for security purpose).
 Real time operating system – Meant applications to fix the deadlines.

BATCH OPERATING SYSTEM


 This type of operating system does not interact with the computer directly. There is an
operator which takes similar jobs having same requirement and group them into batches. It is
the responsibility of operator to sort the jobs with similar needs.
 Examples of Batch based Operating System: Payroll System, Bank Statements etc.

 Advantages:
 It is very difficult to guess or know the time required by any job to complete. Processors
of the batch systems knows how long the job would be when it is in queue.
 Multiple users can share the batch systems.
 The idle time batch system is very less.
 It is easy to manage large work repeatedly in batch systems.
 Disadvantages:
 The computer operators should be well known with batch systems.
 Batch systems are hard to debug.
 It is sometime costly.
 The other jobs will have to wait for an unknown time if any job fails.

TIME-SHARING OPERATING SYSTEM


 Each task has given some time to execute, so that all the tasks work smoothly. Each user gets
time of CPU as they use single system.
 These systems are also known as Multitasking Systems.
 The task can be from single user or from different users also. The time that each task gets to
execute is called quantum. After this time interval is over OS switches over to next task.
 Examples of Time-Sharing OSs are: Multics, Unix etc.

 Advantages:
 Each task gets an equal opportunity
 Less chances of duplication of software
 CPU idle time can be reduced
 Disadvantages:
 Reliability problem
 One must have to take care of security and integrity of user programs and data
 Data communication problem

DISTRIBUTED OPERATING SYSTEM


 These types of operating system are a recent advancement in the world of computer
technology and are being widely accepted all-over the world and, that too, with a great pace.
 Various autonomous interconnected computers communicate each other using a shared
communication network. Independent systems possess their own memory unit and CPU.
 These are referred as loosely coupled systems or distributed systems.
 These systems processors differ in sizes and functions.
 The major benefit of working with these types of operating system is that it is always possible
that one user can access the files or software which are not actually present on his system but
on some other system connected within this network i.e., remote access is enabled within the
devices connected in that network.
 Examples of Distributed Operating System are: LOCUS etc.
 Advantages:
 Failure of one will not affect the other network communication, as all systems are
independent from each other.
 Electronic mail increases the data exchange speed.
 Since resources are being shared, computation is highly fast and durable.
 Load on host computer reduces.
 These systems are easily scalable as many systems can be easily added to the
network.
 Delay in data processing reduces.
 Disadvantages:
 Failure of the main network will stop the entire communication.
 To establish distributed systems the language which are used are not well defined yet.
 These types of systems are not readily available as they are very expensive. Not only
that the underlying software is highly complex and not understood well yet.
NETWORK OPERATING SYSTEM
 These systems run on a server and provides the capability to manage data, users, groups,
security, applications, and other networking functions.
 These types of operating systems allow shared access of files, printers, security, applications,
and other networking functions over a small private network.
 One more important aspect of Network Operating Systems is that all the users are well aware
of the underlying configuration, of all other users within the network, their individual
connections etc. and that’s why these computers are popularly known as tightly coupled
systems.
 Examples of Network Operating System are: Microsoft Windows Server 2003, Microsoft
Windows Server 2008, UNIX, Linux, Mac OS X, Novell NetWare, and BSD etc.
 Advantages:
 Highly stable centralized servers.
 Security concerns are handled through servers.
 New technologies and hardware up-gradation are easily integrated to the system.
 Server access are possible remotely from different locations and types of systems.
 Disadvantages:
 Servers are costly.
 User has to depend on central location for most operations.
 Maintenance and updates are required regularly.

REAL-TIME OPERATING SYSTEM


 These types of OS serve the real-time systems. The time interval required to process and
respond to inputs is very small. This time interval is called response time.
 Real-time systems are used when there are time requirements are very strict like missile
systems, air traffic control systems, robots etc.
 Two types of Real-Time Operating System which are as follows:
 Hard Real-Time Systems:
These OSs are meant for the applications where time constraints are very strict and
even the shortest possible delay is not acceptable. These systems are built for saving
life like automatic parachutes or air bags which are required to be readily available in
case of any accident. Virtual memory is almost never found in these systems.
 Soft Real-Time Systems:
These OSs are for applications where for time-constraint is less strict.
 Examples of Real-Time Operating Systems are: Scientific experiments, medical imaging
systems, industrial control systems, weapon systems, robots, air traffic control
systems, etc.
 Advantages:
 Maximum Consumption:
 Maximum utilization of devices and system, thus more output from all the
resources
 Task Shifting:
 Time assigned for shifting tasks in these systems are very less. For example, in
older systems it takes about 10 micro seconds in shifting one task to another and
in latest systems it takes 3 micro seconds.
 Focus on Application:
 Focus on running applications and less importance to applications which are in
queue.
 Real time operating system in embedded system:
 Since size of programs are small, RTOS can also be used in embedded systems
like in transport and others.
 Error Free:
 These types of systems are error free.
 Memory Allocation:
 Memory allocation is best managed in these types of systems.
 Disadvantages:
 Limited Tasks:
 Very few tasks run at the same time and their concentration is very less on few
applications to avoid errors.
 Use heavy system resources:
 Sometimes the system resources are not so good and they are expensive as
well.
 Complex Algorithms:
 The algorithms are very complex and difficult for the designer to write on.
 Device driver and interrupt signals:
 It needs specific device drivers and interrupt signals to response earliest to
interrupts.
 Thread Priority:
 It is not good to set thread priority as these systems are very less pron to
switching tasks.

DEVICE MANAGEMENT:
 General Device Characteristics:
 Character stream/block:
 A character-stream device transfers byte in one by one fashion, where as a block
device transfers a complete unit of bytes.
 Sequential/Random Access:
 A sequential device transfers data in a fixed order determined by the devices.
 A random-access device can be instructed to seek position to any of the
available data storage locations.
 Synchronous/Asynchronous:
 A synchronous device performs data transfer with known response time.
 An asynchronous device shows irregular or unpredictable response time.
 Sharable/Dedicated:
 A sharable device can be used concurrently by several processes or threads.
 Dedicated device cannot be used concurrently by several processes or threads.
 Speed of Operation:
 Device speeds may range from a few bytes per second to a few gigabytes per
second.
 Read-write read only or writes only:
 Some devices perform both input and output, but others support only one.
 Efficiency:
 Most input-output devices are extremely slow compared with the processor and
the main memory and buffering is one way to deal with this issue.
 Generality:
 It is desirable to handle all devices in a uniform and consistent manner.
 It applies for both the way the user processes see the devices and the way the
operating system manages the input output devices and operations.

 Input/output Hardware:
 I/O devices can be divided into two categories:
 Block Devices:
 A block device is one with which the driver communicates by sending
entire blocks of data.
 For example: Hard disk, USB cameras, Disk-On-Key etc.
 Character Devices:
 A character device is one with the driver communicates by sending and
receiving single characters (bytes, octets).
 For example: Serial Ports, Parallel Ports, Sounds cards, etc.
 Device Controllers
 Device Drivers are software modules that can be plugged into an OS to handle a
particular device.
 Operating System takes help from devices drivers to handle all I/O devices.
 Device Controller works like an interface between a device and a device driver.
I/O units – (keyboards, mouse, printer, etc) typically consist of a mechanical
component and an electronic component where component is called the Device
Controller.

 Communication to I/O Devices


 The CPU must have a way to pass information to and from an I/O device. There
are three approaches available to communicate with the CPU and Device.
 Special Instruction I/O.
 Memory-Mapped I/O.
 Direct Memory Access (DMA).
SPECIAL INSTRUCTION I/O: -
 This uses CPU instructions that are specifically made for controlling I/O devices.
These instructions typically allow data to be sent to an I/O device or read from an
I/O device.
MEMORY-MAPPED I/O: -
 When using memory-mapped I/O, the same address space is shared by memory
and I/O devices. The device is connected directly to certain main memory
locations so that I/O device can transfer block of data to/from memory without
going through CPU.

 While using memory mapped Input Output, OS allocated buffer in memory and
informs I/O device to use that buffer to send data to the CPU. I/O device
operates asynchronously with CPU. Interrupts CPU when finished.
 Memory Mapped Input Output is used for most high-speed I/O devices like disks,
communication interfaces.
DIRECT MEMORY ACCESS (DMA): -
 DMA means CPU grants I/O module authority to read from or write to memory
without involvement.
 DMA module itself controls exchange of data between main memory and the I/O
device. CPU is only involved at the beginning and end of the transfer and
interrupted only after entire block has been transferred.
 DMA needs a special hardware called DMA controller (DMAC) that manages the
data transfers and arbitrates access to the system bus. The controller are
programmed with source and destination pointers (where to read/write the data),
counters to track the number of transferred bytes, and settings, which includes
I/O and memory types, interrupts and states for the CPU cycles.

 Polling vs Interrupts I/O:


 Polling is the simplest way for an I/O device to communicate with the processor.
The process of periodically checking status of the device to see if it is time for the
next I/O operations, is called POLLING.
 An Interrupt is a signal to the microprocessor from a device that require attention.
 A device controller puts an interrupt signal on the bus when it needs CPU’s
attention when CPU receives an interrupt, it saves its current state and invokes
the appropriate interrupt handler using the interrupt vector (addresses of OS
routines to handle various events). When the interrupting device has been dealt
with, the CPU continues with its original task as if it had never been interrupted.

 Input/output Software:
 I/O software is often organized in the following layers –
 User Level Libraries –
 This provides simple interface to the user program to perform input and
output. For example, stdio is a library provided by C and C++
programming languages.
 Kernel Level Modules –
 This provides device driver to interact with the device controller and
device independent I/O modules used by the device drivers.
 Hardware –
 This layer includes actual hardware and hardware controller which
interact with the device drivers and makes hardware alive.

 Device Drivers
 Device drivers are software modules that can be plugged into an OS to handle a
particular device.
 Operating System takes help from device drivers to handle all I/O devices.
 Device drivers encapsulate device-dependent code and implement a standard
interface in such a way that code contains device-specific register reads/writes.
 Device driver, is generally written by the device's manufacturer and delivered
along with the device on a CD-ROM.
 A device driver performs the following jobs –
 To accept request from the device independent software above to it.
 Interact with the device controller to take and give I/O and perform required error
handling.
 Making sure that the request is executed successfully.
 Interrupt Handlers
 An interrupt handler, also known as an interrupt service routine or ISR, is a
piece of software or more specifically a call-back function in an operating system
or more specifically in a device driver, whose execution is triggered by the
reception of an interrupt.
 When the interrupt happens, the interrupt procedure does whatever it has to in
order to handle the interrupt, updates data structures and wakes up process that
was waiting for an interrupt to happen.
 The interrupt mechanism accepts an address ─ a number that selects a specific
interrupt handling routine/function from a small set.
 User-Space I/O Software
 These are the libraries which provide richer and simplified interface to access
the functionality of the kernel or ultimately interactive with the device drivers.
 Most of the user-level I/O software consists of library procedures with some
exception like spooling system which is a way of dealing with dedicated I/O
devices in a multiprogramming system.
 I/O Libraries (e.g., stdio) are in user-space to provide an interface to the OS
resident device-independent I/O SW.
 For example putchar(), getchar(), printf() and scanf() are example of user level
I/O library stdio available in C programming.
 Kernel I/O Subsystem
 Kernel I/O Subsystem is responsible to provide many services related to I/O.
Following are some of the services provided.
 Scheduling − Kernel schedules a set of I/O requests to determine a good
order in which to execute them. When an application issues a blocking
I/O system call, the request is placed on the queue for that device. The
Kernel I/O scheduler rearranges the order of the queue to improve the
overall system efficiency and the average response time experienced by
the applications.
 Buffering − Kernel I/O Subsystem maintains a memory area known
as buffer that stores data while they are transferred between two devices
or between a device with an application operation. Buffering is done to
cope with a speed mismatch between the producer and consumer of a
data stream or to adapt between devices that have different data transfer
sizes.
 Caching − Kernel maintains cache memory which is region of fast
memory that holds copies of data. Access to the cached copy is more
efficient than access to the original.
 Spooling and Device Reservation − A spool is a buffer that holds output
for a device, such as a printer, that cannot accept interleaved data
streams. The spooling system copies the queued spool files to the printer
one at a time. In some operating systems, spooling is managed by a
system daemon process. In other operating systems, it is handled by an
in kernel thread.
 Error Handling − An operating system that uses protected memory can
guard against many kinds of hardware and application errors.

S-ar putea să vă placă și