Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

Chap 1 Introduction to Operating System

Uploaded by

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

Chap 1 Introduction to Operating System

Uploaded by

nameistushar12
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 97

T.Y. B. Sc.

COMPUTER SCIENCE
Sem-V
TITLE OF PAPER : Operating Systems - I
Course Code : CS-351 :
Credits - 2

Chapter 1: Introduction to Operating System


Introduction to
Operating Systems
- Operating Systems Overview- system - -Overview and
Functions of operating systems
- What does an OS do?
- Operating system Operations
- Operating system structure
- Protection and security
- C o m p u t i n g E n v i r o n m e n t s - Tr a d i t i o n a l , m o b i l e ,
d i s t r i b u t e d , C l i e n t / s e r v e r, p e e r t o p e e r c o m p u t i n g
- Open source operating System
- Booting
- Operating System services,
- S y s t e m c a l l s Ty p e s o f S y s t e m c a l l s a n d t h e i r w o r k i n g .
Introduction

Operating system is a chief program that


manages all of the hardware and software.
It has control of every process, file section of
memory and device.
It is very important as it works as a middle
man making sure both hardware and
software interact correctly.
Windows, Mac OS, LINUX and UNIX are the
big operating system contenders and all have
their own advantages and or disadvantages
but they are all based on the same concepts.
Continued…

There are four essential managers –


Process manager,
Memory manager,
File manager,
Device Manager
of every operating system and they all work
together like a team to get jobs completed.
The operating system works as a boss and to
make sure they are all working in harmony.
Operating Systems Overview

An Operating System is one of the most


important software that runs on computer.
It is an integrated set of programs that are
used to manage Computer memory and
processes, as well as all of its software and
hardware.
It helps users to communicate with the
computer without knowing the Computer’s
Language i.e. it is a program that are used to
manage various and overall operations of
computer system.
Continued..

If we purchase a Computer Machine and try to


work on it then it will be like a dump machine like
body without a soul. If you want a computer
machine to work its soul i.e. Operating system
must be installed in it. So we can say that without
an operating system a Computer is useless.
An operating system acts as an intermediary
between the user of the computer and computer
hardware. The most important purpose of O.S is
to provide an environment in which a user can
execute programs conveniently and efficiently
Objectives or Goals of OS

1) Convenience: An OS is designed or
constructed in such as way that it makes the
Computer System more convenient to use.
2) Efficiency: An OS allows the computer
system resources to be used in an efficient
manner.
3) Ability to evolve: An OS should be designed
or constructed in a such a way that the
testing , development as well as addition of
new system components could be performed
effectively without interfering with existing
services.
Categories of OS

1) Single user, Single tasking OS


2) Single User, Multiple tasking OS
3) Multi-user, Multi –tasking OS
4) Real Time OS : Airline traffic control systems, Network Multimedia
Systems, Robot

5) Distributed OS
6) Time Sharing OS
7) Multiprogramming OS
8) Batch Processing OS
9) Multithreading OS
10) Multiprocessing OS
11) Network OS
12) Embedded OS
13) Mobile OS
Definition:

 An operating system can be defined as “A system software


which acts as an interface or bridge between an
application program and computer hardware by
controlling the execution of user/application program.”
 An operating system is defined as,” an organized
collection of programs that controls the execution of the
application programs and acts as interface between
computer system and computer hardware.”
 An OS is defined as, “a program that acts as an
intermediary between the user and the computer
hardware and controls the execution of all kinds of
programs”.
 OS is a “set of programs which controls/manages all the
computers resources (hardware and software) and provide
an OS environment in which users can execute programs.
Computer System Overview

An Computer is an electronic device which is


used to store, retrieve and process the data
A Computer system is a collection of
hardware and software components designed
to provide an effective tool for computation.
Conceptual View of Computer System
Computer System Overview

Every Computer system is divided into


hardware, system and application programs,
the operating system and users.
The hardware consists of CPU, Memory and
Input/Output devices which are altogether
used to provide the basic computing
resources for the computer system.
An OS is core software that controls the
execution of an application program and acts
as an interface between the user of a
computer and computer hardware.
Continued..

The OS mainly coordinates the use of the hardware


among the various system programs and application
programs for various users.
Application programs defines the ways in which the
system resources are used to solve the computing
problems of the users (word processor, Video games,
spreadsheet etc.)
System Program are the set of utility programs supplied
with an OS to provide basic services for the computer
users (Compilers, Text editors, assemblers et).
Users are peoples like system analyst, programmers and
operational users etc who interact with computer system.
Functions of operating systems
Process
Management

Memory
Management

Input/Output
Management

File
Management

Device
Management

Security

Command Interpretation

Job Priority
Functions of operating systems

1) Process Management:
The process management module of an
operating system take care of the creation
and deletion of processes, scheduling of
various system resources to the different
processes requesting them and providing
mechanism for synchronization and
communication among processes.
Functions of operating systems

2) Memory Management:
To execute a program, it must be loaded,
together with the data it accesses in the main
memory.
To improve CPU utilization and to provide
better response time to its user, a computer
system normally keeps several programs in
main memory.
The memory management module of an
operating system takes care of the allocation
and deallocation of memory space to the
various programs in need of this resource.
Functions of operating systems
3) Input/output 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(uniqueness) of I/O


devices are hidden from the bulk of the operating system itself
by the I/O subsystem.

 The I/O subsystem consists of several components:


 Memory-management component that includes buffering,
caching and spooling.
 A general device-driver interface.
 Drivers for specific hardware devices.
 Only the device driver knows the peculiarities of the specific
device to which it is assigned.
Functions of operating systems
4) File Management:
 All computer systems are used for storage, retrieval and
sharing of information. A computer normally stores such
information in units called files.
 Processes can read information from files and can create
new files for storing newly generated information.
Information stored in files is made persistent by storing
them on a secondary storage media such as a magnetic disk.
 Files provide a natural and easy means of information
sharing. That is, a file can be created by one application and
then shared with different applications at a later time.
 The file management module of an operating system takes
care of file-related activities such as organization, storing,
retrieval, naming, sharing and protection of files. It
allows programs to use a set of operations that allocation
and layout of the secondary storage devices.
Functions of operating systems

5) Device Management:
A computer system normally consists of several l/O
devices such as terminal, printer, disk, and tape. The
device management module of an operating system
takes care of controlling all the computers l/O devices.
It keeps track of l/O request from process, issues
commands to the l/O devices and ensures correct data
transmission to/from and I/O devices.
It also provides an interface between the device and
the rest of the system that is simple and easy to use.
Often, this interface is device independent, that is, the
interface is same for all types of I/O devices.
Functions of operating systems

6) Security:
Computer systems often store large amount of
information, some of which is highly sensitive and
valuable to their users.
Users can trust the system and rely on it only if the
various resources and information of a computer
system are protected against destruction and
unauthorized access.
The security module of an operating system ensures
this. This module also ensures that when several
disjoint processes are being executed simultaneously
one process does not interfere with the others, or with
the operating system itself.
Functions of operating systems

7) Command Interpretation:
A user communicates with the operating system, for
using the various operations, via a set of command
provided by the operating system.
The operating system also provides a simple
language, known as command language (CL) using
which a user can put several commands together
from the command set to describe the resource
requirements of the job.
The command interpretation module of an operating
system take care of interpreting user command,
supplied individually or in the form of command
language and directing the system resources to
handle the request.
Functions of operating systems

8) Job Priority:
Establishment and enforcement of a job
priority system, i.e., it determines the order
in which jobs are to be executed in the
computer system.
What does an OS do?

1) The OS schedules all the operations and manages all the


computing resources.
2) The OS provides the proper use of the resources in the
operations of the computer system.
3) It provides an environment for running user program.
4) It supports operations and services that required
communications over network
5) It provides security – ensures that only authorized persons can
access data and information or perform certain tasks on the
computer system.
6) OS executes user programs and to make solving user
problems easier.
7) It provides file management
8) It provide memory management function.
9) It manages the processes.
10) It manages all I/O device communication.
Operating system Operations
Dual Mode operation
Operating system Operations

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 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
Operating system Operations

 When the computer system is executing on behalf of


a user application, the system is in user mode.

However, when a user application requests a service


from the operating system (via a system call), it
must transition from user to kernel mode to fulfill
the request.

As we shall see, this architectural enhancement is


useful for many other aspects of system operation as
well.

At system boot time, the hardware starts in kernel


mode.
Continued…

 Whenever a trap or interrupt occurs, the


hardware switches from user mode to kernel
mode (that is, changes the state of the mode bit
to 0).

 Thus, whenever the operating system gains


control of the computer, it is in kernel mode.

 The system always switches to user mode (by


setting the mode bit to 1) before passing control
to a user program.
Operating system Operations

The dual mode of operation provides us with the means


for protecting the operating system from errant users
We accomplish this protection by designating some of
the machine instructions that may cause harm as
privileged instructions.
The hardware allows privileged instructions to be
executed only in kernel mode.
If an attempt is made to execute a privileged instruction
in user mode, the hardware does not execute the
instruction but rather treats it as illegal and traps it to
the operating system.
The instruction to switch to user mode is an
example of a privileged instruction.
Timer
We must ensure that the operating
system maintains control over the CPU.
We must prevent a user program from getting
stuck in an infinite loop or not calling system
services and never returning control to the
operating system.
To accomplish this goal, we can use a timer. A
timer can be set to interrupt the computer after a
specified period.
The period may be fixed (for example, 1/60 second)
or variable (for example, from 1 millisecond to 1
second). A variable timer is generally implemented
by a fixed-rate clock and a counter.
Timer
We must ensure that the operating
system maintains control over the CPU. We
must prevent a user program from getting stuck
in an infinite loop or not calling system services
and never returning control to the operating system.
To accomplish this goal, we can use a timer.
A timer can be set to interrupt the computer after a
specified period. The period may be fixed (for
example, 1/60 second) or variable (for example,
from 1 millisecond to 1 second).
 A variable timer is generally implemented by a
fixed-rate clock and a counter.
The operating system sets the counter. Every
time the clock ticks, the counter is
decremented. When the counter reaches 0,
an interrupt occurs.
If the timer interrupts, control transfers
automatically to the operating system, which
may treat the interrupt as a fatal error or
may give the program more time.
 Clearly, instructions that modify the content
of the timer are privileged.
Timer

Thus, we can use the timer to prevent a user


program from running too long. A simple
technique is to initialize a counter with the
amount of time that a program is allowed to
run. A program with a 7-minute time limit, for
example, would have its counter initialized to
420.
Operating system structure

Operating System Structure


 When we develop a large software or program then , we split the
program into small modules or units.
 Similarly when we going to design the operating system, we
decompose it into small parts or modules, so that we can easily
develop or modify in the modules.
 For efficient performance and implementation an OS should be
partitioned into separate subsystems, each with carefully defined
tasks, inputs, outputs, and performance characteristics.
 These subsystems can then be arranged in various architectural
configurations:
 Following approach is used to design the operating system
1) Simple Structure
2) Layered Approach
3) Microkernel's
4) Modules
Simple Structure

 Many commercial operating systems do not have well-defined


structures.
Frequently, such systems started as small, simple, and limited
systems and
then grew beyond their original scope.

When DOS was originally written its developers had no idea how big
and important it would eventually become.
 It was written by a few programmers in a relatively short amount of
time, without the benefit of modern software engineering
techniques, and then gradually grew over time to exceed its original
expectations.
 It does not break the system into subsystems, and has no distinction
between user and kernel modes, allowing all programs direct access
to the hardware.
 MS-DOS – written to provide the most functionality in the least
space
 Not divided into modules
MS-DOS Layer Structure
 written for intel
8088
 Provides no dual
mode and no
hardware
protection
MS-DOS Layer Structure
Advantage of Simple Structure:
MS-DOS – written to provide the most functionality in the
least space

Disadvantages of Simple Structure:


Not divided into modules, Although MS-DOS has some
structure, its interfaces and levels of functionality are not well
separate
Layered structure UNIX O.S

 The original UNIX OS used a simple layered approach, but


almost all the OS was in one big layer, not really breaking the
OS down into layered subsystems:
 UNIX – limited by hardware functionality, the original UNIX
operating system had limited structuring.
 The UNIX OS consists of two separable parts
 Systems programs (system utilities or system applications.)
 The kernel

Kernel is further divided into a series of interfaces and device


drivers.
Kernel provides the functions such as
- CPU scheduling
- memory mgmt
- File mgmt
- Paging etc
Traditional UNIX System Structure
OR

User

Shell

System call interface to kernel

Kernel

Kernel interface to hardware

Device Controllers
Layered Approach

 The operating system is divided into a number of layers


(levels), each built on top of lower layers.
 The bottom layer (layer 0), is the hardware
 The highest (layer N) is the user interface.
 OS is divided into a number of smaller layers, each of
which rests on the layer below it, and relies solely on
the services provided by the next lower layer.
 This approach allows each layer to be developed and
debugged independently, with the assumption that all lower
layers have already been debugged and are trusted to
deliver proper services.
 The problem is deciding what order in which to place the
layers, as no layer can call upon the services of any higher
layer.
Layered Operating System
Advantages of Layered approach
 Simplicity in design and implementation
 Debugging is easy. Debugging is done from layer 0 to layer
N
Once the first layer debugging is done, then second layer is
debugged and so on.
When the error is found, the error is only of that layer because
bottom layers are already debugged.
 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.
 Each layer hides the existence, hardware from higher level
layer.
Disadvantages of Layered approach
 A layer can use only lower level layers, so careful
planning is necessary.
e.g: Device driver for the backing store must be also
at a lower level than the memory mgmt routines,
because memory mgmt requires the ability to use
the backing stores.
 Efficiency is less than other type.
Microkernel System Structure
 The basic idea behind micro kernels is to remove all non-
essential services from the kernel, and implement them as
system applications instead, there by making the kernel as small
and efficient as possible.
 The result is smaller kernel
 It provides minimal process and memory mgmt in addition to
the communication facility
 The main function is to provide a communication facility between
the client program and the various services that are also running in
user space.
 Communication is provided by message passing
 If the client program wishes to access a file it must interact with
the file system
 The client program and service never interact with the file
server.
Rather they communicate indirectly by exchanging messages with
the microkernel
Microkernel System Structure

 Benefits:
 Easier to extend a microkernel
 All new services are added to user space without modifying the
kernel
 Easier to port the operating system to new architectures
 More reliable (less code is running in kernel mode)
 More secure

 Disadvantages
The performance of microkernel decreases due to increased
function overheads
Architecture of a typical microkernel
Modules

 Most modern operating systems implement kernel modules


 Uses object-oriented approach
 Each core component is separate
 Each talks to the others over known interfaces
 Each is loadable as needed within the kernel

 Such type of design is combination of layered structure and


microkernel approach
 But it is flexible than layered system as any module can call any
other modules.
 It is also efficient than microkernel approach because modules
do not need to invoke message passing in order to communicate.
 E.g
Solaris, linux and Mac OS X
Solaris Modular Approach
Protection and Security
 The owners of information stored in a multi-user or networked
computer system many want to control use of that information.
 i.e. access to data and other related privileged like reading ,
writing, executing etc. Even the concurrent processes should not
interfere with each other which cause damage to the information.
Protection:
 When several jobs belonging to different users are executed, at
that time program or data of one job is protected from other jobs
by operating system. It also ensures that all access to system
resources is controlled.
Security:
 Security of the system from unwanted users requires user
authentication usually by means of password. External I/O must
also be defended from invalid access.
 Keeping the system protected and secure is one of the important
aspects taken into consideration.
Computing Environments : Traditional Computing:
 Consider the ‘typical office environment.’ Just a few years
ago, it considered PCs connected to a network, with servers
providing file and print services.
 Remote access was awarded and portability was achieved by
the use of laptop computers
 Terminals attached to the mainframe were prevalent at many
companies as well, with even fewer remote access and
portability options.
 The current trend is toward providing more ways to
access these computing environments. Web
technologies and increasing one WAN bandwidth are
stretching the boundaries of traditional computing.
 Companies established portals, which provide web access to
their internal servers. Network computers are essentially
terminals that understand web-based computing which used
in place of the traditional workstation where more security or
easier maintenance is desired.
Mobile Computing:

Mobile computing refers to computing on handheld


smart phones and tablet computers. These device
distinguishing physical features of being portable
and lightweight.
Historically, compared with desktop and laptop
computers, mobile systems gave up screen size,
memory capacity, and overall functionality in return
for handheld mobile access to services such as
email and web browsing.
Over the past few years, however, features of
mobile devices have been so rich that the
distinction in functionality between, say, a
consumer laptop and a tablet computer may be
difficult to distinguish/differenciate.
Mobile Computing:
 In fact, we might argue that the features of a
contemporary mobile device allow it to provide
functionality that is easily unavailable or impractical on a
desktop or a laptop computer.
 Today, mobile systems are used not only for e-mail
and web browsing but also for playing music and
video, reading digital books, taking photos, and
recording high-definition video.
 Two operating systems currently dominate mobile
computing: Apple iOS and Google Android.
 iOS was designed to run on Apple iPhone and iPad
mobile devices.
 Android powers smartphones and tablets computers
available from many manufactures.
Distributed Systems:

 This system was developed during 1980’s. it depends on


networks.
 It consists of many processors connected through
networking.
 The networking are of different types and depends on the
distance between nodes such as: LAN (Local Area
Network), exists in limited area, WAN (Wide Area
Network), exists for long distance and MAN (Metropolitan
Area Network), could link building within the city.
 In distributed operating system, user are not be aware of
where the programs are located and processed, that
should all be handled automatically by the operating
system.
Distributed Systems:

A distributed computing environment contains


multiple nodes that are physically separate but
linked together using the network.
A Distributed system is managed by a
distributed OS.
A distributed system is a collection of
physically separate, possibly heterogeneous,
computer system that are networked to
provide users with access to the various
resources that the system maintain.
Distributed Systems:
Distributed Systems:

Schemes for building distributed system:


There are two schemes for building distributed system:
1) Tightly Coupled:
In this the processors share memory and a clock. A
communication between the processors usually through
the shared memory.
2) Loosely Coupled:
In which the processor do not share memory or a
clock.
However, each processor has its own local memory and
the processor communicate with one another through
various communication lines such as telephone lines
or high speed buses.
Distributed Systems:

Some of the reasons for using distributed operating system:


1) Reliability:
 It is more reliable. If one node (site) fails the remaining nodes
are continue operating.
2) Communication:
 The several sites are connected to one another in the network;
the information can be exchanged among different sites or
users.
3) Speed:
 It allows to share the computation among various nodes to run
it concurrently so execution speed increases.
4) Resource Sharing:
 It allows sharing resources computational task and providing a
rich set of features to users.
Distributed Systems:

Some of the reasons for using distributed operating system:


1) Reliability:
 It is more reliable. If one node (site) fails the remaining nodes
are continue operating.
2) Communication:
 The several sites are connected to one another in the network;
the information can be exchanged among different sites or
users.
3) Speed:
 It allows to share the computation among various nodes to run
it concurrently so execution speed increases.
4) Resource Sharing:
 It allows sharing resources computational task and providing a
rich set of features to users.
Distributed Systems:

 Advantages of Distributed system:


 With resource sharing facility, user at one site may be able to use

the resources available at another.


 Speedup the exchange of data with one another via electronic mail.

 If one site fails in a distributed system, the remaining sites can

potentially continue operating.


 Better service to the customers.

 Reduction of the load on the host computer.

 Reduction of delays in data processing

 Disadvantages of Distributed system:


o Failure of main network will stop the entire communication.
o To establish distributed systems the language which are used are not well
defined.
o These types of systems are not readily available as they are very
expensive
Client-Server
 Now a day Client- server system is popularly used to satisfy the user needs. In this, we access
and use different database or services via. a network.
 Example: Internet
Components used in Client-server system:
1) Client:
 It is a single user workstation which is used to access the data. It performs task like:-
validation of data, send user requests and receive information from the server, gives
interface.
2) Server:
 It is a multi-user processor that manages the database and provides information to the user.
It perform tasks like:- manage database of several users, security to database is maintained,
processes user requests.
Server system has two types:-
a) Computer-server:
 The request from the client is served and result is send back to the client.
b) File-server:
 Client can create, delete, update, read the files using file-system interface.
3) Database:
 It is used to store data.
4) Network:
 It is used to establish the connection between client and server.
Client-Server
Client-Server

Advantages of Client-server system:


 Reduce total execution time.
 Increases client CPU usage
 Use of client memory is reduce
 Network traffic is reduced.
Disadvantages of Client-server system:
 Traffic issue
 Very expensive
 Server dependency.
peer to peer computing

InP2P Computing, client and servers are not


distinguishing from one another. All nodes in the
network are considered peers and they can act as server
or client depending upon the service provided
It Contains nodes that are equally participating in data
sharing
 In this all the tasks are equally divided between all the
nodes. The nodes interact with each other as required as
share resource.
The nodes in peer to peer computing both use resource
and provide resources. Most modern OS such as
Windows and Mac Os contain software to implement
peer to peer networks.
peer to peer computing

To participate in peer to peer computing the


node must first join the network of peers.
Once a node has joined, it services to or from
other nodes.
If Any node want specific service, it first
contacts with centralized lookup service to
determine which node provides a service
The node can broadcast a request for a
service on network and finds the response
from the peer who is going to provide a
service.
peer to peer computing
peer to peer computing

 Advantages
1) Each computer in the peer to peer computing Manages
itself. So, the network is quite easy to set up and
maintain.
2) It is easy to scale the peer to peer network and add
more nodes
3) In this the cost of the server is saved
 Disadvantages:
1) It is difficult to backup the data as it is stored in
different computer system and there is no central server.
2) It is difficult to provide overall security in the peer to
peer computing as each system is independent and
contains its own data.
Open source operating System
 Its a OS whose code has been made publicly and freely available to anyone
who want to see it and modify it
 Its available in Source code format instead of Compiled binary code.
 Open source is a term that originally referred to Open Source Software(OSS).
 It is released under licence where the copyright holder allows other to study,
change as well as distribute the software to other people without any cost or
charges.
 E.g GNU/ Linux released under GNU General Public Licence(GPL).
Advantages :-
1) Its Available Freely on Internet without any charges
2) User can modify and edit changes as per their choice and requirement
Disadvantages:-
3) Constant updates are headaches sometimes as users have to keep updating
their system and code
4) Frequent modifications are challenges for users to decide which Open source
system is better.
5) Sometimes Hardware not Compatible with this System.
Booting

 The procedure of starting a computer by loading the kernel


is know as booting the system
 On most computer system a small piece of code known as
bootstrap program or bootstrap loader locates the
kernel loads it into main memory and starts its execution
(booting)
 Some times this booting process is two-step process
1) A simple bootstrap loader fetches and loads more
complex boot program.
2) which in turn loads the kernel.
 When the CPU is powered on or rebooted, the instruction
register starts execution at predefined memory location
where the initial bootstrap program stored. This program is
in the form of read only memory(ROM)
Booting

 The bootstrap program can perform a variety of tasks.


1. One task is to run diagnostics to determine the state
of the M/C
2. If the diagnostics pass, the program can continue with
the booting steps
3. It also initializes all aspects of the system from CPU
registers to device controllers and the contents of main
Memory.
4. Once the full bootstraps program is loaded it traverse
the file system to search the O.S kernel, loads it into
memory and starts its execution.
Types of Booting:-
Cold Booting and Warm Booting
Steps in Booting Process
Operating System services
Operating system provides number of services to the user. It varies
system to system. But there are some common services which are
provided by all operating system.
Common services provided by operating system:
1) User Interface:
 It is a medium through which user actually interacts with the
computer system via operating system.
 User interface are categorized into three types : Command Line
Interface (CLI), Batch Interface, Graphical User Interface (GUI).
Command Line Interface (CLI):
 It provides an environment where user can write their command in
text format on command prompt.
Batch Interface:
 In this user creates a batch file which contains multiple executable
commands in a sequence. This batch file is executed to execute the set of
commands included in it one by one or sequentially.
Graphical User Interface (GUI):
 Most of the operating system provides graphical interface which
have tools like pointing devices which directs the input/ouput operations
Operating System services

2) Program execution:
 To get any work done from computer, user
writes a program. Operating system must let
the user to load his program into memory and
execute it. Execution of program must end
normally or abnormally.
3) Input/Output operations:
 Operating system must provide means to
perform I/O for any of user program. I/O
operation can be performed from file or
input/output device.
Operating System services
4) File system Manipulation:
 Files are used by users for different purpose. There
should be some means to perform operations like
read/write, create/delete etc on file.
5) Communication:
 It refers to communication that takes place among the
different processes which may be present on the same
machine/computer or another machine/computer
connected through computer network.
 Communication might happen that processes need to
communicate with each other for some purpose like data
transfer between two processes.
 Communication may be implemented by two methods:
shared memory, message passing.
Operating System services

6) Error Detection:
 An error is one of the parts of the
system that may cause malfunctioning of the
complete system. Error may occur in CPU
and memory hardware, user program (due to
wrong/illegal memory access/operations),
input/output (e.g. keyboard not connected
properly, printer out of paper etc.).
Operating system must be aware of such
error and must be able to take appropriate
actions to ensure correct and consistent
computing.
Operating System services

Few other services in addition to above mentioned services are:


7) Resource Allocation:
 When multiple user or multiple jobs running concurrently,
resources must be allocated to each of them. Many types of
resources such as CPU cycle, main memory and file storage etc.
which has special allocation code, other such as I/O devices has
general request and release code. These resources are managed by
operating system e.g. status of resource – whether available/ not
available, whether a process request for a resource is valid or not,
status of the resource is updated in case it is released, checking if
resource can be shared or not.
8) Accounting:
 Information about available resources and user (which users
use how much and what kinds of resources) is maintained by
operating system.
 It also helps in finding out the usage statistics. It is even useful for
the researchers to find out the usage and the requirements to
reconfigure the system.
Operating System services

9) Protection and Security:


 The owners of information stored in a multi-user or networked
computer system many want to control use of that information. i.e.
access to data and other related privileged like reading , writing,
executing etc. Even the concurrent processes should not interfere with
each other which cause damage to the information.
Protection:
 When several jobs belonging to different users are executed, at that
time program or data of one job is protected from other jobs by
operating system. It also ensures that all access to system resources is
controlled.
Security:
 Security of the system from unwanted users requires user
authentication usually by means of password. External I/O must also be
defended from invalid access.
 Keeping the system protected and secure is one of the important
aspects taken into consideration.
System calls

A system call is a request by the user to the operating


system to do something on user’s behalf. It provides an
interface between a running program and an
operating system.
System calls allow user-level processes to request some
services from the operating system which the process
itself is not allowed to do.
It is a programmatic way in which a computer program
requests a service from the kernel of the operating
system.
Some system may allow system calls to be written in
higher-level language program, in which the calls
normally like predefined function or subroutine
calls.
Working Of System Call

 Consider the above example i.e. to copy one file into another file
 Initially we need to input two filenames- input file and output file.

 In first approach we can ask user to enter filenames by


prompting a message. It requires sequence of system calls, first
to prompt a message on the screen and then read filenames
entered through keyboard.
 In second approach user can select appropriate filenames
through menus with the help of mouse. This also requires many
I/O system calls.
 Once filenames are obtained, we need system calls to check the
existence of input file, to print a message if file does not
exist, to open an input file if file exist, to create an output
file.
Working Of System Call

After opening files, we use a sequence of


system calls in the loop that reads from input
file and writes into output file.
Finally, after copy operation is over, both files
must be closed for this system call is used,
write message on screen which indicates the
completion of copy process also requires the
system call.
In this way, almost every program or
operation makes use of system calls of
operating system.
A User Application that invokes open() System Call
Passing Parameter in System Call

There are three methods available for passing


parameter to operating system through system call.
1) Pass the parameter in registers. Parameters are
accessed much faster in registers. But there may
be more number of parameter than registers.
2) Parameters are stored in memory block or table.
Then address of that memory block or table is
passed as a parameter through register. This
approach is used by LINUX OS.
3) Parameters are pushed into stack by the program
and operating system popped off the stack to get
parameter.
Passing parameter as a table through register
Types of System calls

The system calls can categorized into five


major categories:
1) Process and job control
2) Device management
3) File management
4) Information maintenance
5) Communication
Process and Job Control:
 Process and Job Control:
System call under this category:
1. End, abort
2. Load, execute
3. Create Process, terminate process
4. Get process attribute, set process attribute
5. Wait for time, Wait event
6. Allocate memory, free memory
 Process need to be controlled as in a running. Process must
able to halt its execution either normally (end) or abnormally
(abort).
 If error occurs in input data of the program, then error
messages is generated.
 In both normal and abnormal halt, the operating system
transfer control to the command interpreter. The command
interpreter then reads the next command.
Process and Job Control:

In multiuser system, command interpreter continues


with next command, while in batch system, it terminates
the entire job and continue with next job.
We should able to control the execution to the newly
created job or processes by assigning the job priority, or
reset the attribute of the processes or sometimes
terminate a created process if we find that it is wrong.
When the job is created, we should wait for its execution.
i.e. wait for time
When a process is going to be executed it may need
memory or may need access to the memory so we have
to allocate memory (allocate memory) and when the
process finishes its execution the allocated memory has
to be freed.
Device management
System call under this category:
1. Request device, release device
2. Read and write operation
3. Get device attribute, set device attribute
4. Logically attach or detach devices.
 If users are using the system, then user must first request the device. If the
requested resources are available in the system then they can be granted to the
user process. Otherwise process will have to wait till requested resources are
available. When the work is over with the device, we must release it (release
device). These system calls are similar to open and close system calls
 After device is granted to process, we must read, write and reposition the
device just as we can with files.
 If any process wants to attach to any device then it will use attach device
system call and if any point the process want to disconnect any device then it
will make use of this detach system call.
 Many operating systems like UNIX or LINUX treats every device as a file. All
operations to perform device management are almost similar to file
management. The user interface can also make files and devices appear to be
similar.
File management

 System call under this category:


1. Create file, delete file
2. Open, close
3. Read, write, reposition
4. Get file attribute, set file attribute
 Computers can store information on various storage media, such as magnetic disks, magnetic
tapes, and optical disks.
 Files are mapped by the operating system onto physical devices. These storage devices are
usually nonvolatile, so the contents are persistent through power failures and system reboots.
 There are some common system calls related to file management available in operating
systems. Every file is created using create system call and deletion is possible using delete
system call.
 Once the file is created or already available, it must be opened using open system call before
any operations are performed. We must have to pass the filename and operation mode as
parameter to the open system call.
 We read the content of the file using read system call and write operation can be performed
using write system call.
 After read or write operation file pointer is advanced automatically. File pointer can also be
repositioned manually using reposition system call.
 Finally file should be closed for which close system call is used to indicate that we are no
longer using it.
 Every file has a set of attribute such as file type, owner identifier, access permission,
accounting information and so on. Get file attribute and set file attribute are the system call
used to retrieve attributes of file.
Information Maintenance

It handles information and its transfer between the


OS and the user program.
System call under this category:
Get or set time and date
Get process and device attributes
Get system data, set system data.
The system have a system call to return the current
time and date. Some system calls provide the
information about number of users, version of
operating system, free disk space, free memory and
so on. Some system calls gives the job or process
information.
Communication:

These types of system calls are specially used


for inter process communications.
System call under this category:
Create, delete communications connections
Send, receive message
Help OS to transfer status information
Attach or detach remote devices
Communications Models
Shared Memory

 In this model a region of memory that is shared


by cooperating processes is established .
 Process can exchange information by reading and
writing data to the shared region.
 It is faster than message passing because in
shared memory systems, system calls are required
only to establish shared memory region.
 Normally O.S tries to prevent one process from
accessing other process memory
 The process are responsible for ensuring that they
are not writing to the same location
simultaneously
Message Passing system

 In this communication takes place by means of


message exchanged between the cooperating
processes.
 They are useful for exchanging smaller amounts of
data.
 Easier to implement than shared memory for inter
computer communication
 Slower than shared memory because it is
implemented using system calls and thus require
the more time consuming task of kernel
intervention
 E.g a chat program used on www could be
designed so that chat participants
communicate with one another by exchanging
messages.
 This model provides a mechanism to allow
processes to communicate and to synchronize their
Message Passing system

It provides at least two operations: send


(message) and receive (message)
If process P and Q want to communicate
they must send messages to and receive
messages from each other
A communication link must exist between
them
This communication link can be
implemented in a variety of ways.
1.Direct or indirect communication
2.Synchronous or Asynchronous
communication
3.Automatic or explicit buffering
End of Chapter 1

You might also like