4P13 Week 12 - cosc.brocku.ca

4P13 Week 12 Talking Points 1

2 3

Device Drivers 1. Auto-configuration and initialization routines 2. Routines for servicing I/O requests (the top half) 3. Interrupt service routines (the bottom half)

4 Interrupt Handling 1. Collects the relevant hardware parameters and

places them in the space reserved for them by the device 2. Updates statistics on device interrupts 3. Schedules the interrupt service thread for the device

4. Clears the interrupt-pending flag in the hardware 5. Returns from the interrupt 5

6 7 Entry Points for Char Dev Drivers

open Opens the device in preparation for I/O operations. A devices open entry point will be called for each open system call on a special-device file or, internally, when a device is prepared for mounting a filesystem with the mount system call. The open() routine will commonly verify the integrity of

the associated medium. For example, it will verify that the device was identified during the autoconfiguration phase and, for disk drives, that a medium is present and ready to accept commands. close Closes a device. The close() routine is called after the final client interested in

using the device terminates. These semantics are defined by the higher-level I/O facilities. Disk devices have nothing to do when a device is closed and thus use a null close() routine. Devices that support access to only a single client must mark the device as available once again. 8

Entry Points for Char Dev Drivers read Reads data from a device. For raw devices, this entry point normally just calls the physio() routine with device-specific parameters. For terminal-oriented devices, a read

request is passed immediately to the terminal driver. For other devices, a read request requires that the specified data be copied into the kernels address space, typically with the uiomove() routine (see the end of Section 7.1), and then be passed to the device. write Writes data to a device. This entry point is a direct parallel of the read entry point: raw

devices use physio(), terminal-oriented devices call the terminal driver to do this operation, and other devices handle the request internally. ioctl Performs an operation other than a read or write. This entry point originally provided a mechanism to get and set device parameters for terminal devices; its use has expanded

to other types of devices as well. Historically, ioctl operations have varied widely from device to device. 9

Entry Points for Char Dev Drivers poll Checks the device to see whether data are available for reading or space is available for writing data. The poll entry point is used by the select and poll system calls in checking file descriptors associated with device special files. For

raw devices, a poll operation is meaningless since data are not buffered. Here, the entry point is set to seltrue(), a routine that returns true for any poll request. mmap Maps a device offset into a memory address. This entry point is called by the virtual-memory system to convert a logical mapping to a physical address. For

example, it converts an offset in: /dev/mem to a kernel address. kqfilter Adds the device to the kernel event list for the calling thread. Kernel events are described in Section 7.1.

10 Disk Device Entries strategy Starts a read or write operation, and return immediately. I/O requests to or from filesystems

located on a device are translated by the system into calls to the block I/O routines bread() and bwrite(). These block I/O routines in turn call the devices strategy routine to read or write data not in the memory cache. Each call to the strategy routine specifies a pointer to a buf structure containing the parameters for an I/O request. If the request is synchronous, the caller must sleep (on the address of the buf structure) until I/O completes.

dump If performing a dump has been configured during system startup, writes all physical memory to the configured device. Typically, the dump entry point saves the contents of physical memory on secondary storage into an area used for swapping. To speed the dump and to save space, the system can be configured to perform a mini-dump that writes only the physical memory in

use by the kernel. The system automatically performs a dump when it detects an unrecoverable error and is about to crash. The dump is used in postmortem analysis to help find the problem that caused the system to crash. The dump routine is invoked with context switching and interrupts disabled; thus, the device driver must poll for device status rather than wait for interrupts. At least one disk device is expected to support this entry point.

11 12 13

14 15

16 The GEOM Layer Transformations in GEOM include the following: 1. Simple base and bounds calculations needed for

disk partitioning 2. Aggregation of disks to provide a RAID, mirrored, or stripped logical volume 3. A cryptographically protected logical volume 4. Collection of I/O statistics

5. I/O optimization such as disk sorting 6. Journaled I/O transactions 17 18

19 20

21 22 23

24 25

26 27 28

29 Resource Allocation 1. Setting the range for the resource

2. Initial allocation of the resource 3. Activating the resource Similarly, resource freeing is done in three steps: 1. Deactivating the resource

2. Releasing ownership of the resource to the parent bus 3. Freeing it 30

31 32

33 34 35

36

Recently Viewed Presentations

  • TOBACCO CONTROL STRATEGIES for PHARMACISTS

    TOBACCO CONTROL STRATEGIES for PHARMACISTS

    RX PARA EL CAMBIO Dejar de fumar con asistencia médica Adaptado de Rx for Change: Clinician-Assisted Tobacco Cessation http://rxforchange.ucsf.edu/
  • No Slide Title

    No Slide Title

    ELECTRON FULLY TRANSFERED IONIC BONDING COVALENT BONDING A + B → AB NaCl HCl LEWIS MODEL OF BONDING Gilbert Lewis (1875-1946) LEWIS DOT SYMBOL DOT represents one valence electron H. with the exception of He, the main group number represents...
  • PowerPoint Presentation

    PowerPoint Presentation

    * * Tumor Line Rh10 Rh12 Rh18 Rh28 Rh30 Rh35 Rh36 Rh39 IRS56 IRS68 Rh65 Rh66 Histology ARMS ERMS ERMS ARMS ARMS ERMS ERMS ARMS ERMS ERMS ARMS ARMS Vincristine Cytoxan Dactinomycin Topotecan MCR CR PR SD PD NO DATA...
  • UNIVERSITY OF ALABAMA AT BIRMINGHAM Center for Teaching

    UNIVERSITY OF ALABAMA AT BIRMINGHAM Center for Teaching

    In the latest episode of NPR's All Things Considererd, Malcolm Gladwell tells the story about how Steve Jobs first brought the mouse to Apple. It's a fantastic look inside Steve's brain, and how he can reduce a complicated concept down...
  • Mr. E's Class

    Mr. E's Class

    Use time zones in the United States or the International Date Line to interpret a map or representation of a globe and calculate current times in different places (G-1A-M2) Fact #11 Universal Time The world is divided up into about...
  • Presentation title - A4ID

    Presentation title - A4ID

    S.414(C)(7)(b): strategic report to include, "to the extent necessary for an understanding of the development, performance or position of the company's business… information about environmental matters, the company's employees, and social, community and human rights issues", ... Adidas (agreed ...
  • Some remarks on the architecture of the visual system

    Some remarks on the architecture of the visual system

    Effect on Philosophy of Science: Feyerabend, Hanson, Kuhn (These philosophers assumed that there is no "innocent eye" so all observations are "theory-laden". Quine's "The myth of the given")
  • Figures - Chapter 1

    Figures - Chapter 1

    The short version of the code summarizes aspirations at a high level of the abstraction; the clauses that are included in the full version give examples and details of how these aspirations change the way we act as software engineering...