network organization

Upload: ermercado78

Post on 14-Apr-2018

217 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 Network Organization

    1/63

    Introduction The operating system layer

    Protection

    Processes and Threads

    Communication and invocation

    Operating system architecture Summary

    Operating System Support

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    2/63

    Network Operating System (1)

    General structure of a network operating system.

    1-19

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    3/63

    Network Operating System (2) rlogin machine

    rcp machine1:file1 machine2:file2

    A better approach

    (in terms of convenience and sharing):

    client server approach, shared global file

    server

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    4/63

    Network Operating System (3)

    Different clients may mount the servers in different places.

    1.21

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    5/63

    Distributed Operating Systems

    But no longer have shared memory

    Provide message passing

    Can try to provide distributed shared memory But tough to get acceptable performance

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    6/63

    Middleware and the Operating System

    What is a distributed OS?

    Presents users (and applications) with an

    integrated computing platform that hides the

    individual computers.

    Has control over all of the nodes (computers) inthe network and allocates their resources to

    tasks without user involvement.

    In a distributed OS, the user doesn't know

    (or care) where his programs are running. Examples:

    Cluster computer systems

    V system, SpritePrinciples of Operating Systems

  • 7/30/2019 Network Organization

    7/63

    No distributed OS in general useUsers have much invested in their application

    software

    Users tend to prefer to have a degree ofautonomy

    for their machines

    Network OS provides autonomy

    Middleware provides network-transparent access

    resource

    Combination of middleware and network OS

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    8/63

    Introduction The operating system layer

    Protection

    Processes and Threads

    Communication and invocation

    Operating system architecture Summary

    Chapter 5: Operating System Support

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    9/63

    Operating SystemTasks: processing, storage and communication

    Components: kernel, library, user-level services

    Middlewareruns on a variety of OS-hardware combinations

    remote invocations

    Architecture

    The relationship between OS and Middleware

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    10/63

    Encapsulation provide a set of operations that meet their clients needs

    Protectionprotect resource from illegitimate access

    Concurrent processing support clients access resource concurrently

    Invocation mechanism: a means of accessing

    an encapsulated resourceCommunication

    Pass operation parameters and results between resource managers

    Scheduling

    Schedule the processing of the invoked operation

    Functions that OS should provide for middleware

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    11/63

    Process manager

    Handles the creation of and operations upon processes. Thread manager

    Thread creation, synchronization and scheduling

    Communication manager

    Communication between threads attached to differentprocesses on the same computer

    Memory manager Management of physical and virtual memory

    Supervisor Dispatching of interrupts, system call traps and otherexceptions

    control of memory management unit and hardware caches

    processor and floating point unit register manipulations

    Figure

    The core OS components

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    12/63

    Positioning Middleware

    Network OSs are not transparent.

    Distributed OSs are not independent ofcomputers.

    Middleware can help.

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    13/63

    Middleware

    What is middleware?

    What is its function?

    Where is it located?

    Why does it exist?

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    14/63

    Positioning Middleware

    General structure of a distributed system as middleware.

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    15/63

    Figure 2.1

    Software and hardware service

    layers in distributed systems

    Applications, serv ices

    Computer and network hardware

    Platf orm

    Operating system

    Middleware

    Principles of OperatingSystems

  • 7/30/2019 Network Organization

    16/63

    Middleware and Openness

    In an open middleware-based distributed system, the protocols used byeach middleware layer should be the same, as well as the interfaces theyoffer to applications.

    Why should they be open? Why should they not be open?

    1.23

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    17/63

    Typical Middleware Services

    Communication

    Naming

    Persistence

    Distributed transactions

    Security

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    18/63

    Middleware Models

    Distributed files Examples?

    Remote procedure call

    Examples?

    Distributed objects Examples?

    Distributed documents

    Examples? Others?

    Message-oriented middleware (MOM)

    Service oriented architecture (SOA)

    Document-oriented

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    19/63

    Middleware and the Operating System

    Middleware implements abstractions that support network-wide programming. Examples:

    RPC and RMI (Sun RPC, Corba, Java RMI)

    event distribution and filtering (Corba Event Notification, Elvin)

    resource discovery for mobile and ubiquitous computing support for multimedia streaming

    Traditional OS's (e.g. early Unix, Windows 3.0) simplify, protect and optimize the use of local resources

    Network OS's (e.g. Mach, modern UNIX, Windows NT)

    do the same but theyalso support a wide range of communicationstandards and enable remote processes to access (some) local resources

    (e.g. files).

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    20/63

    DOS vs. NOS vs. Middleware

    Discussion What is good/bad about DOS?

    Transparency

    Other issues have reduced success.

    Problems are often socio-technological.

    What is good/bad about NOS? Simple.

    Decoupled, easy to add/remove.

    Lack of transparency. What is good/bad about middleware?

    Easy to make multiplatform.

    Easy to start something new. But this can also be bad.

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    21/63

    Types of Distributed OSs

    System Description Main Goal

    DOS

    Tightly-coupled operating system for multi-

    processors and homogeneousmulticomputers

    Hide and manage

    hardwareresources

    NOSLoosely-coupled operating system forheterogeneous multicomputers (LAN andWAN)

    Offer localservices to remoteclients

    MiddlewareAdditional layer atop of NOS implementinggeneral-purpose services

    Provide

    distributiontransparency

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    22/63

    Introduction The operating system layer

    Protection

    Processes and Threads

    Communication and invocation

    Operating system architecture Summary

    Chapter 5: Operating System Support

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    23/63

    Maliciously contrived code Benign code

    contains a bug

    have unanticipated behavior

    Example: readand writein File System

    Illegal uservs. access right control

    Access the file pointer variable directly

    (setFilePointerRandomly) vs. type-safe language Typesafe language, e.g. Java or Modula-3

    Non-type-safe language, e.g. C or C++

    Illegitimate access

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    24/63

  • 7/30/2019 Network Organization

    25/63

    The System Clock

    system clock frequency

    clock period(One full period is also called a clock cycle )

    "Hertz" (Hz) meaning one cycle per second10 MHz : 100 nanoseconds

    1GHz: 1 nanoseconds Principles of Operating Systems

  • 7/30/2019 Network Organization

    26/63

    Introduction The operating system layer

    Protection

    Processes and Threads

    Communication and invocation

    Operating system architecture Summary

    Chapter 5: Operating System Support

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    27/63

    Operation system concepts

    (six edition)

    Abraham Silberschats,

    Peter Baer Galvin,

    Greg Gagne Chapter 4 Processes

    Chapter 5 Threads

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    28/63

    Single and Multithreaded Processes

    Heavyweight process lightweight processPrinciples of Operating Systems

  • 7/30/2019 Network Organization

    29/63

    Process

    A program in execution Problem: sharing between related activities are awkward and

    expensive

    Nowadays, a process consists of an execution environment

    together with one or more threads an analogy at page 215

    Thread Abstraction of a single activity

    Benefits Responsiveness

    Resource sharing

    Economy

    Utilization of MP architectures

    Process and thread

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    30/63

    the unit of resource management

    Consist of An address space

    Thread synchronization and communication resources such

    as semaphores and communication interfaces (e.g. sockets) Higher-level resources such as open files and windows

    Shared by threads within a process

    Execution environment

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    31/63

  • 7/30/2019 Network Organization

    32/63

    The number of regions is indefinite

    Support a separate stack for each thread

    access mapped file

    Share memory between processes

    Region can be shared

    Libraries

    Kernel

    Shared data and communication

    Copy-on-write

    Address space continued

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    33/63

    Creating process by the operation

    system

    Fork, exec in UNIX

    Process creation in distributed systemThe choice of a target host

    The creation of an execution environment, an initial

    thread

    Creation of new process in distributed system

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    34/63

    Choice of process host

    running new processes at their originators computer sharing processing load between a set of computers

    Load sharing policy

    Transferpolicy: situate a new process locally or remotely?

    Location policy: which node should host the new process? Static policy without regard to the current state of the system

    Adaptive policy applies heuristics to make their allocation decision

    Migration policy: when&where should migrate the running

    process? Load sharing system

    Centralized

    Hierarchical

    Decentralized

    Choice of process host

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    35/63

    Initializing the address space

    Statically defined format

    With respect to an existing execution environment,

    e.g.fork

    Copy-on-writescheme

    Creation of a new execution environment

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    36/63

    Process

    Thread activations

    Activation stacks

    (parameters, local variables)

    Threads concept and implementation

    'text' (program code)Heap (dynamic storage,

    objects, global variables)

    system-provided resources

    (sockets, windows, open files)

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    37/63

    Client and server with threads

    Client

    Thread 2 makes

    Thread 1

    requests to server

    generates

    results

    Server

    N threads

    Input-output

    Requests

    Receipt &queuing

    *

    The 'worker pool' architecture

    Principles of Operating Systems

    Alt ti th di hit t

  • 7/30/2019 Network Organization

    38/63

    Alternative server threading architectures

    a. Thread-per-request b. Thread-per-connection c. Thread-per-object

    remote

    workers

    I/O

    objects

    server

    process

    remote

    per-connection threads

    objects

    server

    process

    remoteI/O

    per-object threads

    objects

    server

    process

    (a) would be useful for UDP-based service, e.g. NTP

    (b) is the most commonly used - matches the TCP connection model

    (c) is used where the service is encapsulated as an object. E.g. could have

    multiple shared whiteboards with one thread each. Each object has only

    one thread, avoiding the need for thread synchronization within objects.

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    39/63

    Threads implementation

  • 7/30/2019 Network Organization

    40/63

    Threads implementation

    Threads can be implemented:

    in the OS kernel (Win NT, Solaris, Mach) at user level (e.g. by a thread library: C threads,

    pthreads), or in the language (Ada, Java).

    + lightweight - no system calls

    + modifiable scheduler

    + low cost enables more threads to be employed

    - not pre-emptive

    - can exploit multiple processors

    - - page fault blocks all threads

    hybrid approaches can gain some advantages of both user-level hints to kernel scheduler

    hierarchic threads (Solaris 2)

    event-based (SPIN, FastThreads)

    *Principles of Operating Systems

  • 7/30/2019 Network Organization

    41/63

    Introduction

    The operating system layer

    Protection

    Processes and Threads

    Communication and invocation

    Operating system architecture Summary

    Chapter 5: Operating System Support

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    42/63

  • 7/30/2019 Network Organization

    43/63

    Invocation costs

    Different invocations

    The factors that matter synchronous/asynchronous, domain transition, communication

    across a network, thread scheduling and switching

    Invocation over the network Delay: the total RPC call time experienced by a client

    Latency: the fixed overhead of an RPC, measured by null

    RPC

    Throughput: the rate of data transfer between computers in asingle RPC

    An example

    Threshold: one extra packet to be sent, might be an extra

    acknowledge packet is needed

    Invocation performance

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    44/63

    The performance of RPC and RMI mechanisms is critical for effective

    distributed systems.

    Typical times for 'null procedure call':

    Local procedure call < 1 microseconds

    Remote procedure call ~ 10 milliseconds

    'network time' (involving about 100 bytes transferred, at 100 megabits/sec.)accounts for only .01 millisecond; the remaining delays must be in OS and

    middleware - latency, not communication time.

    Factors affecting RPC/RMI performance

    marshalling/unmarshalling + operation despatch at the server

    data copying:- application -> kernel space -> communication buffers

    thread scheduling and context switching:- including kernel entry

    protocol processing:- for each protocol layer

    network access delays:- connection setup, network latency

    10,000 times slower!

    Support for communication and invocation

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    45/63

    Memory sharing rapid communication between processes in the

    same computer

    Choice of protocol

    TCP/UDP E.g. Persistent connections: several invocations duringone

    OSs buffercollect several small messages andsend them together

    Invocation within a computer Most cross-address-space invocation take place

    within a computer

    LRPC (lightweight RPC)

    Improve the performance of RPC

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    46/63

    Performance characteristics of the Internet

    High latencies, low bandwidths and high server loads

    Network disconnection and reconnection.

    outweigh any benefits that the OS can provide

    Asynchronous operation Concurrent invocations

    E.g., the browser fetches multiple images in a home page by

    concurrent GETrequests

    Asynchronous invocation: non-blocking call

    E.g., CORBA oneway invocation: maybe semantics, or

    collect result by a separate call

    Asynchronous operation

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    47/63

    Persistent asynchronous invocations

    Designed fordisconnected operation

    Try indefinitely to perform the invocation, until it is

    known to have succeeded or failed, or until the

    application cancels the invocation QRPC (Queued RPC)

    Client queues outgoing invocation requests in a stable log

    Server queues invocation results

    The issues to programmers How user can continue while the results of

    invocations are still not known?

    Asynchronous operation continued

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    48/63

    Introduction

    The operating system layer

    Protection

    Processes and Threads

    Communication and invocation

    Operating system architecture Summary

    Chapter 5: Operating System Support

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    49/63

  • 7/30/2019 Network Organization

    50/63

  • 7/30/2019 Network Organization

    51/63

    S l

  • 7/30/2019 Network Organization

    52/63

    System layers

    Applica tions, serv ic es

    Computer &

    Platf orm

    Middleware

    OS: kernel,libraries &servers

    network hardware

    OS1

    Computer &network hardware

    Node 1 Node 2

    Processes, threads,communication, . ..

    OS2Processes, threads,communication, ...

    Figure 2.1

    Software and hardware service layers in distributed systems

    Applications, serv ices

    Computer and network hardware

    Platf orm

    Operating system

    Middleware

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    53/63

    P dd

  • 7/30/2019 Network Organization

    54/63

    Process address space

    Stack

    Text

    Heap

    Auxiliaryregions

    0

    2

    N

    Regions can be shared

    kernel code

    libraries

    shared data & communication

    copy-on-write

    Files can be mapped

    Mach, some versions of UNIX

    UNIX fork() is expensive

    must copy process's address space

    Principles of Operating Systems

  • 7/30/2019 Network Organization

    55/63

  • 7/30/2019 Network Organization

    56/63

    State associated with execution environments and threads

  • 7/30/2019 Network Organization

    57/63

    State associated with execution environments and threads

    Execution environment Thread

    Address space tables Saved processor registers

    Communication interfaces, open files Priority and execution state (such as

    BLOCKED)

    Semaphores, other synchronization

    objects

    Software interrupt handling information

    List of thread identifiers Execution environment identifier

    Pages of address space resident in memory; hardware cache entries

    Principles of Operating Systems

    Java Thread constructor and management methods

  • 7/30/2019 Network Organization

    58/63

    Java Threadconstructor and management methods

    Thread(ThreadGroup group, Runnable target, String name)

    Creates a new thread in the SUSPENDED state, which will belong togroup and be

    identified as name; the thread will execute the run() method oftarget.

    setPriority(int newPriority), getPriority()

    Set and return the threads priority.

    run()

    A thread executes the run() method of its target object, if it has one, and otherwise itsown run() method (ThreadimplementsRunnable).

    start()

    Change the state of the thread from SUSPENDED toRUNNABLE.

    sleep(int millisecs)

    Cause the thread to enter the SUSPENDED state for the specified time.

    yield()Enter theREADYstate and invoke the scheduler.

    destroy()

    Destroy the thread.

    Principles of Operating Systems

    I ti b t dd

  • 7/30/2019 Network Organization

    59/63

    Invocations between address spaces

    Control transfer via

    trap instruc tion

    User Kernel

    Thread

    User 1 User 2

    Control transfer via

    privileged instructions

    Thread 1 Thread 2

    Protection domain

    boundary

    (a) Sy stem c all

    (b) R PC/RMI (within one computer)

    Kernel

    (c) R PC/RMI (between computers)

    User 1 User 2

    Thread 1 Network Thread 2

    Kernel 2Kernel 1

    Principles of Operating Systems

    Delay of an RPC operation when returned data size varies

  • 7/30/2019 Network Organization

    60/63

    Delay of an RPC operation when returned data size varies

    1000 2000

    RPC delay

    Requested dat

    size (bytes)

    Packet

    size

    0

    Principles of Operating Systems

    A li ht i ht t d ll

  • 7/30/2019 Network Organization

    61/63

    A lightweight remote procedure call

    1. Copy args

    2. Trap to Kernel

    4. Execute procedureand copy results

    Client

    User stub

    Serv er

    Kernel

    stub

    3. Upcall 5. Return (trap)

    AA stack

    Principles of Operating Systems

    Times for serialized and concurrent invocations

  • 7/30/2019 Network Organization

    62/63

    Times for serialized and concurrent invocations

    Client Serv er

    execute request

    Send

    Receiv eunmarshal

    marshal

    Receiv eunmarshal

    process results

    marshalSend

    process args

    marshal

    Send

    process args

    transmission

    Receiv eunmarshal

    process results

    execute request

    Send

    Receiv eunmarshal

    marshal

    marshal

    Send

    process args

    marshalSend

    process args

    execute reques

    Send

    Receiv eunmarshal

    marshal

    execute reques

    Send

    Receiv eunmarshal

    marshalReceiv e

    unmarshalprocess results

    Receiv eunmarshal

    process results

    time

    Client Serv er

    Serialised inv ocations Concurrent inv ocations

    Principles of Operating Systems

    Monolithic kernel and Microkernel

  • 7/30/2019 Network Organization

    63/63

    Monolithic kernel and Microkernel

    Monolithic Kernel Microkernel

    Serv er: Dy namically loaded server program:Kernel code and data:

    .......

    .......

    Key:

    S4

    S1.......

    S1 S2 S3S2 S3 S4

    Middleware

    Language

    supportsubsystem

    Language

    supportsubsystem

    OS emulation

    subsystem....

    Microkernel

    Hardware

    The microkernel supports middleware via subsystems