Some OS and Networking Concepts - PowerPoint PPT Presentation

1 / 12
About This Presentation
Title:

Some OS and Networking Concepts

Description:

Internal processor characteristics like pipelining (concurrent execution of ... Memory still a scarce commodity for embedded devices: PDAs, watches... – PowerPoint PPT presentation

Number of Views:41
Avg rating:3.0/5.0
Slides: 13
Provided by: tomreic
Category:

less

Transcript and Presenter's Notes

Title: Some OS and Networking Concepts


1
Some OS and Networking Concepts
2
Processor speeds
  • Processor speeds (e.g. 2.6Ghz) are clock speeds
  • An instruction consumes multiple clocks
  • Different instructions take different of clock
    cycles
  • Internal processor characteristics like
    pipelining (concurrent execution of instructions)
    make it even more difficult to just add up
    instruction exec times
  • A simple way to get a rough estimate is to create
    a benchmark that has several thousand lines of
    executable code, and compute an average time per
    line of code
  • Obviously a rather crude approximation
  • Could easily be off by a factor of 2 or more

3
Virtual Memory and caches
  • There are different types of memory with
    different access speeds
  • Onboard high-speed memory has nanosec access
    times
  • Matches speed of processor
  • RAM has microsecond access times (1000 times
    slower)
  • Multiple levels of caches in-between to bridge
    gap
  • Caches store frequently/recently used data
    temporarily for quick access
  • Like having multiple phone number/address lists
    city phonebook / websites, home computer, PDA,
    scribble on paper
  • One more level beyond RAM hard disk, with
    millisecond access
  • Program and data reside actually on disk, brought
    into memory and caches on need, written back out
    when space needed for something else
  • Note that changes need to be propagated to lower
    levels
  • Two design patterns write-through (immediate
    propagation to next level) write-back (wait
    till you are down and then make all changes)
  • Time taken for memory access varies depending on
    how deep you have to go
  • If same program is run again, time may vary
    because of cache differences

4
Processor registers
L1 cache (instruction, data) (few KB, lt 10ns)
L2 cache (instruction, data) (several KB, 100ns
access)
Copy out when done
Pull in on demand
(or propagate changes)
RAM (several MB, 1us access)
page3
page2
page6
page6
page8
page7
Pull in on demand
Copy out when done
Disk (several GB, 1-10ms access)
User Program
User Program
5
Program memory
  • Code space the executable code
  • Data space Globals, constants, statics
  • Heap space Dynamic memory allocation
  • Stack space Contains stack frames
  • Each procedure call pushes another frame on stack
  • Frame contains (space for) return address,
    parameters, local variables etc., as well as
    pointer to previous frame
  • Can calculate memory budgets based on design
  • Estimate LOC -gt code space
  • Estimate total space needed for globals and
    statics
  • Constants typically directly related to code size
    (estimate from history)
  • Expected number of dynamically allocated objects
    and sizes -gt heap
  • Stack depends on nesting depth of proc calls and
    size of local variables
  • Memory still a scarce commodity for embedded
    devices PDAs, watches

6
Tasks
  • Units of execution Includes code, data space,
    execution state, system resources file handles,
    network ports
  • Two basic models, but actually a includes
    spectrum of possibilities in-between
  • Processes Each process conceptually has its own
    copy of code, data, execution state and system
    resources
  • Threads Conceptually, each thread has a separate
    execution state (line of control flow), but
    separate copies of all resources

7
Process1
Process2
Process3
Threads
Thread state
Memory
Memory
Memory
File handles
File handles
File handles
Socket handles
Socket handles
Socket handles
SharedMemory
Ports
Network
Files
8
Context Switching
  • Processors run multiple threads / processes
    concurrently
  • CPU runs one process/thread for a while, then
    another
  • Different from parallelism multiple CPUs run
    several tasks simultaneously
  • Switch between threads/processes when they get
    blocked
  • Waiting for user to enter data, messages to
    arrive, resources to free up
  • Blocked waiting on disk read to complete (disks
    much slower)
  • Also switch if a thread/process runs for too long
  • Otherwise if you are running a long
    compute-intensive program, others using same
    machine will just keep waiting
  • Context switch Time taken to switch from one
    process/thread to another
  • Involves saving/restoring registers state info,
    switching VM page tables etc.
  • Thread context switch times are usually less than
    process context switch times
  • Because threads share memory and other resources
    less changes needed
  • Typical context switch times 10-100 microseconds

9
Scheduling
  • Deciding which task (process/thread) to run next
  • Two common schemes (there are many others)
  • Priority scheduling Task with lower priorities
    only get to run if when all higher priority
    tasks blocked
  • Round-robin Tasks take turns using processor,
    pulled off processor if when their quota (time
    slice) expires, wait for next turn
  • Most common scheme is priority, with round-robin
    among same priority
  • A pre-emptive priority scheme is one where the
    currently executing task is instantly pulled off
    processor if higher priority task arrives
  • Needed in real-time applications to avoid
    priority inversion having higher priority
    task waiting on lower priority task
  • Scheduling affects how long tasks wait before
    they get to run
  • Needed for computing response times

10
Network concepts
  • A network has
  • A physical connection medium e.g. fiber-optic
    wire
  • Characteristics bandwidth, transmission speed
  • An access approach
  • e.g. token ring (each node takes turns
    transmitting)
  • contention (nodes transmit when they like and
    look for conflicts
  • Characteristics average transmission delay,
    effective bandwidth, load behavior (e.g.
    contention behaves poorly at high loads)
  • Protocols for transmitting data
  • Message exchange sequences that coordinate
    transmission parameters, and ensure packets reach
    reliably (through acknowledgements)
  • Characteristics reliability of transmission,
    packet sizes, networking overhead (some of the
    packets/space devoted to protocol stuff)

11
Networking concepts (contd)
  • Approaches to handling networking concerns flow
    control, routing
  • Characteristics End-to-end delays, fault
    tolerance
  • Data processing Breaking up and recombining
    packets, (possibly) encryption and compression
  • Characteristics Processing time, networking
    overhead
  • Networking involves multiple hardware/software
    layers
  • ISO-OSI 7-layer conceptual model of network
    layers

12
TCP/IP, Sockets and Ports
  • A combination of two protocols TCP and IP
  • Provides reliable end-to-end transmission
  • A port is a logical address on a node. Program
    associate themselves with ports for input/output
  • A socket is a program-level data structure for
    accessing a port, like file handles
  • Higher-level concepts like RMI are built on top
    of TCP/IP
  • TCP/IP (and most other protocols, but not all)
    provide a byte-stream view of what is being sent
    received
Write a Comment
User Comments (0)
About PowerShow.com