Week - 1 to 4 - 6th Semester Notes

advertisement
Miss Maheen Sadiq
Under the guideline of
Sir Syed Rizwan-ul-Hasan
Assistant Professor
CED, SSUET
Introduction (Week 1)
What is Operating System?
 An operating system is a layer of software which takes care of
technical aspects of a computer's operation.
 Examples: Windows, Linux, Unix and Mac OS, etc.,
Function of Operating System
 Resource management
-Time management (CPU and Disk Scheduling)
-Space management(main and secondary storages)
-Process synchronization and deadlock handling.
-Accounting and status information
 User friendliness
-Execution environment
-Error detection and handling
-Protection and security
-Fault tolerance and failure recovery
Types of Advanced Operating System
 It can be categorized on the following basis of
- Architecture Driven
• A variety of high speed architecture
• Extremely fast parallel
• Offers great potential for speed up
Distributed Operating Systems
Multiprocessor Operating Systems
-
Application Driven
• Require special operating system support as a requirement as well as
for efficiency.
Database Operating Systems
Real-time Operating Systems
Types of Advanced Operating System
Advanced Operating Systems
Architecture Driven
Distributed
Systems
Multiprocessor
systems
Application Driven
Database Systems
Real-time
Systems
Distributed Systems
 They are for network of autonomous computers connected by a
communication network.
 It controls and manages the h/wand s/w resources of a DS such
that its users view the entire system as a power full monolithic
computer system.
 However, design is much more complex due to the lack of both
shared memory and common clock and unpredictable
communication delays.
 Basic issues are same as traditional OS
• Advantages of DS
– Resources Sharing
– Computation speed up – load sharing
– Reliability
– Communications
Multiprocessor Operating System
 Consists of a set of processors that
 share a set of physical memory blocks
 share a common clock
 "share" over an interconnection network.
 Control and manage resources
 hardware and software resources
 viewed as a uniprocessor system.
 Design issues same as traditional system.
 Practical issues:
 increased complexity of synchronization, scheduling, memory
management, protection and security.
Database Operating System
 Database systems place increased demands on an operating
system to efficiently support:
 concept of a transactions
 manage large volumes of data
 concurrency control
 system failure control
 Should also have buffer management schemes for data
retrieval and storage from secondary storage
 Concurrency control is one of the most challenging
problems in the design of database operating systems
Real-time Operating Systems
 Systems where jobs have completion deadlines
 In soft real-time systems, jobs should be completed before its
deadline to be of use
 In hard real-time systems, jobs should be completed before its
deadline to avert a disaster
 Jobs should be scheduled in such a way that a maximum
number of jobs satisfy their deadlines
 Requirements can vary from application to application
 Network Operating System
 A network operating system (NOS) is a computer operating
system that is designed primarily to support workstation,
personal computer, and, in some instances, older terminal
that are connected on a local area network (LAN).
 A network operating system provides printer sharing,
common file system and database sharing, application
sharing, and the ability to manage a network name directory,
security, and other housekeeping aspects of a network.
Architecture of Distributed
System (Week 2)
Architecture of Distributed System
 A distributed system is a collection of autonomous computers
which do not share memory or a clock
 Computers communicate with each other by exchanging
messages over a communication network
 Each computer has its own memory and runs its own OS
 Resources owned and controlled by a computer are said to be
local to it
 Resources owned and controlled by other computers are said to
be remote
Architecture of Distributed System
 Accessing remote resources is more expensive because of
communication delays
 Motive is to convert low cost microprocessors to single
powerful system
 Advantages
 Resource sharing
 Hardware and software resources can be shared
 Printer, Compiler, Text Editors, Databases, etc.
 Enhanced performance
 Rapid response time
 Higher system throughput
 Many tasks can be concurrently executed at different
computers
 Distributed system can employ load distribution techniques
 Tasks at heavily loaded systems are transferred to lightly
loaded computers
 Waiting time of a task can be reduced
 Improved reliability and availability
 Few components of the system can fail without affecting the
availability
 System can be made fault tolerant through replication of data
and services
 Data can be files and directories and services can be the
processes that
 provide functionality
 Modular expandability
 New hardware and software can be easily added without
replacing the existing system
 Disadvantages




Complexity
Security
Manageability
Unpredictability
Architecture of Distributed System
CPU
CPU
Disk
Memory
Memory
Communication
Network
CPU
CPU
Disk
Disk
Memory
CPU
Memory
Memory
 Architecture types
DS can be classified into three broad categories:
 Minicomputer model
 Workstation model
 Processor pool model
Minicomputer Model
 DS consists of several minicomputers
 e.g. VAX processors
 Each machine supports multiple users and share resources
 Ratio between no. of processors to no. of users is usually
less than one
Workstation Model
 Consists of several workstations ( up to several thousands)
 Each user has a workstation at his disposal, which consist
of powerful processor, memory and display
 With the help of DFS, users can access data regardless of
its location
 Ratio between no. of processors to no. of users is usually 1
 e.g. SSUET WS1 (Workstation1) and user1
Processor Pool Model
 Ratio between processor to no. of users is normally greater
than 1
 This model allocates one or more processors according to
users’ need
 Once the processors complete their jobs, they return to the
pool and await a new assignment
 Amoeba is a combination of the processor pool model and
workstation model
 Issues in Distributed Operating System
Important Issues in the design of a distributed operating
system









Global knowledge
Naming
Scalability
Compatibility
Process Synchronization
Resource Management
Security
Structuring
Client-Server Computing Model
 Global Knowledge
 In case of shared memory systems ,up-to date state of all
processes and resources of the system is completely known
 Whereas in distributed system it is much complex
 Up-to date state of all processes and resources can not be
known because of absence of shared memory and clock and
unexpected delays
 Fundamental problems in the design of DOS is to determine
efficient technique to implement decentralized system wide
control
 Another problem is to how to order all the events that occur
on different times at different computers in the absence of
global clock
 Naming
• Names are used to refer to objects
• Computers, printers, services, files and users
• Eg. Name service maps a logical name into a physical
address, by using table lookup or by algorithm
• If an algorithm is used for mapping, the algorithm would
depend upon the structure of the names
• Another issues in naming is the method of naming objects
such that an object can be located irrespective of its logical
name
 Scalability
• Systems generally grow with time
• Design should be such that system should not result in
system unavailability or degraded performance when
growth occurs
 E.g. broadcast based protocols work well for small systems
but not for large systems
 Distributed File System
 Compatibility
• Refers to the interoperability among the resources in a system
• There are three levels of compatibility in DS
• Binary Level: all processes execute the same instruction set
even though the processors may differ in performance and in
input-output
• E.g. Emerald distributed system
• Program development is easy
• DS cannot include computers with different architectures
• Rarely supported in large distributed systems
 Process Synchronization
• Process synchronization is difficult because of unavailability of
•
•
•
•
•
shared memory
DOS has to synchronize process running at different computers
when they try to concurrently access shared resources
Mutual exclusion problem
Request must be serialized to secure the integrity of the shared
resources
In DS, process can request resources (local or remote) and
release resources in any order
If the sequence of the resource allocation is not controlled,
deadlock may occur which can lead to decrease in system
performance
 Resource Management
• Concerned with making both local and remote resources
available to users in an effective manner
• Users should be able to access remote resources as easily as they
can access local resources
• Specific location of resources should be hidden from users in the
following ways:
 Data Migration
 Computation Migration and
 Distributed scheduling
 Data Migration
• Data can either be file or contents of physical memory
• In process of data migration, data is brought to the location of
•
•
•
•
•
the computation that needs access to it by the DOS
If computation updates a set of data, original location may have
to be updated
In case of file DFS is involved
DFS is a component of DOS that implements a common file
system available to the autonomous computers in the system
Primary goal is to provide same functional capability to access
files regardless of their location
If the data accessed is in the physical memory of another system
then a computation’s data request is handled by distributed
shared memory
 Computation Migration
• In computation migration, computation migrates to another
location
• It may be efficient when information is needed concerning a
remote file directory
• it is more efficient to send the message and receive the
information back, instead of transferring the whole directory
• Remote procedural call has been commonly used for
computation migration
• Only a part of computation of a process is normally carried out
on a different machine
 Security
 OS is responsible for the security of the computer system
 Two issues must be considered:
 Authentication: process of guaranteeing that an entity is what
it claims to be
 Authorization: process of deciding what privileges an entity
has and making only these privileges available
Communications Network
(Week 3)
 Communication Networks

Computers in a DS are interconnected through a computer
communication network

Computer can exchange messages with other computers and
access data stored at another computer through this network

Layered protocols are commonly used for communication
purpose
 Wide-Area Networks
• WANs consist of switches that are usually interconnected by communication
links.
• Data is transferred b/w computers through a series of switches called pointto-point.
• A path may become congested due to heavy data communication through
path or limited bandwidth.
• The data can be lost due to switch crashes, communication link failure,
limited buffer capacity at switch, transmission error, etc
 Packet Switching Vs. Circuit Switching
 Circuit Switching:



A dedicated path is established b/w two devices wishing to
communicate, and the path remains intact for the entire
transmission.
The telephone system uses circuit switching.
The path is broken when one side terminate the connection.
• Packet Switching:




A connection is established be/w the source device and its
nearest switch.
These packets are routes from one switch to another until
they arrive at the switch connected to the destination device.
Parallel transmission possible.
The breaking of a message into packets & assembling them
back at the destination carries some cost.
Layered Protocols
ISO OSI Reference Model
 The OSI Model
• A widely accepted structuring technique is layering
• The communications functions are partitioned into a hierarchical
set of layers
• Each layer performs a related subset of the functions required to
communicate with another system
• The resulting OSI architecture has seven layers

Physical layer:

The physical layer is responsible for handling both
the mechanical and electrical details of the physical
transmission of a bit stream

This layer is implemented in the hardware of the
network device.

Network layer:

The network layer is responsible for providing connections
and for routing packets in the communication network

includes handling the address of outgoing packets, decoding
the address of incoming packets, and maintaining routing
information for proper response to changing load levels.

Transport layer:

The transport layer is responsible for two level accesses to
the network and for transfer of messages between the
clients

includes partitioning the messages into packets, maintaining
packet order, controlling flow, and generating physical
addresses

Session layer:

Session layer is responsible for implementing sessions, or
process to process communications protocols

Typically these protocols are the actual communications for
remote logins and for file and mail transfers.

Presentation layer:

Presentation layer performs transformations on data to
provide a standardization application interface and provide
common communications services;

examples encryption, text compression, reformatting

Application layer:

The application layer is responsible for interacting directly
with the users

This layer deals with file transfer, remote login protocol,
and electronic mail.
 Local-Area Networks
• LAN is a communication network that interconnects a variety of
data communication devices with in a small graphical area.
• High data transmission rate 10MB to100MB per second.
• The graphical scope is small & for single building.
• Low transmission error.
 CSMA/CD Protocol
 Most commonly used access control protocol for bus topology.
 A device wishing to transmit listen to the medium to determine




whether another transmission is in progress.
The advantage of this protocol is simplicity.
The disadvantage is under a heavy load, contention for the bus
rises and performance degrades because of frequent collision.
It cannot support a large number of devices per bus.
Example: Ethernet
 Token Bus Protocol
• Devices physically organized in a tree/bus topology form a logical
ring, each device knows the identity of the devices proceeding and
the following it on the ring.
• Access to the bus is controlled through a token.
• The device holding the token its allowed to transmit.
• A device is allowed to keep the to keep the token for a specific
amount of duration.
 Ring Topology
• The ring topology is much like the bus in that each workstation
and file server is attached to a central cable
• the workstations and file server are connected together to form a
ring
• The workstations and file servers take turns passing information
from one to another until the information reaches its final
destination
 Communication Primitives
• Communication primitives are the high level construct with
which programs uses the underlying communication network.
• The designer of a communication network must address four
basic issues:
• Naming and Name Resolution: How do two processes locate
each other to communicate?
• Routing Strategies: How are messages sent through the
network?
• Packet Strategies: Are packets sent individually or as a
sequence?
• Connection Strategies: How do two processes send a
sequence of messages?
• Contention: The network is a shared resource, so how do we
resolve conflicting demands for its use?
 Message Passing Model
• Has two basic communication primitives, namely SEND and
•
•
•
•
RECEIVE.
SEND primitive has two parameters, a message and its destination.
RECEIVE primitive has two parameters, the source of the message
and buffer for storing the message
An application of these primitives can be found in the client-server
computational model.
A client process needing some service sends a message to the server
and waits for a reply message.
 Blocking Vs. Non Blocking Primitive
 Non Blocking Primitives:
•
•
•
•
The SEND primitive returns control to the user process as soon as the
message is copied from the user buffer onto the kernel buffer.
The corresponding RECEIVE primitive signals its intention to receive a
message and provides a buffer to copy for the arrival of a message.
Program have maximum flexibility to perform computation and
communication in any order they want
Programming becomes tricky and difficult.
 Blocking Primitives
•
•
•
•
The SEND primitive does not return control to the user program until the
message has been sent or until an acknowledgement has been received
RECEIVE primitive does not return control until a message is copied to the
user buffer.
Behavior of the programs predictable & programming is relatively easy.
The lack of flexibility in programming & the absence of concurrency b/w
computation and communication.
 Synchronization Vs. A synchronization Primitives
 Synchronization :
•
•
SEND primitives is blocked until a corresponding RECEIVE primitive is
executed at the receiving computer
This strategy is also referred to as a rendezvous.
 A synchronization
•
•
•
SEND primitive does not block even if there is no corresponding
execution of a RECEIVER primitive.
The corresponding RECEIVE primitive can either be a blocking or a no
blocking primitive.
Buffering message is more complex.
Communication: remote
Procedure Calls
(Week:4)
 Remote Procedural Call
 A More natural way to communicate is through Procedural call:
 every language supports it .
 semantics are well defined and understood .
 natural for programmers to use.
 Programmer Using such a model must handle the following
details:
 Pairing of responses with request messages.
 Data representation.
 Knowing the address of remote machine on the server
 Taking care of communication and system failure
RPC
 Basic RPC Operation
• The RPC Mechanism is based on the observation that a procedural call
•
•
•
•
•
•
is well known for transfer of control and data with in a program running
an a single machine.
On invoking a remote procedure, the calling process is suspended.
If any parameter are passed to the remote machine where the procedure
will execute.
On completion, the result are passed back from server to client and
resuming execution as if it had called a local procedure.
RPC mechanism is based on the concept of stub procedures.
The server writer writes the server and links it with the server-side
stubs; the client writes her program and links it with the client-side
stub.
The stubs are responsible for managing all details of the remote
communication between client and server.
 Design Issues in RPC
• RPC mechanism is based on the concept of stub procedures.
• The server writer writes the server and links it with the
server-side stubs; the client writes her program and links it
with the client-side stub.
• The stubs are responsible for managing all details of the
remote communication between client and server.
 Design Issues
 Binding
• Binding is process that determines the remote procedure, and the
machine on which it will be executed.
• It may also check the compatibility of parameters passed and
procedure type called.
• Binding server essentially store the server machine along with the
services they provide.
• Another approach used for binding is where the client specifies the
machine and the service required and the binding server returns the
port number for communication.
Parameter and Result
Download