Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions W10D1/W10D1-LinyuWu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# VirtIO

VirtIO is a standardized interface which allows virtual machines access to simplified "virtual" devices, such as block devices, network adapters and consoles. Accessing devices through VirtIO on a guest VM improves performance over more traditional "emulated" devices, as VirtIO devices require only the bare minimum setup and configuration needed to send and receive data, while the host machine handles the majority of the setup and maintenance of the actual physical hardware.

## Tech Details
VirtIO devices appear, to the guest VM, to be normal PCI devices with a specific VendorID and DeviceID. All VirtIO devices have a Vendor ID of 0x1AF4, and have a DeviceID between 0x1000 and 0x103F. The type of VirtIO device (Network Adapter, Block Device, etc.) can be determined by the Subsystem ID field in the PCI Configuration Space for the device.

## IO Registers
Based on the PCI subsystem ID, the I/O mapped registers for the device can be determined. All devices have a common "header" block of registers:

```
Offset (Hex) Name
00 Device Features
04 Guest Features
08 Queue Address
0C Queue Size
0E Queue Select
10 Queue Notify
12 Device Status
13 ISR Status
```

The Device Features register is pre-configured by the device, and includes flags to notify the guest VM what features are supported by the device. The Guest Features register is used by the guest VM to communicate the features that the guest VM driver supports. This allows both the host and the guest to maintain both backward and forward compatibility.
The Device Status field is used by the guest VM to communicate the current state of the guest VM driver. The flags in this register designate when the driver has found the device, when the driver has determined that the device is supported, and when the all of the necessary registers have been configured by the guest driver, and communication between the guest and host may begin.

```
Flags Description
01 Device Acknowledged
02 Driver Loaded
04 Driver Ready
40 Device Error
80 Driver Failed
```
43 changes: 43 additions & 0 deletions W14D1/W14D1-LinyuWu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Review

## History

Omitted.

## Virtualization

Operating system-based Virtualization refers to an operating system feature in which the kernel enables the existence of various isolated user-space instances. The installation of virtualization software also refers to Operating system-based virtualization. It is installed over a pre-existing operating system and that operating system is called the host operating system.

In this virtualization, a user installs the virtualization software in the operating system of his system like any other program and utilizes this application to operate and generate various virtual machines. Here, the virtualization software allows direct access to any of the created virtual machines to the user. As the host OS can provide hardware devices with the mandatory support, operating system virtualization may affect compatibility issues of hardware even when the hardware driver is not allocated to the virtualization software.

Virtualization software is able to convert hardware IT resources that require unique software for operation into virtualized IT resources. As the host OS is a complete operating system in itself, many OS-based services are available as organizational management and administration tools can be utilized for the virtualization host management.

Some major operating system-based services are mentioned below:

Backup and Recovery.
Security Management.
Integration to Directory Services.
Various major operations of Operating System Based Virtualization are described below:

Hardware capabilities can be employed, such as the network connection and CPU.
Connected peripherals with which it can interact, such as a webcam, printer, keyboard, or Scanners.
Data that can be read or written, such as files, folders, and network shares.
The Operating system may have the capability to allow or deny access to such resources based on which the program requests them and the user account in the context of which it runs. OS may also hide these resources, which leads that when a computer program computes them, they do not appear in the enumeration results. Nevertheless, from a programming perspective, the computer program has interacted with those resources and the operating system has managed an act of interaction.

With operating-system-virtualization or containerization, it is probable to run programs within containers, to which only parts of these resources are allocated. A program that is expected to perceive the whole computer, once run inside a container, can only see the allocated resources and believes them to be all that is available. Several containers can be formed on each operating system, to each of which a subset of the computer’s resources is allocated. Each container may include many computer programs. These programs may run parallel or distinctly, even interrelate with each other.

## Process

A process is essentially running software. The execution of any process must occur in a specific order. A process refers to an entity that helps in representing the fundamental unit of work that must be implemented in any system.

In other words, we write the computer programs in the form of a text file, thus when we run them, these turn into processes that complete all of the duties specified in the program.

A program can be segregated into four pieces when put into memory to become a process: stack, heap, text, and data. The diagram below depicts a simplified representation of a process in the main memory.

Stack: Temporary data like method or function parameters, return address, and local variables are stored in the process stack.

Heap: This is the memory that is dynamically allocated to a process during its execution.

Text: This comprises the contents present in the processor’s registers as well as the current activity reflected by the value of the program counter.

Data: The global as well as static variables are included in this section.
19 changes: 19 additions & 0 deletions W6D1/W6D1-LinyuWu.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# EXT2

## Block

The Ext2 file system divides up disk space into logical blocks of contiguous space. The size of blocks need not be the same size as the sector size of the disk the file system resides on. The size of blocks can be determined by reading the field starting at byte 24 in the Superblock.

## Block Group

Blocks, along with inodes, are divided up into "block groups." These are nothing more than contiguous groups of blocks.
Each block group reserves a few of its blocks for special purposes such as:

- A bitmap of free/allocated blocks within the group
- A bitmap of allocated inodes within the group
- A table of inode structures that belong to the group
- Depending upon the revision of Ext2 used, some or all block groups may also contain a backup copy of the Superblock and the Block Group Descriptor Table.

## Inode

An inode is a structure on the disk that represents a file, directory, symbolic link, etc. Inodes do not contain the data of the file / directory / etc. that they represent. Instead, they link to the blocks that actually contain the data. This lets the inodes themselves have a well-defined size which lets them be placed in easily indexed arrays. Each block group has an array of inodes it is responsible for, and conversely every inode within a file system belongs to one of such tables (and one of such block groups).