SlideShare una empresa de Scribd logo
1 de 36
Descargar para leer sin conexión
I/O Management
    Software
    Chapter 5




                 1
Operating System Design
              Issues
• Efficiency
  – Most I/O devices slow compared to main memory
    (and the CPU)
     • Use of multiprogramming allows for some processes to be
       waiting on I/O while another process executes
     • Often I/O still cannot keep up with processor speed
     • Swapping may used to bring in additional Ready processes
        – More I/O operations

• Optimise I/O efficiency – especially Disk &
  Network I/O

                                                              2
Operating System Design
              Issues
• The quest for generality/uniformity:
  – Ideally, handle all I/O devices in the same way
     • Both in the OS and in user applications
  – Problem:
     • Diversity of I/O devices
     • Especially, different access methods (random access versus
       stream based) as well as vastly different data rates.
     • Generality often compromises efficiency!
  – Hide most of the details of device I/O in lower-level
    routines so that processes and upper levels see
    devices in general terms such as read, write, open,
    close.

                                                               3
I/O Software Layers




Layers of the I/O Software System

                                    4
Interrupt Handlers
•   Interrupt handlers
    –   Can execute at (almost) any time
        •   Raise (complex) concurrency issues in the kernel
        •   Can propagate to userspace (signals, upcalls), causing similar
            issues
        •   Generally structured so I/O operations block until interrupts
            notify them of completion
            –   kern/dev/lamebus/lhd.c




                                                                      5
Interrupt Handler Example
static int                                  lhd_iodone(struct lhd_softc *lh, int err)
lhd_io(struct device *d,                    {
        struct uio *uio)                            lh->lh_result = err;
{                                                   V(lh->lh_done);
...                                         }
 /* Loop over all the sectors
   * we were asked to do. */                void
 for (i=0; i<len; i++) {            INT     lhd_irq(void *vlh)
   /* Wait until nobody else                {
    * is using the device. */                ...
   P(lh->lh_clear);                          val = lhd_rdreg(lh, LHD_REG_STAT);
   ...
  /* Tell it what sector we want... */       switch (val & LHD_STATEMASK) {
   lhd_wreg(lh, LHD_REG_SECT, sector+i);      case LHD_IDLE:
   /* and start the operation. */             case LHD_WORKING:
   lhd_wreg(lh, LHD_REG_STAT, statval);         break;
   /* Now wait until the interrupt            case LHD_OK:
    * handler tells us we're done. */         case LHD_INVSECT:
   P(lh->lh_done);                SLEEP       case LHD_MEDIA:
                                               lhd_wreg(lh, LHD_REG_STAT, 0);
    /* Get the result value                    lhd_iodone(lh,
     * saved by the interrupt handler. */                 lhd_code_to_errno(lh, val));
    result = lh->lh_result;                    break;
}                                            }
                                            }
                                                                                6
Interrupt Handler Steps
•       Save Registers not already saved by hardware interrupt
        mechanism

•       (Optionally) set up context for interrupt service procedure
    –         Typically, handler runs in the context of the currently running process
          •      No expensive context switch


•       Set up stack for interrupt service procedure
    –         Handler usually runs on the kernel stack of current process


•       Ack/Mask interrupt controller, re-enable other interrupts
    –         What does this imply?


                                                                                        7
Interrupt Handler Steps
•       Run interrupt service procedure
    –     Acknowledges interrupt at device level
    –     Figures out what caused the interrupt
          •   Received a network packet, disk read finished, UART transmit queue
              empty
    –     If needed, it signals blocked device driver
•       In some cases, will have woken up a higher priority
        blocked thread
    –     Choose newly woken thread to schedule next.
    –     Set up MMU context for process to run next
    –     What if we are nested?
•       Load new/original process' registers
•       Re-enable interrupt; Start running the new process


                                                                            8
Sleeping in Interrupts
• Interrupt generally has no context (runs on current kernel stack)
   – Unfair to sleep interrupted process (deadlock possible)
   – Where to get context for long running operation?
   – What goes into the ready queue?

• What to do?
  – Top and Bottom Half
  – Linux implements with tasklets and workqueues
    – Generically, in-kernel thread(s) handle long running kernel
      operations.




                                                                      9
Top/Half Bottom Half
                      • Top Half
                         – Interrupt handler
                         – remains short

 Higher Software      • Bottom half
     Layers              – Is preemtable by top half (interrupts)
                         – performs deferred work (e.g. IP
   Bottom Half             stack processing)
Top Half (Interrupt
                         – Is checked prior to every kernel exit
    Handler)             – signals blocked processes/threads to
                           continue
                      • Enables low interrupt latency
                      • Bottom half can’t block

                                                          10
Stack Usage
                             Kernel Stack
• Upper software                            H
• Interrupt (interrupts
  disabled)                        T        H
• Deferred processing              B        H
  (interrupt re-
  enabled)
• Interrupt while in          T    B        H
  bottom half




                                                11
Deferring Work on In-kernel
              Threads
                                                   In-kernel thread
• Interrupt                                             stack
   – handler defers work
     onto in-kernel thread
• In-kernel thread
  handles deferred
  work (DW)
   – Scheduled normally                    I
   – Can block
• Both low interrupt
                                               D
  latency and blocking                     H
                                               W
  operations
                             Normal
                          process/thread
                              stack                             12
• Logical position of device drivers
  is shown here
• Drivers (originally) compiled into
                                          Device Drivers
  the kernel
    – Including OS/161
    – Device installers were
      technicians
    – Number and types of devices
      rarely changed
• Nowadays they are dynamically
  loaded when needed
    – Linux modules
    – Typical users (device installers)
      can’t build kernels
    – Number and types vary greatly
        • Even while OS is running (e.g
          hot-plug USB devices)



                                                      13
Device Drivers
• Drivers classified into similar categories
  – Block devices and character (stream of data) device
• OS defines a standard (internal) interface to
  the different classes of devices
  – Device specs often help, e.g. USB
• Device drivers job
  – translate request through the device-independent
    standard interface (open, close, read, write) into
    appropriate sequence of commands (register
    manipulations) for the particular hardware
  – Initialise the hardware at boot time, and shut it down
    cleanly at shutdown

                                                        14
Device Driver
• After issuing the command to the device, the
  device either
  – Completes immediately and the driver simply returns
    to the caller
  – Or, device must process the request and the driver
    usually blocks waiting for an I/O complete interrupt.
• Drivers are re-entrant (or thread-safe) as they
  can be called by another process while a
  process is already blocked in the driver.
  – Re-entrant: Mainly no static (global) non-constant
    data.

                                                         15
Device-Independent I/O
            Software
• There is commonality between drivers of
  similar classes
• Divide I/O software into device-dependent
  and device-independent I/O software
• Device independent software includes
  – Buffer or Buffer-cache management
  – Managing access to dedicated devices
  – Error reporting

                                           16
Device-Independent I/O Software




   (a) Without a standard driver interface
   (b) With a standard driver interface
                                         17
Driver ⇔ Kernel Interface
• Major Issue is uniform interfaces to devices and
  kernel
  – Uniform device interface for kernel code
     • Allows different devices to be used the same way
         – No need to rewrite file-system to switch between SCSI, IDE or
           RAM disk
     • Allows internal changes to device driver with fear of breaking
       kernel code
  – Uniform kernel interface for device code
     • Drivers use a defined interface to kernel services (e.g.
       kmalloc, install IRQ handler, etc.)
     • Allows kernel to evolve without breaking existing drivers
  – Together both uniform interfaces avoid a lot of
    programming implementing new interfaces
                                                                     18
Buffering




            19
Device-Independent I/O Software




(a) Unbuffered input
(b) Buffering in user space
(c) Single buffering in the kernel followed by copying to user
   space
(d) Double buffering in the kernel
                                                             20
No Buffering
• Process must read/write a device a
  byte/word at a time
  – Each individual system call adds significant
    overhead
  – Process must what until each I/O is complete
    • Blocking/interrupt/waking adds to overhead.
    • Many short runs of a process is inefficient (poor
      CPU cache temporal locality)



                                                          21
User-level Buffering
• Process specifies a memory buffer that incoming
  data is placed in until it fills
  – Filling can be done by interrupt service routine
  – Only a single system call, and block/wakeup per data
    buffer
     • Much more efficient




                                                     22
User-level Buffering
• Issues
  – What happens if buffer is paged out to disk
     • Could lose data while buffer is paged in
     • Could lock buffer in memory (needed for DMA), however
       many processes doing I/O reduce RAM available for paging.
       Can cause deadlock as RAM is limited resource
  – Consider write case
     • When is buffer available for re-use?
         – Either process must block until potential slow device drains
           buffer
         – or deal with asynchronous signals indicating buffer drained




                                                                          23
Single Buffer
• Operating system assigns a buffer in kernel’s
  memory for an I/O request
• Stream-oriented
  – Used a line at time
  – User input from a terminal is one line at a time with
    carriage return signaling the end of the line
  – Output to the terminal is one line at a time




                                                            24
Single Buffer
• Block-oriented
  – Input transfers made to buffer
  – Block moved to user space when needed
  – Another block is moved into the buffer
    • Read ahead




                                             25
Single Buffer
– User process can process one block of data
  while next block is read in
– Swapping can occur since input is taking
  place in system memory, not user memory
– Operating system keeps track of assignment
  of system buffers to user processes




                                           26
Single Buffer Speed Up
• Assume
   – T is transfer time for a block from device
   – C is computation time to process incoming block
   – M is time to copy kernel buffer to user buffer
• Computation and transfer can be done in parallel
• Speed up with buffering


                       T +C
                    max(T , C ) + M
                                                       27
Single Buffer
• What happens if kernel buffer is full, the
  user buffer is swapped out, and more data
  is received???
  – We start to lose characters or drop network
    packets




                                                  28
Double Buffer
• Use two system buffers instead of one
• A process can transfer data to or from one
  buffer while the operating system empties
  or fills the other buffer




                                          29
Double Buffer Speed Up
• Computation and Memory copy can be done in
  parallel with transfer
• Speed up with double buffering

                  T +C
               max(T , C + M )
• Usually M is much less than T giving a
  favourable result
                                           30
Double Buffer
• May be insufficient for really bursty traffic
  – Lots of application writes between long
    periods of computation
  – Long periods of application computation while
    receiving data
  – Might want to read-ahead more than a single
    block for disk



                                              31
Circular Buffer
• More than two buffers are used
• Each individual buffer is one unit in a circular
  buffer
• Used when I/O operation must keep up with
  process




                                                     32
Important Note
• Notice that buffering, double buffering, and
  circular buffering are all

     Bounded-Buffer
    Producer-Consumer
         Problems
                                           33
Is Buffering Always Good?
      T +C            T +C
   max(T , C ) + M max(T , C + M )
         Single               Double


• Can M be similar or greater than C or T?



                                         34
Buffering in Fast Networks




•   Networking may involve many copies
•   Copying reduces performance
     – Especially if copy costs are similar to or greater than computation or
       transfer costs
•   Super-fast networks put significant effort into achieving zero-copy
•   Buffering also increases latency

                                                                                35
I/O Software Summary




Layers of the I/O system and the main
functions of each layer
                                        36

Más contenido relacionado

La actualidad más candente

Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating SystemTech_MX
 
Real time operating system
Real time operating systemReal time operating system
Real time operating systemPratik Hiremath
 
RTAI - Earliest Deadline First
RTAI - Earliest Deadline FirstRTAI - Earliest Deadline First
RTAI - Earliest Deadline FirstStefano Bragaglia
 
Real time operating system
Real time operating systemReal time operating system
Real time operating systemBharti Goyal
 
BeRTOS: Free Embedded RTOS
BeRTOS: Free Embedded RTOSBeRTOS: Free Embedded RTOS
BeRTOS: Free Embedded RTOSDeveler S.r.l.
 
ARM Processor architecture
ARM Processor  architectureARM Processor  architecture
ARM Processor architecturerajkciitr
 
The survey on real time operating systems (1)
The survey on real time operating systems (1)The survey on real time operating systems (1)
The survey on real time operating systems (1)manojkumarsmks
 
How to Measure RTOS Performance
How to Measure RTOS Performance How to Measure RTOS Performance
How to Measure RTOS Performance mentoresd
 
Overview of Linux real-time challenges
Overview of Linux real-time challengesOverview of Linux real-time challenges
Overview of Linux real-time challengesDaniel Stenberg
 
HKG15-305: Real Time processing comparing the RT patch vs Core isolation
HKG15-305: Real Time processing comparing the RT patch vs Core isolationHKG15-305: Real Time processing comparing the RT patch vs Core isolation
HKG15-305: Real Time processing comparing the RT patch vs Core isolationLinaro
 

La actualidad más candente (20)

Real time Operating System
Real time Operating SystemReal time Operating System
Real time Operating System
 
Os2
Os2Os2
Os2
 
Real time operating system
Real time operating systemReal time operating system
Real time operating system
 
Rtos
RtosRtos
Rtos
 
RTAI - Earliest Deadline First
RTAI - Earliest Deadline FirstRTAI - Earliest Deadline First
RTAI - Earliest Deadline First
 
Real time Linux
Real time LinuxReal time Linux
Real time Linux
 
Lect07
Lect07Lect07
Lect07
 
Real time operating system
Real time operating systemReal time operating system
Real time operating system
 
BeRTOS: Free Embedded RTOS
BeRTOS: Free Embedded RTOSBeRTOS: Free Embedded RTOS
BeRTOS: Free Embedded RTOS
 
Mastering Real-time Linux
Mastering Real-time LinuxMastering Real-time Linux
Mastering Real-time Linux
 
Rtos part2
Rtos part2Rtos part2
Rtos part2
 
Vxworks
VxworksVxworks
Vxworks
 
Hypervisors
HypervisorsHypervisors
Hypervisors
 
ARM Processor architecture
ARM Processor  architectureARM Processor  architecture
ARM Processor architecture
 
The survey on real time operating systems (1)
The survey on real time operating systems (1)The survey on real time operating systems (1)
The survey on real time operating systems (1)
 
RTOS - Real Time Operating Systems
RTOS - Real Time Operating SystemsRTOS - Real Time Operating Systems
RTOS - Real Time Operating Systems
 
How to Measure RTOS Performance
How to Measure RTOS Performance How to Measure RTOS Performance
How to Measure RTOS Performance
 
Overview of Linux real-time challenges
Overview of Linux real-time challengesOverview of Linux real-time challenges
Overview of Linux real-time challenges
 
HKG15-305: Real Time processing comparing the RT patch vs Core isolation
HKG15-305: Real Time processing comparing the RT patch vs Core isolationHKG15-305: Real Time processing comparing the RT patch vs Core isolation
HKG15-305: Real Time processing comparing the RT patch vs Core isolation
 
Rtos ss
Rtos ssRtos ss
Rtos ss
 

Destacado

Introducing A Branded Cell Phone To Vietnam
Introducing A Branded Cell Phone To VietnamIntroducing A Branded Cell Phone To Vietnam
Introducing A Branded Cell Phone To Vietnamsedagokoglu
 
Kamaroninfo núm. 14. maig 1997
Kamaroninfo núm. 14. maig 1997Kamaroninfo núm. 14. maig 1997
Kamaroninfo núm. 14. maig 1997Josep Miquel
 
Ennio Ciriolo - Chi gioca con la nostra storia?
Ennio Ciriolo - Chi gioca con la nostra storia?Ennio Ciriolo - Chi gioca con la nostra storia?
Ennio Ciriolo - Chi gioca con la nostra storia?enniociriolo
 
Tele3113 wk2tue
Tele3113 wk2tueTele3113 wk2tue
Tele3113 wk2tueVin Voro
 
webAssist Online Advertising Seminar
webAssist Online Advertising SeminarwebAssist Online Advertising Seminar
webAssist Online Advertising SeminarwebAssistca
 
Kamaroninfo núm. 8 novembre 1996
Kamaroninfo núm. 8 novembre 1996Kamaroninfo núm. 8 novembre 1996
Kamaroninfo núm. 8 novembre 1996Josep Miquel
 
Digitaal leermateriaal op school
Digitaal leermateriaal op school Digitaal leermateriaal op school
Digitaal leermateriaal op school wimdboer
 
Presentation for "Provas de Agergação" - 3 licao
Presentation for "Provas de Agergação" - 3 licaoPresentation for "Provas de Agergação" - 3 licao
Presentation for "Provas de Agergação" - 3 licaoAlvaro Barbosa
 
Máy cắt dây tia lửa điện (nhóm iii)
Máy cắt dây   tia lửa điện (nhóm iii)Máy cắt dây   tia lửa điện (nhóm iii)
Máy cắt dây tia lửa điện (nhóm iii)tranduyen76
 
ионизирующее излучение
ионизирующее излучениеионизирующее излучение
ионизирующее излучениеavt74
 
3 slide bodies
3 slide bodies3 slide bodies
3 slide bodiesDiveon
 
323-Boulay
323-Boulay323-Boulay
323-BoulayDiveon
 
Saigon luxury apartment ms.duyên
Saigon luxury apartment   ms.duyênSaigon luxury apartment   ms.duyên
Saigon luxury apartment ms.duyêntranduyen76
 
Dia de-la-energia2013-Ramon Espinasa
Dia de-la-energia2013-Ramon EspinasaDia de-la-energia2013-Ramon Espinasa
Dia de-la-energia2013-Ramon EspinasaReporte Energía
 
dMT SPC Presentation Rotating Equip.-E
dMT SPC Presentation Rotating Equip.-EdMT SPC Presentation Rotating Equip.-E
dMT SPC Presentation Rotating Equip.-Edmtgms
 

Destacado (20)

Introducing A Branded Cell Phone To Vietnam
Introducing A Branded Cell Phone To VietnamIntroducing A Branded Cell Phone To Vietnam
Introducing A Branded Cell Phone To Vietnam
 
Kamaroninfo núm. 14. maig 1997
Kamaroninfo núm. 14. maig 1997Kamaroninfo núm. 14. maig 1997
Kamaroninfo núm. 14. maig 1997
 
Ennio Ciriolo - Chi gioca con la nostra storia?
Ennio Ciriolo - Chi gioca con la nostra storia?Ennio Ciriolo - Chi gioca con la nostra storia?
Ennio Ciriolo - Chi gioca con la nostra storia?
 
Extlect02
Extlect02Extlect02
Extlect02
 
Iphone 4
Iphone 4Iphone 4
Iphone 4
 
Tele3113 wk2tue
Tele3113 wk2tueTele3113 wk2tue
Tele3113 wk2tue
 
webAssist Online Advertising Seminar
webAssist Online Advertising SeminarwebAssist Online Advertising Seminar
webAssist Online Advertising Seminar
 
Kamaroninfo núm. 8 novembre 1996
Kamaroninfo núm. 8 novembre 1996Kamaroninfo núm. 8 novembre 1996
Kamaroninfo núm. 8 novembre 1996
 
Digitaal leermateriaal op school
Digitaal leermateriaal op school Digitaal leermateriaal op school
Digitaal leermateriaal op school
 
Presentation for "Provas de Agergação" - 3 licao
Presentation for "Provas de Agergação" - 3 licaoPresentation for "Provas de Agergação" - 3 licao
Presentation for "Provas de Agergação" - 3 licao
 
Máy cắt dây tia lửa điện (nhóm iii)
Máy cắt dây   tia lửa điện (nhóm iii)Máy cắt dây   tia lửa điện (nhóm iii)
Máy cắt dây tia lửa điện (nhóm iii)
 
Lect14
Lect14Lect14
Lect14
 
ионизирующее излучение
ионизирующее излучениеионизирующее излучение
ионизирующее излучение
 
3 slide bodies
3 slide bodies3 slide bodies
3 slide bodies
 
323-Boulay
323-Boulay323-Boulay
323-Boulay
 
Fruits
FruitsFruits
Fruits
 
Saigon luxury apartment ms.duyên
Saigon luxury apartment   ms.duyênSaigon luxury apartment   ms.duyên
Saigon luxury apartment ms.duyên
 
Dia de-la-energia2013-Ramon Espinasa
Dia de-la-energia2013-Ramon EspinasaDia de-la-energia2013-Ramon Espinasa
Dia de-la-energia2013-Ramon Espinasa
 
dMT SPC Presentation Rotating Equip.-E
dMT SPC Presentation Rotating Equip.-EdMT SPC Presentation Rotating Equip.-E
dMT SPC Presentation Rotating Equip.-E
 
Da hbp tb q.tđ
Da hbp tb q.tđDa hbp tb q.tđ
Da hbp tb q.tđ
 

Similar a Lect17

Considerations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfConsiderations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfhik_lhz
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputPeter Tröger
 
Audio in linux embedded
Audio in linux embeddedAudio in linux embedded
Audio in linux embeddedtrx2001
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxSajinvs4
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linuxSiddique Ibrahim
 
Linux Device Driver,LDD,
Linux Device Driver,LDD,Linux Device Driver,LDD,
Linux Device Driver,LDD,Rahul Batra
 
linux device driver
linux device driverlinux device driver
linux device driverRahul Batra
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecturejeetesh036
 
Lec 9-os-review
Lec 9-os-reviewLec 9-os-review
Lec 9-os-reviewMothi R
 
Linux Interrupts
Linux InterruptsLinux Interrupts
Linux InterruptsKernel TLV
 
Distributed Erlang Systems In Operation
Distributed Erlang Systems In OperationDistributed Erlang Systems In Operation
Distributed Erlang Systems In OperationAndy Gross
 
Intro Basic of OS .ppt
Intro Basic of OS .pptIntro Basic of OS .ppt
Intro Basic of OS .pptVarsha506533
 

Similar a Lect17 (20)

Considerations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmfConsiderations when implementing_ha_in_dmf
Considerations when implementing_ha_in_dmf
 
Operating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / OutputOperating Systems 1 (11/12) - Input / Output
Operating Systems 1 (11/12) - Input / Output
 
Device Drivers
Device DriversDevice Drivers
Device Drivers
 
Audio in linux embedded
Audio in linux embeddedAudio in linux embedded
Audio in linux embedded
 
Ch12 io systems
Ch12   io systemsCh12   io systems
Ch12 io systems
 
MODULE IV embedded (1).pptx
MODULE IV embedded (1).pptxMODULE IV embedded (1).pptx
MODULE IV embedded (1).pptx
 
Kernel mode vs user mode in linux
Kernel mode vs user mode in linuxKernel mode vs user mode in linux
Kernel mode vs user mode in linux
 
Linux Device Driver,LDD,
Linux Device Driver,LDD,Linux Device Driver,LDD,
Linux Device Driver,LDD,
 
linux device driver
linux device driverlinux device driver
linux device driver
 
운영체제론 Ch12
운영체제론 Ch12운영체제론 Ch12
운영체제론 Ch12
 
Os
OsOs
Os
 
Computer system architecture
Computer system architectureComputer system architecture
Computer system architecture
 
Linux architecture
Linux architectureLinux architecture
Linux architecture
 
Lec 9-os-review
Lec 9-os-reviewLec 9-os-review
Lec 9-os-review
 
Linux Interrupts
Linux InterruptsLinux Interrupts
Linux Interrupts
 
Distributed Erlang Systems In Operation
Distributed Erlang Systems In OperationDistributed Erlang Systems In Operation
Distributed Erlang Systems In Operation
 
5120224.ppt
5120224.ppt5120224.ppt
5120224.ppt
 
Intro Basic of OS .ppt
Intro Basic of OS .pptIntro Basic of OS .ppt
Intro Basic of OS .ppt
 
Virtualization Basics
Virtualization BasicsVirtualization Basics
Virtualization Basics
 
CHAP4.pptx
CHAP4.pptxCHAP4.pptx
CHAP4.pptx
 

Más de Vin Voro

Tele3113 tut6
Tele3113 tut6Tele3113 tut6
Tele3113 tut6Vin Voro
 
Tele3113 tut5
Tele3113 tut5Tele3113 tut5
Tele3113 tut5Vin Voro
 
Tele3113 tut4
Tele3113 tut4Tele3113 tut4
Tele3113 tut4Vin Voro
 
Tele3113 tut1
Tele3113 tut1Tele3113 tut1
Tele3113 tut1Vin Voro
 
Tele3113 tut3
Tele3113 tut3Tele3113 tut3
Tele3113 tut3Vin Voro
 
Tele3113 tut2
Tele3113 tut2Tele3113 tut2
Tele3113 tut2Vin Voro
 
Tele3113 wk11tue
Tele3113 wk11tueTele3113 wk11tue
Tele3113 wk11tueVin Voro
 
Tele3113 wk10wed
Tele3113 wk10wedTele3113 wk10wed
Tele3113 wk10wedVin Voro
 
Tele3113 wk10tue
Tele3113 wk10tueTele3113 wk10tue
Tele3113 wk10tueVin Voro
 
Tele3113 wk11wed
Tele3113 wk11wedTele3113 wk11wed
Tele3113 wk11wedVin Voro
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wedVin Voro
 
Tele3113 wk9tue
Tele3113 wk9tueTele3113 wk9tue
Tele3113 wk9tueVin Voro
 
Tele3113 wk8wed
Tele3113 wk8wedTele3113 wk8wed
Tele3113 wk8wedVin Voro
 
Tele3113 wk9wed
Tele3113 wk9wedTele3113 wk9wed
Tele3113 wk9wedVin Voro
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wedVin Voro
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wedVin Voro
 
Tele3113 wk7tue
Tele3113 wk7tueTele3113 wk7tue
Tele3113 wk7tueVin Voro
 
Tele3113 wk6wed
Tele3113 wk6wedTele3113 wk6wed
Tele3113 wk6wedVin Voro
 
Tele3113 wk6tue
Tele3113 wk6tueTele3113 wk6tue
Tele3113 wk6tueVin Voro
 
Tele3113 wk5tue
Tele3113 wk5tueTele3113 wk5tue
Tele3113 wk5tueVin Voro
 

Más de Vin Voro (20)

Tele3113 tut6
Tele3113 tut6Tele3113 tut6
Tele3113 tut6
 
Tele3113 tut5
Tele3113 tut5Tele3113 tut5
Tele3113 tut5
 
Tele3113 tut4
Tele3113 tut4Tele3113 tut4
Tele3113 tut4
 
Tele3113 tut1
Tele3113 tut1Tele3113 tut1
Tele3113 tut1
 
Tele3113 tut3
Tele3113 tut3Tele3113 tut3
Tele3113 tut3
 
Tele3113 tut2
Tele3113 tut2Tele3113 tut2
Tele3113 tut2
 
Tele3113 wk11tue
Tele3113 wk11tueTele3113 wk11tue
Tele3113 wk11tue
 
Tele3113 wk10wed
Tele3113 wk10wedTele3113 wk10wed
Tele3113 wk10wed
 
Tele3113 wk10tue
Tele3113 wk10tueTele3113 wk10tue
Tele3113 wk10tue
 
Tele3113 wk11wed
Tele3113 wk11wedTele3113 wk11wed
Tele3113 wk11wed
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wed
 
Tele3113 wk9tue
Tele3113 wk9tueTele3113 wk9tue
Tele3113 wk9tue
 
Tele3113 wk8wed
Tele3113 wk8wedTele3113 wk8wed
Tele3113 wk8wed
 
Tele3113 wk9wed
Tele3113 wk9wedTele3113 wk9wed
Tele3113 wk9wed
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wed
 
Tele3113 wk7wed
Tele3113 wk7wedTele3113 wk7wed
Tele3113 wk7wed
 
Tele3113 wk7tue
Tele3113 wk7tueTele3113 wk7tue
Tele3113 wk7tue
 
Tele3113 wk6wed
Tele3113 wk6wedTele3113 wk6wed
Tele3113 wk6wed
 
Tele3113 wk6tue
Tele3113 wk6tueTele3113 wk6tue
Tele3113 wk6tue
 
Tele3113 wk5tue
Tele3113 wk5tueTele3113 wk5tue
Tele3113 wk5tue
 

Último

Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...ZurliaSoop
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 

Último (20)

Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 

Lect17

  • 1. I/O Management Software Chapter 5 1
  • 2. Operating System Design Issues • Efficiency – Most I/O devices slow compared to main memory (and the CPU) • Use of multiprogramming allows for some processes to be waiting on I/O while another process executes • Often I/O still cannot keep up with processor speed • Swapping may used to bring in additional Ready processes – More I/O operations • Optimise I/O efficiency – especially Disk & Network I/O 2
  • 3. Operating System Design Issues • The quest for generality/uniformity: – Ideally, handle all I/O devices in the same way • Both in the OS and in user applications – Problem: • Diversity of I/O devices • Especially, different access methods (random access versus stream based) as well as vastly different data rates. • Generality often compromises efficiency! – Hide most of the details of device I/O in lower-level routines so that processes and upper levels see devices in general terms such as read, write, open, close. 3
  • 4. I/O Software Layers Layers of the I/O Software System 4
  • 5. Interrupt Handlers • Interrupt handlers – Can execute at (almost) any time • Raise (complex) concurrency issues in the kernel • Can propagate to userspace (signals, upcalls), causing similar issues • Generally structured so I/O operations block until interrupts notify them of completion – kern/dev/lamebus/lhd.c 5
  • 6. Interrupt Handler Example static int lhd_iodone(struct lhd_softc *lh, int err) lhd_io(struct device *d, { struct uio *uio) lh->lh_result = err; { V(lh->lh_done); ... } /* Loop over all the sectors * we were asked to do. */ void for (i=0; i<len; i++) { INT lhd_irq(void *vlh) /* Wait until nobody else { * is using the device. */ ... P(lh->lh_clear); val = lhd_rdreg(lh, LHD_REG_STAT); ... /* Tell it what sector we want... */ switch (val & LHD_STATEMASK) { lhd_wreg(lh, LHD_REG_SECT, sector+i); case LHD_IDLE: /* and start the operation. */ case LHD_WORKING: lhd_wreg(lh, LHD_REG_STAT, statval); break; /* Now wait until the interrupt case LHD_OK: * handler tells us we're done. */ case LHD_INVSECT: P(lh->lh_done); SLEEP case LHD_MEDIA: lhd_wreg(lh, LHD_REG_STAT, 0); /* Get the result value lhd_iodone(lh, * saved by the interrupt handler. */ lhd_code_to_errno(lh, val)); result = lh->lh_result; break; } } } 6
  • 7. Interrupt Handler Steps • Save Registers not already saved by hardware interrupt mechanism • (Optionally) set up context for interrupt service procedure – Typically, handler runs in the context of the currently running process • No expensive context switch • Set up stack for interrupt service procedure – Handler usually runs on the kernel stack of current process • Ack/Mask interrupt controller, re-enable other interrupts – What does this imply? 7
  • 8. Interrupt Handler Steps • Run interrupt service procedure – Acknowledges interrupt at device level – Figures out what caused the interrupt • Received a network packet, disk read finished, UART transmit queue empty – If needed, it signals blocked device driver • In some cases, will have woken up a higher priority blocked thread – Choose newly woken thread to schedule next. – Set up MMU context for process to run next – What if we are nested? • Load new/original process' registers • Re-enable interrupt; Start running the new process 8
  • 9. Sleeping in Interrupts • Interrupt generally has no context (runs on current kernel stack) – Unfair to sleep interrupted process (deadlock possible) – Where to get context for long running operation? – What goes into the ready queue? • What to do? – Top and Bottom Half – Linux implements with tasklets and workqueues – Generically, in-kernel thread(s) handle long running kernel operations. 9
  • 10. Top/Half Bottom Half • Top Half – Interrupt handler – remains short Higher Software • Bottom half Layers – Is preemtable by top half (interrupts) – performs deferred work (e.g. IP Bottom Half stack processing) Top Half (Interrupt – Is checked prior to every kernel exit Handler) – signals blocked processes/threads to continue • Enables low interrupt latency • Bottom half can’t block 10
  • 11. Stack Usage Kernel Stack • Upper software H • Interrupt (interrupts disabled) T H • Deferred processing B H (interrupt re- enabled) • Interrupt while in T B H bottom half 11
  • 12. Deferring Work on In-kernel Threads In-kernel thread • Interrupt stack – handler defers work onto in-kernel thread • In-kernel thread handles deferred work (DW) – Scheduled normally I – Can block • Both low interrupt D latency and blocking H W operations Normal process/thread stack 12
  • 13. • Logical position of device drivers is shown here • Drivers (originally) compiled into Device Drivers the kernel – Including OS/161 – Device installers were technicians – Number and types of devices rarely changed • Nowadays they are dynamically loaded when needed – Linux modules – Typical users (device installers) can’t build kernels – Number and types vary greatly • Even while OS is running (e.g hot-plug USB devices) 13
  • 14. Device Drivers • Drivers classified into similar categories – Block devices and character (stream of data) device • OS defines a standard (internal) interface to the different classes of devices – Device specs often help, e.g. USB • Device drivers job – translate request through the device-independent standard interface (open, close, read, write) into appropriate sequence of commands (register manipulations) for the particular hardware – Initialise the hardware at boot time, and shut it down cleanly at shutdown 14
  • 15. Device Driver • After issuing the command to the device, the device either – Completes immediately and the driver simply returns to the caller – Or, device must process the request and the driver usually blocks waiting for an I/O complete interrupt. • Drivers are re-entrant (or thread-safe) as they can be called by another process while a process is already blocked in the driver. – Re-entrant: Mainly no static (global) non-constant data. 15
  • 16. Device-Independent I/O Software • There is commonality between drivers of similar classes • Divide I/O software into device-dependent and device-independent I/O software • Device independent software includes – Buffer or Buffer-cache management – Managing access to dedicated devices – Error reporting 16
  • 17. Device-Independent I/O Software (a) Without a standard driver interface (b) With a standard driver interface 17
  • 18. Driver ⇔ Kernel Interface • Major Issue is uniform interfaces to devices and kernel – Uniform device interface for kernel code • Allows different devices to be used the same way – No need to rewrite file-system to switch between SCSI, IDE or RAM disk • Allows internal changes to device driver with fear of breaking kernel code – Uniform kernel interface for device code • Drivers use a defined interface to kernel services (e.g. kmalloc, install IRQ handler, etc.) • Allows kernel to evolve without breaking existing drivers – Together both uniform interfaces avoid a lot of programming implementing new interfaces 18
  • 19. Buffering 19
  • 20. Device-Independent I/O Software (a) Unbuffered input (b) Buffering in user space (c) Single buffering in the kernel followed by copying to user space (d) Double buffering in the kernel 20
  • 21. No Buffering • Process must read/write a device a byte/word at a time – Each individual system call adds significant overhead – Process must what until each I/O is complete • Blocking/interrupt/waking adds to overhead. • Many short runs of a process is inefficient (poor CPU cache temporal locality) 21
  • 22. User-level Buffering • Process specifies a memory buffer that incoming data is placed in until it fills – Filling can be done by interrupt service routine – Only a single system call, and block/wakeup per data buffer • Much more efficient 22
  • 23. User-level Buffering • Issues – What happens if buffer is paged out to disk • Could lose data while buffer is paged in • Could lock buffer in memory (needed for DMA), however many processes doing I/O reduce RAM available for paging. Can cause deadlock as RAM is limited resource – Consider write case • When is buffer available for re-use? – Either process must block until potential slow device drains buffer – or deal with asynchronous signals indicating buffer drained 23
  • 24. Single Buffer • Operating system assigns a buffer in kernel’s memory for an I/O request • Stream-oriented – Used a line at time – User input from a terminal is one line at a time with carriage return signaling the end of the line – Output to the terminal is one line at a time 24
  • 25. Single Buffer • Block-oriented – Input transfers made to buffer – Block moved to user space when needed – Another block is moved into the buffer • Read ahead 25
  • 26. Single Buffer – User process can process one block of data while next block is read in – Swapping can occur since input is taking place in system memory, not user memory – Operating system keeps track of assignment of system buffers to user processes 26
  • 27. Single Buffer Speed Up • Assume – T is transfer time for a block from device – C is computation time to process incoming block – M is time to copy kernel buffer to user buffer • Computation and transfer can be done in parallel • Speed up with buffering T +C max(T , C ) + M 27
  • 28. Single Buffer • What happens if kernel buffer is full, the user buffer is swapped out, and more data is received??? – We start to lose characters or drop network packets 28
  • 29. Double Buffer • Use two system buffers instead of one • A process can transfer data to or from one buffer while the operating system empties or fills the other buffer 29
  • 30. Double Buffer Speed Up • Computation and Memory copy can be done in parallel with transfer • Speed up with double buffering T +C max(T , C + M ) • Usually M is much less than T giving a favourable result 30
  • 31. Double Buffer • May be insufficient for really bursty traffic – Lots of application writes between long periods of computation – Long periods of application computation while receiving data – Might want to read-ahead more than a single block for disk 31
  • 32. Circular Buffer • More than two buffers are used • Each individual buffer is one unit in a circular buffer • Used when I/O operation must keep up with process 32
  • 33. Important Note • Notice that buffering, double buffering, and circular buffering are all Bounded-Buffer Producer-Consumer Problems 33
  • 34. Is Buffering Always Good? T +C T +C max(T , C ) + M max(T , C + M ) Single Double • Can M be similar or greater than C or T? 34
  • 35. Buffering in Fast Networks • Networking may involve many copies • Copying reduces performance – Especially if copy costs are similar to or greater than computation or transfer costs • Super-fast networks put significant effort into achieving zero-copy • Buffering also increases latency 35
  • 36. I/O Software Summary Layers of the I/O system and the main functions of each layer 36