0% found this document useful (0 votes)
22 views54 pages

Unit1 1

Uploaded by

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

Unit1 1

Uploaded by

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

UNIT 1-1

CONTENTS
 Over View of Operating Systems
 Types of Operating Systems
 Operating System Structures
 Operating System Services
 System Calls
 Virtual Machines
 Operating System Design and
Implementation

Operating System Concepts 1.2 Silberschatz, Galvin and Gagne


What is an Operating System?

 A program that acts as an intermediary between a user


of a computer and the computer hardware.
 Operating system goals:
 Execute user programs and make solving user
problems easier.
 Make the computer system convenient to use.
 Use the computer hardware in an efficient manner.

Operating System Concepts 1.3 Silberschatz, Galvin and Gagne


Computer System Components

1. Hardware – provides basic computing resources (CPU,


memory, I/O devices).
2. Operating system – controls and coordinates the use
of the hardware among the various application
programs for the various users.
3. Applications programs – define the ways in which the
system resources are used to solve the computing
problems of the users (compilers, database systems,
video games, business programs).
4. Users (people, machines, other computers).

Operating System
Concepts

Operating System Concepts 1.4 Silberschatz, Galvin and Gagne


Four Components of a Computer System

Operating System Concepts 1.5 Silberschatz, Galvin and Gagne


Operating System Definition

 OS is a resource allocator
 Manages all resources
 Decides between conflicting requests for efficient
and fair resource use
 OS is a control program
 Controls execution of programs to prevent errors
and improper use of the computer
 Kernel – the one program running at all times (all
else being application programs).

Operating System Concepts 1.6 Silberschatz, Galvin and Gagne


Operating System Definition
(Cont.)

 No universally accepted definition


 “The one program running at all times on the
computer” is the kernel. Everything else is either a
system program (ships with the operating system) or
an application program
 Interface between user and computer hardware

Operating System Concepts 1.7 Silberschatz, Galvin and Gagne


OS Structure and Goals

 Multiprogramming needed for efficiency


 Single user cannot keep CPU and I/O devices busy at all
times
 Multiprogramming organizes jobs (code and data) so CPU
always has one to execute
 A subset of total jobs in system is kept in memory
 One job selected and run via job scheduling
 When it has to wait (for I/O for example), OS switches to
another job

 Timesharing (multi-tasking) is logical extension in which CPU


switches jobs so frequently that users can interact with each
job while it is running, creating interactive computing
 Response time should be < 1 second
 Each user has at least one program executing in memory
process
 If several jobs ready to run at the same time  CPU
scheduling

Operating System Concepts 1.8 Silberschatz, Galvin and Gagne


Memory Layout for Multiprogrammed
System

Operating System Concepts 1.9 Silberschatz, Galvin and Gagne


OS Features Needed for
Multiprogramming

 I/O routine supplied by the system.


 Memory management – the system must allocate
the memory to several jobs.
 CPU scheduling – the system must choose among
several jobs ready to run.
 Allocation of devices.

Operating System Concepts 1.10 Silberschatz, Galvin and Gagne


Operating-System Operations
 Interrupt driven by hardware
 Software error or request creates exception or trap
 Division by zero, request for operating system
service
 Other process problems include infinite loop,
processes modifying each other or the operating
system
 Dual-mode operation allows OS to protect itself and
other system components
 User mode and kernel mode
 Mode bit provided by hardware
 Provides ability to distinguish when system is
running user code or kernel code
 Some instructions designated as privileged,
only executable in kernel mode
 System call changes mode to kernel, return
from call resets it to user

Operating System Concepts 1.11 Silberschatz, Galvin and Gagne


Transition from User to Kernel
Mode
 Timer to prevent infinite loop / process hogging
resources
 Set interrupt after specific period
 Operating system decrements counter
 When counter zero generate an interrupt
 Set up before scheduling process to regain control
or terminate program that exceeds allotted time

Operating System Concepts 1.12 Silberschatz, Galvin and Gagne


Types of Operating Systems

Operating System Concepts 1.13 Silberschatz, Galvin and Gagne


Batch Operating Systems
 A batch operating system is an operating
system in which same type of processes are
batched together for execution.
 Its a relatively faster system than
traditional 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
Operating programs
System Concepts with similar
1.14 requirements
Silberschatz, Galvininto
and Gagne
Operating System Concepts 1.15 Silberschatz, Galvin and Gagne
Interactive Computing

 An interactive operating system is one


that allows the user to directly
interact with the operating system
while one or more programs are
running.There will be on-line
communication between the user and
the system is provided; when the
operating system finishes the
execution of one command, it seeks
the next “control statement” from the
user’s keyboard.
 On-line system must be available for
users to access data and code.

Operating System Concepts 1.16 Silberschatz, Galvin and Gagne


Time Sharing Operating Systems
 A time sharing system or Multitasking system
allows many users to share the computer
resources simultaneously.
 In other words, time sharing refers to the
allocation of computer resources in time
slots to several programs simultaneously.
 For example a mainframe computer that has
many users logged on to it. Each user uses
the resources of the mainframe i.e. memory,
CPU etc.
 The users feel that they are exclusive user of
the CPU, even though this is not possible
with one CPU i.e. shared among different
users.(logical extension of
multiprogramming.) 1.17
Operating System Concepts Silberschatz, Galvin and Gagne
Operating System Concepts 1.18 Silberschatz, Galvin and Gagne
Real-Time Systems

 Often used as a control device in


a dedicated application such as
controlling scientific
experiments, medical imaging
systems, industrial control
systems, and some display
systems.
 Well-defined fixed-time
constraints.
 Real-Time systems may be either
hard or soft real-time.
Operating System Concepts 1.19 Silberschatz, Galvin and Gagne
Real-Time Systems (Cont.)

 Hard real-time:
 Secondary storage limited or absent, data
stored in short term memory, or read-only
memory (ROM)
 Conflicts with time-sharing systems, not
supported by general-purpose operating
systems.

 Soft real-time
 Limited utility in industrial control of
robotics
 Useful in applications (multimedia, virtual
reality) requiring advanced operating-
system features.

Operating System Concepts 1.20 Silberschatz, Galvin and Gagne


Network Operating Systems

These systems run on a server and provide the


capability to manage data, users, groups,
security, applications, and other networking
functions.
These type 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 1.21
Operating System Concepts
are popularly known
Silberschatz, Galvin and Gagne
Operating System Concepts 1.22 Silberschatz, Galvin and Gagne
Parallel Systems

 Multiprocessor systems with more


than one CPU in close
communication.
 Tightly coupled system –
processors share memory and a
clock; communication usually
takes place through the shared
memory.
 Advantages of parallel system:
 Increased throughput
 Economical
Operating System Concepts 1.23 Silberschatz, Galvin and Gagne
Parallel Systems (Cont.)
 Symmetric multiprocessing (SMP)
 Each processor runs and identical copy of the
operating system.
 Many processes can run at once without
performance deterioration.
 Share common memory and run independently.
 Asymmetric multiprocessing
 Each processor is assigned a specific task;
master processor schedules and allocated work
to slave processors.
 Do not share common memory.

Operating System Concepts 1.24 Silberschatz, Galvin and Gagne


Symmetric Multiprocessing Architecture

Operating System Concepts 1.25 Silberschatz, Galvin and Gagne


Distributed Systems

 Distribute the computation among several


physical processors.
 Loosely coupled system – each processor has
its own local memory; processors
communicate with one another through
various communications lines, such as high-
speed buses or telephone lines.
 Advantages of distributed systems.
 Resources Sharing
 Computation speed up – load sharing
 Reliability
 Communications

Operating System Concepts 1.26 Silberschatz, Galvin and Gagne


Distributed Systems (cont)

 Requires networking infrastructure.


 Local area networks (LAN) or Wide
area networks (WAN)
 May be either client-server or peer-to-
peer systems.

Operating System Concepts 1.27 Silberschatz, Galvin and Gagne


General Structure of Client-Server

Operating System Concepts 1.28 Silberschatz, Galvin and Gagne


Clustered Systems

 Clustering allows two or more systems


to share storage.
 Provides high reliability.
 Asymmetric clustering: one server runs
the application while other servers
standby.
 Symmetric clustering: all N hosts are
running the application.

Operating
Operating SystemSystem
Concepts 1.29 Silberschatz, Galvin and Gagne
Operating System Concepts 1.30 Silberschatz, Galvin and Gagne
Handheld Systems

 Personal Digital Assistants (PDAs)


 Cellular telephones
 Issues:
 Limited memory
 Slow processors
 Small display screens.

Operating System Concepts 1.31 Silberschatz, Galvin and Gagne


Operating System Services
 Another set of OS functions exists for ensuring the efficient
operation of the system itself via resource sharing
 Resource allocation - When multiple users or multiple jobs
running concurrently, resources must be allocated to each
of them
 Many types of resources - Some (such as CPU
cycles,mainmemory, and file storage) may have special
allocation code, others (such as I/O devices) may have
general request and release code.
 Accounting - To keep track of which users use how much and
what kinds of computer resources
 Protection and security - The owners of information stored in
a multiuser or networked computer system may want to
control use of that information, concurrent processes should
not interfere with each other
 Protection involves ensuring that all access to system
resources is controlled
 Security of the system from outsiders requires user
authentication, extends to defending external I/O devices
from invalid access attempts

Operating System Concepts 1.32 Silberschatz, Galvin and Gagne


Operating System Services
 Operating systems provide an environment for execution
of programs and services to programs and users
 One set of operating-system services provides functions
that are helpful to the user:
 User interface - Almost all operating systems have a
user interface (UI).
 Varies between Command-Line (CLI), Graphics
User Interface (GUI), Batch
 Program execution - The system must be able to load
a program into memory and to run that program, end
execution, either normally or abnormally (indicating
error)
 I/O operations - A running program may require I/O,
which may involve a file or an I/O device

Operating System Concepts 1.33 Silberschatz, Galvin and Gagne


Operating System Services (Cont.)
 One set of operating-system services provides functions that
are helpful to the user (Cont.):
 File-system manipulation - The file system is of particular
interest. Programs need to read and write files and
directories, create and delete them, search them, list file
Information, permission management.
 Communications – Processes may exchange information,
on the same computer or between computers over a
network
 Communications may be via shared memory or through
message passing (packets moved by the OS)
 Error detection – OS needs to be constantly aware of
possible errors
 May occur in the CPU and memory hardware, in I/O
devices, in user program
 For each type of error, OS should take the appropriate
action to ensure correct and consistent computing
 Debugging facilities can greatly enhance the user’s and
programmer’s abilities to efficiently use the system

Operating System Concepts 1.34 Silberschatz, Galvin and Gagne


A View of Operating System
Services

Operating System Concepts 1.35 Silberschatz, Galvin and Gagne


System Calls
 Programming interface to the services provided by
the OS
 Typically written in a high-level language (C or C++)
 Mostly accessed by programs via a high-level
Application Program Interface (API) rather than direct
system call use
 Three most common APIs are Win32 API for Windows,
POSIX API for POSIX-based systems (including
virtually all versions of UNIX, Linux, and Mac OS X),
and Java API for the Java virtual machine (JVM)

Operating System Concepts 1.36 Silberschatz, Galvin and Gagne


Example of System Calls
 System call sequence to copy the contents of one file
to another file

Operating System Concepts 1.37 Silberschatz, Galvin and Gagne


API – System Call – OS
Relationship

Operating System Concepts 1.38 Silberschatz, Galvin and Gagne


Types of System Calls
 File management
 create file, delete file
 open, close file
 read, write, reposition
 get and set file attributes
 Device management
 request device, release device
 read, write, reposition
 get device attributes, set device
attributes
 logically attach or detach devices

Operating System Concepts 1.39 Silberschatz, Galvin and Gagne


Types of System Calls (Cont.)

 Information maintenance
 get time or date, set time or date
 get system data, set system data
 get and set process, file, or device attributes
 Communications
 create, delete communication connection
 send, receive messages if message passing
model to host name or process name
 From client to server
 Shared-memory model create and gain
access to memory regions
 transfer status information
 attach and detach remote devices

Operating System Concepts 1.40 Silberschatz, Galvin and Gagne


Types of System Calls (Cont.)

 Protection
 Control access to resources
 Get and set permissions
 Allow and deny user access

Operating System Concepts 1.41 Silberschatz, Galvin and Gagne


Examples of Windows and Unix System
Calls

Operating System Concepts 1.42 Silberschatz, Galvin and Gagne


Virtual Machines

 A virtual machine treats hardware and the


operating system kernel as though they were all
hardware.
 A virtual machine provides an interface identical
to the underlying bare hardware
 The operating system creates the illusion of
multiple processes, each executing on its own
processor with its own memory.

Operating System Concepts 1.43 Silberschatz, Galvin and Gagne


Virtual Machines (Cont.)

Non-virtual Machine Virtual Machine

(a) Nonvirtual machine (b) virtual


machine

Operating System Concepts 1.44 Silberschatz, Galvin and Gagne


Virtual Machines (Cont.)

 The virtual-machine concept provides complete


protection of system resources since each virtual
machine is isolated from all other virtual machines.
This isolation, however, permits no direct sharing of
resources.
 A virtual-machine system is a perfect vehicle for
operating-systems research and development. System
development is done on the virtual machine, instead of
on a physical machine and so does not disrupt normal
system operation.
 The virtual machine concept is difficult to implement
due to the effort required to provide an exact duplicate
to the underlying machine

Operating System Concepts 1.45 Silberschatz, Galvin and Gagne


VMware Architecture

Operating System Concepts 1.46 Silberschatz, Galvin and Gagne


The Java Virtual Machine

Operating System Concepts 1.47 Silberschatz, Galvin and Gagne


Operating System Design and
Implementation

 Design and Implementation of OS not “solvable”, but


some approaches have proven successful
 Internal structure of different Operating Systems can
vary widely
 Start by defining goals and specifications
 Affected by choice of hardware, type of system
 User goals and System goals
 User goals – operating system should be
convenient to use, easy to learn, reliable, safe, and
fast
 System goals – operating system should be easy to
design, implement, and maintain, as well as
flexible, reliable, error-free, and efficient

Operating System Concepts 1.48 Silberschatz, Galvin and Gagne


Operating System Design and Implementation
(Cont.)

 Important principle to separate


Policy: What will be done?
Mechanism: How to do it?
 Mechanisms determine how to do something, policies
decide what will be done
 The separation of policy from mechanism is a very
important principle, it allows maximum flexibility if
policy decisions are to be changed later

Operating System Concepts 1.49 Silberschatz, Galvin and Gagne


Simple Structure
 MS-DOS – written to provide the most functionality in
the least space
 Not divided into modules
 Although MS-DOS has some structure, its
interfaces and levels of functionality are not well
separated

Operating System Concepts 1.50 Silberschatz, Galvin and Gagne


MS-DOS Layer Structure

Operating System Concepts 1.51 Silberschatz, Galvin and Gagne


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.
 With modularity, layers are selected such that each
uses functions (operations) and services of only
lower-level layers

Operating System Concepts 1.52 Silberschatz, Galvin and Gagne


Layered Operating System

Operating System Concepts 1.53 Silberschatz, Galvin and Gagne


Microkernel
Microkernel is a software or code which contains the
required minimum amount of functions, data, and features to
implement an operating system. It provides a minimal
number of mechanisms, which is good enough to run the
most basic functions of an operating system. Microkernels
and their user environments are usually implemented in the
C++ or C programming languages with a little bit of
assembly. However, other implementation languages are
possible with some high-level coding.

Operating System Concepts 1.54 Silberschatz, Galvin and Gagne

You might also like