Saturday, June 27, 2009

RAID

RAID2 uses error correction codes to fix incorrect data when read from disk. Data are stipped in bit sized chunk. A dedicated disk to containt he error correction codes.

RAID3 and RAID4 uses a dedicated parity disk and requires at least 3 disk to function. The difference is that RAID3 use byte sized chunk and RAID4 uss block sized chunk. A common way to calculate parity is using XOR.

RAID5 removed the bottleneck of the dedicated parity disk. Parity are stored in all disk in a round-robin fashion. It also requires at least 3 disks to function.

Master Boot Record

MBR resides in the first 512-bytes sector on the device. The first 446 bytes contains the boot code, followed by 4x16-bytes partition table entries. There are 2 types of partition in MBR:

(1) A primary file system partition contains file system.
(2) A primary extended partition contains additional partitions.

An extended partition contains 1 secondary file system partition (called logical partition in Windows) and 1 secondary extended partition. The secondary extended partition contains more partitions in a recursive fashion.

To illustrate, a disk with 6 partitions may have the following partition structure:
- 3xparimary file system partitions (C:, D:, E:)
- 1xparimary extended partition
- 1xsecondary file system parition (F:)
- 1xsecondary extended partition
- 1xsecondary file system partition (G:)
- 1xsecondary extended partition
- 1xsecondary file system partition (H:)

Volume

Volume is a collection of addressable sectors recognized by the OS. Volume assemble multiple storage devices into one logical unit. Volume can be sliced into smaller partitions. Partitions can in turn build volume.

Saturday, June 20, 2009

Shader

Previously, programmer uses Fixed Function Pipeline (FFP) to send instruction directly to the GPU. Shaders are program written in HSLS (MS) or Cg (C for Graphic) that are executed by GPU. Vertex Shader are run once for every vertex in the viewing frustum to set the position of the vertex based on the world and camera settings. Once the postion data is created, rasterization translate the triangles into a set of pixel. Pixel Shaders then run for each pixel to determine the colour. Then the data is output to the screen.

Viewing Frustum

It defines an area in the 3D world of what is visible to the camera. The frustum is confined by the near clipping plane and a far clipping plane. Only objects in the frustum will be drawn. When a player move and far objects (e.g. building, mountain) suddenly pops up because the object has entered the far clipping plan.

SCSI

Small Computer System Interface versions differ in the number of bit per transfer, speed and types of signal.

(a) number of bits
SCSI (normal) - 8 bits, 5MB/s
SCSI (wide) - 16-bits, 10MB/s

(b) speed (frequency)
Fast SCSI, Ultra, Ultra-2, Ultra-3 (Ultra-160) and Ultra-320

(c) Signal
Single-ended (SE) use a strong voltage for 1 and no voltage for 0. This method is not stable with higher speed and longer cable.
Differential Voltage uses 2 wires. No voltage on both wire represents 0. Opposite voltage applies to the wires to represent 1. HVD (Hign Voltage Differential) was the inital standard. LVD was now the more common type. Some LVD can operate in SE mode but results in slow speed.

DCO

Device Configuration Overlay was introduced in ATA-6 to allow hiding of disk capabilities. DCO allows user purchases drives from different vendors which have different storage space to appear offering same number of sectors.

 DCO caused the IDENTIFY_DEVICE command to show a subsut of features and smaller disk size. DCO uses DEVICE_CONFIGURATION_SET command to reserve specified storage at end of the disk. The usable disk space could be further reduced by using HPA.

DCO is also managed via ATA commands like HPA.

HPA

Host Protection Area was introduced in ATA-4 to allow computer vendor to save data that would not be erased when a user formats the hard disk. It is intended manufacturer to stow diagnosis tool and backup image so that they do not need to ship an install CD.

HPA was an area set aside at the end of the disk using SET_MAX_ADDRESS command. The command featured a "volatile" bit which allow the HPA to be effected at the next reboot. This allows user to read/write the HPA in the current session and lock the content after reboot.

HPA is invisible to both BIOS and OS.  It is managed by low level ATA commands.


Disk Password

There are 2 passwords in harddisk - user and master. The master password allows administrator to access the disk if user password is lost.

There are 2 operating modes. In high security mode, both user and master password can unlock the disk. In maximum security mode, the master password can unlock the disk only after the disk has been wiped.

Security is implemented using the ATA SECURITY_UNLOCK command which must be executed before any READ/WRITE ATA command. Some ATA commands are still usable without SECURITY_UNLOCK command and thus the disk may be recognizable by the system.

IDE/ATA

IDE (Integrated Disk Electronics) refers to disk with a logic board built-in, as comparing to older disk. ATA (AT Attachement) refer to the interface of IDE disk. ATA disks requries a controller which is built into the motherboard. ATA cables has a maximum length of 18 inches and uses 40-pins. The cable contains an extra 40-wires which do not connect to the pin to improve insulation.

Early ATA disks were addressed by CHS (Cylinder/Head/Sector). The disparaty between the ATA standard and older BIOS on the number of bits used for CHS has limited the size of IDE disk to 504MB. Newer BIOS translate the CHS address to ATA standard and this extended the addressability to 8.1GB. To overcome the limitation, CHS was replaced by LBA (Logical Block Address) in later ATA standard.

ATA-1 (1994) - support CHS and 28-bit LBA
ATA-3 (1997) - added Self-Monitoring Analysis amd Reporting Technology (SMART) which allows monitoring of several parts of the disks. Another feature was Password Protection.
ATA/ATAPI-4 - ATA Packet Interface for removable media. ATAPI used the same cable and controller but required special drivers. 80-wire cable was introduced. Add HPA (Host Protection Area) for vendor to keep data that would not be erased by formatting the disk.
ATA/ATAPI-6 (2002) - Added 48-bit LBA and removed support for CHS. Add DCO (Disk Configuration Overlay).
ATA/ATAPI-7 - Included serial ATA

Unicode

Unicode uses 4 bytes. There are 3 ways to store unicode character. UTF-32 uses 4 bytes for each character. UTF-16 stores most frequently used character in 2-byte values and less frequently used in 4-bytes value. UTF-8 uses 1-, 2- or 4-bytes values. UTF-8 and UTF-16 uses more processing comparing to UTG-32.