CSC443 Feb12

slide version

single file version

Contents

  1. Terminals and PseudoTerminals
  2. Threads and fork and exec
  3. File Systems
  4. Heap memory
  5. Segments
  6. Allocating memory for thread stacks
  7. Virtual Machines
  8. Privileged and Sensitive Instructions
  9. Intel popf
  10. Virtual Machine and Virtual Memory
  11. Virtualization vs Paravirtualization
  12. Xen
  13. Xen and I/O
  14. Xen: Some Performance Issues
  15. uthreads guide

Terminals and PseudoTerminals[1] [top]

echo input
Buffering

Threads and fork and exec[2] [top]

Duplicate all threads or just the calling thread if fork() called?

File Systems[3] [top]

Low Level
Higer Level

E.g., Linux VFS (virtual file system)

Window supports multiple file systems: e.g., FAT16, FAT32, NTFS

Linux VFS supports multiple file ext2, ext3, ext4, and the Windows file systems.

Linux Interface in C

Each file system has its own FileObject (below) and must provide the functions that are inserted into its FileObject's array of file_ops.

typedef struct {
  unsigned short refcount;
  struct file_ops *file_op;
  /* function pointers */
} FileObject;

Access at higher level is through an array of function pointers. Higher level uses same interface for all file systems, just a different FileObject instance.

Heap memory[4] [top]

Segments[5] [top]

Allocating memory for thread stacks[6] [top]

Choices

Virtual Machines[7] [top]

An "efficient" isolated duplicate of a real machine.

Virtual Machine Real Machine
User  
Privileged User
  Privileged

The virtual machine runs on the (real) processor.

Privileged and Sensitive Instructions[8] [top]

On the real machine

Executing Real Processor Mode Action
privileged user traps to real os
privileged privileged executes fully
sensitive user executes (reduced) effect (no trap)
sensitive privileged executes (full) effect

Intel popf[9] [top]

This pops a value off the stack and uses it to set the flags register.

This is a sensitive instruction.

If the processor is in user mode, the bit in the flags register to disable interrupts will not be changed by popf regardless of the value popped off the stack.

Virtual Machine and Virtual Memory[10] [top]

Virtualization vs Paravirtualization[11] [top]

Virtualization: Guest OS runs unmodified on host vmm.

Paravirtualization: Small modificatinos of Guest to make virtualization simpler and/or more efficient.

Modifications include to guests some hypervisor calls.

A hypervisor call is a mechanism that allows a guest os to make calls to the vmm (virtual machine monitor) running on the real machine.

Xen[12] [top]

Xen (see the text) provides virtual machines using paravirtualization.

Xen (like VMWare) uses a standard operating system for control functions including controlling actual devices. But it must be modified somewhat to handle the hypervisor calls from virtual machines and their guest OS's.

Unlike VMWare, guests VMs are NOT run as processes under control of the standard os.

In Xen guests are run in Xen "domains" that communicate with the standard os via hypervisor calls.

Three examples of paravirtualization in Xen:

  1. To avoid flushing the TLB (translation lookaside buffer: page table entry cache) when invoking the vmm, Xen mapped into the upper 64Mb of each VM address space.
  2. Guest allowed to allocated pages, just check that it didn't violate protection restrictions.
  3. To protect guest OS from user programs, Xen takes advantage of Intel processor's 4 protection levels:
    • Most OS's running on Intel only use level 0 (kernel) and level 3 (user)
    • Xen runs as VMM at level 0
    • Guest OS runs at level 1
    • Applications run at level 3

The operating systems that can be used as the "standard os" supported by Xen currently includes recent versions of Linux and NetBSD.

Xen and I/O[13] [top]

To simplify I/O, a separate domain can be used just to handle a device (perhaps running at a lower privilege level, but not at user level; e.g. level 1) - sometimes called a "driver domain".

(In Xen, "domain" == virtual machine)

Xen: Some Performance Issues[14] [top]

Linux has optimizations for:

uthreads guide[15] [top]

The functions you are to write to build your uthreads library naturally fall into 2 groups: the synchronization functions and the thread management functions (creation, scheduling, etc.)

Here is a suggested guide for first implementing and testing the management functions.

Once you have those working, you can implement and test the second group.