0% found this document useful (0 votes)
23 views24 pages

unit 1 Operating system

An Operating System (OS) serves as an interface between users and computer hardware, managing resources such as memory, processes, and devices. It performs essential functions including memory management, processor management, device management, and file management, while also ensuring security and system performance. Various types of operating systems exist, including batch, interactive, time-sharing, multitasking, real-time, and multiuser systems, each with distinct characteristics and applications.

Uploaded by

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

unit 1 Operating system

An Operating System (OS) serves as an interface between users and computer hardware, managing resources such as memory, processes, and devices. It performs essential functions including memory management, processor management, device management, and file management, while also ensuring security and system performance. Various types of operating systems exist, including batch, interactive, time-sharing, multitasking, real-time, and multiuser systems, each with distinct characteristics and applications.

Uploaded by

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

Operating System & Functions

An Operating System (OS) is an interface between computer user and computer hardware. It
performs all the basic tasks like file management, memory management, process
management, handling input and output, and controlling peripheral devices such as disk
drives and printers.
Some popular Operating Systems include Linux Operating System, Windows Operating
System, VMS, OS/400, AIX, z/OS, etc.
Definition
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.
Operating System as a Resource Manager:

 Internally an Operating System acts as a manager of resources of the computer system


such as processor, memory, files, and I/O device.In this role, the operating system
keeps track of the status of each resource, and decides who gets a resource, for how
long and when.
 In system that supports concurrent execution of program, the operating system
resolves conflicting requests for resources in manner that preserves system integrity,
and in doing so attempts to optimize the resulting performance
Operating System as a Control program
 OS controls the execution of all the programs in the machine. It controls all the
hardware and the interaction between user and hardware.

 It controls the working of hardware and also the programs that we run. Whenever we
run a program the OS allocates memory and loads the program into it.

 Similarly when we request some hardware the OS is the one that raises the request
and makes it available. So it is involved in all control activities in the computer.
Functions of an Operating System

 Memory Management
 Processor Management
 Device Management
 File Management
 Security
 Control over system performance
 Job accounting
 Error detecting aids
 Coordination between other software and users
Memory Management
Memory management refers to management of Primary Memory or Main Memory. Main
memory is a large array of words or bytes where each word or byte has its own address.
Main memory provides a fast storage that can be accessed directly by the CPU. For a
program to be executed, it must in the main memory. An Operating System does the
following activities for memory management −
 Keeps tracks of primary memory, i.e., what part of it are in use by whom, what part
are not in use.
 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
In multiprogramming environment, the OS decides which process gets the processor when
and for how much time. This function is called process scheduling. An Operating System
does the following activities for 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
An Operating System manages device communication via their respective drivers. It does
the following activities for 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.
File Management
A file system is normally organized into directories for easy navigation and usage. These
directories may contain files and other directions.
An Operating System does the following activities for file 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.
Other Important Activities
Following are some of the important activities that an Operating System performs −
 Security − By means of password and similar other techniques, it prevents
unauthorized access to programs and data.
 Control over system performance − Recording delays between request for a service
and response from the system.
 Job accounting − Keeping track of time and resources used by various jobs and
users.
 Error detecting aids − Production of dumps, traces, error messages, and other
debugging and error detecting aids.
 Coordination between other softwares and users − Coordination and assignment
of compilers, interpreters, assemblers and other software to the various users of the
computer systems.
Classification of Operating System

Batch operating system


The users of a 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. To speed up processing, jobs with similar needs are
batched together and run as a group. The programmers leave their programs with
the operator and the operator then sorts the programs with similar requirements into
batches.
Advantages of Batch Operating System:
 It is very difficult to guess or know the time required by any job to complete.
Processors of the batch systems know how long the job would be when it is in queue
 Multiple users can share the batch systems
 The idle time for batch system is very less
 It is easy to manage large work repeatedly in batch systems
Disadvantages of Batch Operating System:
 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
Examples of Batch based Operating System: Payroll System, Bank Statements etc.
Interactive operating system

An interactive operating system is one that allows the user to directly interact with
the operating system whilst one or more programs are running. There will be an user
interface in place to allow this to happen. It could be a command line style of interface or it
could be a graphical interface.
Example: ATM
Time-sharing operating systems
Each task is 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.

Time-sharing is a technique which enables many people, located at various


terminals, to use a particular computer system at the same time. Time-sharing or
multitasking is a logical extension of multiprogramming. Processor's time which is
shared among multiple users simultaneously is termed as time-sharing.
The main difference between Multiprogrammed Batch Systems and Time-Sharing
Systems is that in case of Multiprogrammed batch systems, the objective is to
maximize processor use, whereas in Time-Sharing Systems, the objective is to
minimize response time.
The operating system uses CPU scheduling and multiprogramming to provide each
user with a small portion of a time. Computer systems that were designed primarily
as batch systems have been modified to time-sharing systems.
Advantages of Time-Sharing OS:
 Each task gets an equal opportunity
 Less chances of duplication of software
 CPU idle time can be reduced
Disadvantages of Time-Sharing OS:
 Reliability problem
 One must have to take care of security and integrity of user programs and data
 Data communication problem

Examples of Time-Sharing OSs are: Multics, Unix etc.


 Multitasking OS:

In a multitasking system more than one task can be performed at the same time but they are
executed one after another through a single CPU by time sharing. For example: Windows,
Linux, Mac, Unix,etc.
Multitasking OS are of two types:
a) Pre-empetive multitasking
b) Co-operative multitasking
In the pre-empetive multitasking, the OS allows CPU times slice to each program. After each
time slice, CPU executes another task. Example: Windows XP
In co-operative multitasking a task can control CPU as long as it requires . However, it will
free CPU to execute another program if it doesn’t require CPU. Exaample: windows 3.x,
multifinder,etc.

Real Time operating System


Real-time systems are used when there are rigid time requirements on the
operation of a processor or the flow of data and real-time systems can be used as a
control device in a dedicated application. A real-time operating system must have
well-defined, fixed time constraints, otherwise the system will fail. For example,
Scientific experiments, medical imaging systems, industrial control systems,
weapon systems, robots, air traffic control systems, etc.
There are two types of real-time operating systems.

Hard real-time systems

Hard real-time systems guarantee that critical tasks complete on time. In hard real-
time systems, secondary storage is limited or missing and the data is stored in
ROM. In these systems, virtual memory is almost never found.

Soft real-time systems

Soft real-time systems are less restrictive. A critical real-time task gets priority over
other tasks and retains the priority until it completes. Soft real-time systems have
limited utility than hard real-time systems. For example, multimedia, virtual reality,
Advanced Scientific Projects like undersea exploration and planetary rovers, etc.
Advantages of RTOS:
 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 type of
systems.
Disadvantages of RTOS:
 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 prone to switching tasks.
Examples of Real-Time Operating Systems are: Scientific experiments, medical
imaging systems, industrial control systems, weapon systems, robots, air traffic
control systems, etc

Multiprocessing operating System


A multiprocessing OS can support the execution of multiple processes at the same time. It
uses multiple number of CPU. It is expensive in cost however, the processing speed will be
faster. It is complex in its execution.

Example: Operating system like Unix, 64 bit edition of windows, server edition of
windows, etc. are multiprocessing.
Multiuser operating System
In a multiuser OS, more than one user can use the same system at a same time through the
multi I/O terminal or through the network.
For example: windows, Linux, Mac, etc.
A multiuser OS uses timesharing to support multiple users.

Multiprogramming operating System


In a multiprogramming OS more than one programs can be used at the same time. It may or
may not be multiprocessing. In a single CPU system , multiple program are executed one
after another by dividing the CPU into small time slice.
Example: Windows, Mac, Linux,etc.

Multithreading operating System


A program in execution is known as process. A process can be further divided into multiple
sub-processers. These sub-processers are known as threads. A multi-threading OS can divide
process into threads and execute those threads. This increases operating speed but also
increases the complexity.

For example: Unix, Server edition of Linux and windows.


Operating-System Structure

 A system as large and complex as a modern operating


system must be engineered carefully if it is to function
properly and be modified easily.
 A common approach is to partition the task into small
components rather than have one monolithic system.
 Each of these modules should be a well-defined portion
of the system, with carefully defined inputs, outputs, and
functions.

1. Simple structure

 Started as small, simple, and limited systems and then


grew beyond their original scope. MS-DOS is an
example of such a system.
 It was written to provide the most functionality in the
least space, so it was not divided into modules carefully
 In MS-DOS, the interfaces and levels of functionality are
not well separated. For instance, application programs
are able to access the basic I/O routines to write directly
to the display and disk drives.
 Such freedom leaves MS-DOS vulnerable to errant (or
malicious) programs, causing entire system crashes when
user programs fail.
 Of course, MS-DOS was also limited by the hardware of
its era. Because the Intel 8088 for which it was written
provides no dual mode and no hardware protection,
the designers of MS-DOS had no choice but to leave the
base hardware accessible. Another example of limited
structuring is the original UNIX operating system.

2. Monolithic Kernel

 The entire operating system works in the kernel space in


the monolithic system. This increases the size of the
kernel as well as the operating system.
 This is different than the microkernel system where the
minimum software that is required to correctly
implement an operating system is kept in the kernel.
 The kernel provides various services such as memory
management, file management, process scheduling etc.
using function calls.
.
Advantages of Monolithic Kernel

 The execution of the monolithic kernel is quite fast as


the services such as memory management, file
management, process scheduling etc.are implemented
under the same address space.
 A process runs completely in a single address space in
the monolithic kernel.
Disadvantages of Monolithic Kernel

 If any service fails in the monolithic kernel, it leads to


the failure of the entire system.
 To add any new service, the entire operating system
needs to be modified by the user.

UNIX is another system that initially was limited by hardware


functionality. It consists of two separable parts: the kernel
and the system programs. The kernel is further separated into
a series of interfaces and device drivers. The kernel provides
the file system, CPU scheduling, memory management, and
other operating-system functions through system calls.
3. Layered Structure
 OS is split into various layers such that all the layers
perform different functionalities
 Each layer can interact with the one just above it and the
one just below it.
 Lowermost layer which directly deals with the bare
hardware is mainly meant to perform the functionality
of I/O communication and the uppermost layer which
is directly connected with the application program acts
as an interface between user and operating system
 Microsoft Windows NT Operating System is an example.
Advantages of Layered structure
 Dysfunction of one layer will not affect the entire
operating system.
 Easier testing and debugging due to isolation among the
layers.
 Adding new functionalities or removing the obsolete
ones is very easy
Disadvantages of Layered structure
 It is not always possible to define layers.
 Less efficient as every layer adds some overhead.
 No communication between non-adjacent layers
4. Microkernel Structure
 The basic ideology in this architecture is to keep the
kernel as small as possible.
 Only the most important services are put inside the
kernel and rest of the OS service are present in the
system application program.
 Microkernel and system applications can interact with
each other by message passing as and when required.
 Now the user can easily interact with those not-so
important services within the system applications and
kernel i.e., microkernel is solely responsible for the
three most important services of operating system
namely:
1. Inter-Process communication
2. Memory management
3. CPU scheduling
Advantages of Microkernel structure

 Extending the operating system becomes much easier


without disturbing the kernel.
 The microkernel also provides more security and
reliability, functions better as it is small and isolated.
Disadvantages of Microkernel structure
 Poor performance due to increased system overhead
from message passing.

 Eclipse IDE is a good example of Microkernel


Architecture.

5. Reentrant kernel
 If the kernel is not re-entrant, a process can only be
suspended while it is in user mode. Although it could be
suspended in kernel mode, that would still block kernel
mode execution on all other processes.
 The reason for this is that all kernel threads share the
same memory. If execution would jump between them
arbitrarily, corruption might occur
 A re-entrant kernel enables processes (or, to be more
precise, their corresponding kernel threads) to give away
the CPU while in kernel mode. They do not hinder other
processes from also entering kernel mode. If a hardware
interrupt occurs, a reentrant kernel is able to suspend
the current running process even if that process is in
Kernel Mode. This capability is very important, because
it improves the throughput of the device controllers that
issue interrupts
 For instance, after issuing a read to a disk on behalf of a
process, the kernel lets the disk controller handle it and
resumes executing other processes. An interrupt notifies
the kernel when the device has satisfied the read, so the
former process can resume the execution.
 One way to provide reentrancy is to write functions so
that they modify only local variables and do not alter
global data structures. Such functions are called
reentrant functions. But a reentrant kernel is not limited
only to such reentrant functions (although that is how
some real-time kernels are implemented). Instead, the
kernel can include nonreentrant functions and use
locking mechanisms to ensure that only one process can
execute a nonreentrant function at a time.
 .Once a device has issued an interrupt, it waits until the
CPU acknowledges it. If the kernel is able to answer
quickly, the device controller will be able to perform
other tasks while the CPU handles the interrupt.
Operating-System Components
 A system as large and complex as a modern operating system must be engineered
carefully if it is to function properly and be modified easily.
 A common approach is to partition the task into small components rather than
have one monolithic system.
 Each of these modules should be a well-defined portion of the system, with carefully
defined inputs, outputs, and functions.

1. Process Management

 A program by itself is not a process; a program is a passive entity, while a process is


an active entity. It is known that two processes may be associated with the same
program; they are nevertheless considered two separate execution sequences.
 A process will need certain resources such as CPU time, memory, files, I/O devices,
etc., to accomplish its task. These resources are given to the process when it is
created. In addition to the various physical and logical resources that a process obtains
when it is created, some initialization data (input) may be passed along.
 A process is the unit of work in a system. Such a system consists of a collection of
processes, some of which are operating system processes, those that execute system
code, and the rest being user processes, those that execute user code. All of those
processes can potentially execute concurrently.

Functions of process management in OS:

The following are functions of process management.

 Process creation and deletion.


 Suspension and resumption.
 Synchronization process
 Communication process

2. Memory Management

 Main Memory is a large array of storage or bytes, which has an address. The memory
management process is conducted by using a sequence of reads or writes of specific
memory addresses.
 In order to execute a program, it should be mapped to absolute addresses and loaded
inside the Memory. The selection of a memory management method depends on
several factors.
 Main Memory offers fast storage that can be accessed directly by the CPU. It is costly
and hence has a lower storage capacity. However, for a program to be executed, it
must be in the main Memory.

Functions of Memory management in OS:

An Operating System performs the following functions for Memory Management:


 It helps you to keep track of primary memory.
 Determine what part of it are in use by whom, what part is not in use.
 In a multiprogramming system, the OS takes a decision about which process will
get Memory and how much.
 Allocates the memory when a process requests
 It also de-allocates the Memory when a process no longer requires or has been
terminated.

3. Secondary storage management

 The main purpose of a computer system is to execute programs. These programs,


together with the data they access, must be in main memory during execution.
 Since the main memory is too small to permanently accommodate all data and
program, the computer system must provide secondary storage to backup main
memory.
 Most modem computer systems use disks as the primary on-line storage of
information, of both programs and data. Most programs, like compilers, assemblers,
sort routines, editors, formatters, and so on, are stored on the disk until loaded into
memory, and then use the disk as both the source and destination of their processing.
Hence the proper management of disk storage is of central importance to a computer
system.
 There are few alternatives. Magnetic tape systems are generally too slow. In addition,
they are limited to sequential access. Thus tapes are more suited for storing
infrequently used files, where speed is not a primary concern.

Functions of Secondary storage management in OS:

An Operating System performs the following functions for Secondary storage


Management:

 Free space management


 Storage allocation
 Disk scheduling.

4. I/O System management

 One of the purposes of an operating system is to hide the peculiarities of specific


hardware devices from the user.

 For example, in UNIX, the peculiarities of I/O devices are hidden from the bulk of
the operating system itself by the I/O system. The I/O system consists of:
 A buffer caching system
 A general device driver code
 Drivers for specific hardware devices.

Only the device driver knows the peculiarities of a specific device.

5. File management
 A file is a set of related information which is define by its creator. It commonly
represents programs, both source and object forms, and data.
 The operating system implements the abstract concept of the file by managing mass
storage device, such as types and disks.
 Also files are normally organized into directories to ease their use. Finally, when
multiple users have access to files, it may be desirable to control by whom and in
what ways files may be accessed.

Function of file management in OS:

The operating system has the following important given activities in connections with
file management:

 File and directory creation and deletion.


 For manipulating files and directories.
 Mapping files onto secondary storage.
 Backup files on stable storage media(non volatile storage)

6. Protection system

 The various processes in an operating system need to be secured from each other's
activities. For that purpose, various mechanisms can be used to ensure that those
processes which want to operate files, memory CPU, and other hardware resources
should have proper authorization from the operating system.
 For example, Memory addressing hardware helps you to confirm that a process can be
executed within its own address space. The time ensures that no process has control of
the CPU without renouncing it.
 Lastly, no process is allowed to do its own I/O, to protect, which helps you to keep the
integrity of the various peripheral devices.

7. Networking

 Network management is the process of administering and managing computer


networks. It includes performance management, fault analysis, provisioning of
networks, and maintaining the quality of service.
 A distributed system is a collection of computers/processors that never share their
own memory or a clock. In this type of system, all the processors have their local
Memory, and the processors communicate with each other using different
communication lines, like fiber optics or telephone lines.
 The computers in the network are connected through a communication network,
which can be configured in a number of different ways. With the help of network
management, the network can be fully or partially connected, which helps users to
design routing and connection strategies that overcome connection and security
issues.

Functions of Network management:


 Distributed systems help you to various computing resources in size and
function. They may involve microprocessors, minicomputers, and many general-
purpose computer systems.
 A distributed system also offers the user access to the various resources the
network shares.It helps to access shared resources that help computation to speed-up
or offers data availability and reliability.

Built on top of networking

o Email, messaging (GroupWise)


o FTP
o gopher, www
o Distributed file systems --- NFS, AFS, LAN Manager
o Name service --- DNS, YP, NIS
o Replication --- gossip, ISIS
o Security --- kerberos

8. Command interpreter

 One of the most important components of an operating system is its command


interpreter. The command interpreter is the primary interface between the user and the
rest of the system.
 Many commands are given to the operating system by control statements. When a
new job is started in a batch system or when a user logs-in to a time-shared system, a
program which reads and interprets control statements is automatically executed. This
program is variously called (1) the control card interpreter, (2) the command line
interpreter, (3) the shell (in Unix), and so on. Its function is quite simple: get the next
command statement, and execute it.
 The command statement themselves deal with process management, I/O handling,
secondary storage management, main memory management, file system access,
protection, and networking.

User Interface

1. Character-Oriented shell --- sh, csh, command.com ( User replaceable)


2. GUI --- X, Windows 95
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

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.

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.

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.

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.

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.

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.

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.

You might also like