tmux note

tmux is a terminal multiplexer. It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal. 

When tmux is started it creates a new session with a single window and displays it on screen. A status line at the bottom of the screen shows information on the current session and is used to enter interactive commands.

A session is a single collection of pseudo terminals under the management of tmux. Each session has one or more windows linked to it. A window occupies the entire screen and may be split into rectangular panes, each of which is a separate pseudo terminal (the pty(4) manual page documents the technical details of pseudo terminals). Any number of tmux instances may connect to the same session, and any number of windows may be present in the same session. Once all sessions are killed,tmux exits.

Each session is persistent and will survive accidental disconnection (such asssh(1) connection timeout) or intentional detaching (with the ‘C-b d’ key strokes). tmux may be reattached using:

$ tmux attach

In tmux, a session is displayed on screen by a client and all sessions are managed by a single server. The server and each client are separate processes which communicate through a socket in /tmp.

PTask: operating system abstractions to manage GPUs as a Compute Devices

Motivation

  • GPUs are prevalent
    • Adept at data intensive computing
    • Unusable apply to other domains 
  • GPU usage are challenging
    • GPU & main memory disjoint
    • Treated as device I/O by OS

Problem && Purposed Solution

  • Problems
    • Simplex abstractions for GPUs
    • Redundancy for cross-process or cross-device communication requires more data migration
  • Solutions

Related Work

Future Work && Conclusion

 

APIC Note

Motivation

This note is the learning note combining intel software developer manual[1] and other blogs. It intends to guide KVM code comprehension.

Local and IO APIC overview

  • Locally connected I/O devices: local interrupts pins (LINT0 & LINT1)
  • Externally connected I/O devices: I/O APIC
  • Inter-processor Interrupts: IPI which is used for software self-interrupts, interrupt forwarding or preemptive scheduling
  • APIC Timer Generated Interrupts: high resolution timer
  • Proformance Monitoring Counter Interrupts: PMI
  • Thermal Senser Interrupts: thermal sensor tripped
  • APIC Internal Error Interrupts: such as accessing unimplemented register

Interrupt source is marked in Local Vector Tabe (LVT). 

IPIs is generated by setting Interrupt Command Register (ICR) on system bus or APIC bus.

System Bus vs APIC Bus

For P6 family and Pentium Processors, IOAPIC connects lapic with 3-wire inter-APIC bus.(APIC Architecture)

For Pentium 4 and Xeon processors, the IOAPIC connects through system bus. (xAPIC Architecuture)

Local APIC

Local APIC ID

Local APIC Version Register

Handling Interrupts

Reference

[1] Intel® 64 and IA-32 Architectures Developer's Manual: Vol. 3A

[note] nooks reliability system (SOSP '03)

Nooks

The Nooks is a reliability subsystem that seeks to greatly enhance OS reliability by isolating the OS from driver failures.

Nooks Design

Nooks Isolation Manager (NIM) is a transparent OS layer inserted between the kernel and kernel extensions. NIM provides four major architectural functions: Isolation, Interposition, Object Tracking and Recovery.

Isolation

Memory management: lightweight kernel protection domain with access to a limited proportion of the kernel's address space.

Extension procedure call (XPC): transfer control safely between extensions and the kernel.

Interposition

Wrapper stubs: provide transparent control and data transfer across address space boundaries. Wrappers are in kernel's domain

Kernel wrappers: kernel supplied functions

Extension wrappers: extension supplied functions

Object-tracking

Maintain, control modification and provide info for cleanup.

Recovery

Detect and recover from a variety of extension faults.​

Detects when the processor raise an exception

All extension access domain-local memory is managed and tracked through wrappers.

Nooks Implementation

This part talks about implementation of Nooks.

Isolation

Memory Management

Light-weight kernel protection domain each contains a single extension. All extensions exist in the kernel’s address space but with different access right: e.g. the kernel has full access to the entire address space, while each extension is restricted to read-only kernel access and full access to itself.

The Nooks maintains a synchronized copy of the kernel page table for each domain. Each Light-weight kernel protection domain has private structures, including heaps, stacks, MMIOs and kernel memory buffers.

Extension Procedure Call (XPC)

XPC transfer control safely between extensions and the kernel. These functions take a function pointer, an argument list, and a protection domain. The transfer routines save the caller’s context on the stack and find a stack for the calling domain, change page tables to the target domain, and then call the function. The reverse operations are performed when the call returns.

Modifications to Kernels

  1. Maintain extension page tables and insert code wherever the kernel modifies kernel page table.
  2. Modify exception handlers to detect domain exceptions. On return from exception, the code restores the stack pointers and page table.
  3. Use a global variable to hold the task pointer since original system store task structure in stack.

Interposition

Wrapper stubs: provide transparent control and data transfer across address space boundaries. Wrappers are in kernel's domain

Kernel wrappers: kernel supplied functions

Extension wrappers: extension supplied functions

Object-tracking

Maintain, control modification and provide info for cleanup.

Recovery

Detect and recover from a variety of extension faults.​

Detects when the processor raise an exception

All extension access domain-local memory is managed and tracked through wrappers.

A new world is opened

start simple and refine careful.