Technical Overview


Contents

Note: All italic words in this document are for extra credits or design specific and not required for your MP3.

Shell Commands

Command Description
exit Quit the current Zinix Shell program.
Will try to restart if the last shell in the current terminal is terminated.
[Executable] [Arg] Search and open the program in the current terminal.
Some program may require arguments (see below).

Combinational Keys

Combination Action Description
Alt+F1 Switch to Terminal 1 (See below)
Alt+F2 Switch to Terminal 2 (See below)
Alt+F3 Switch to Terminal 3 (See below)
Ctrl+C Interrupt Quit the active process in the current terminal.
Ctrl+L Clear Screen Clear the VRAM and reset the cursor.

File System Directory

File Name File Kind Description
. Directory Holds information and refers to the directory itself.
sigtest Executable Argument: 0 or any. Used to test signals.
Use arg 0 to generate a PF without handler installed.
Use any arg except 0 to install handlers for alarm and segfault, and generate a PF.
shell Executable Zinix shell. The underlying program running in each terminal.
grep Executable Argument: a pattern. Prints lines that contain a match for the pattern.
syserr Executable Used to test illegal user program arguments.
rtc Device Giving user-level access to the real-time clock (RTC).
fish Executable Used to test vidmap and RTC. Display a fish animation in the current terminal.
counter Executable A numerical counter.
pingpong Executable Used to test RTC. Infiniately print a ping-pong animation in the current terminal.
Can only be terminated by Ctrl+C or Process Manager.
cat Executable Argument: a file name. Try to open and read the content of a file/directory/device.
frame0.txt Regular File A frame of fish animation.
verylarge~.txt Regular File Used to test very long file name handling.
ls Executable List the directory.
testprint Executable Used to test the terminal driver.
created.txt Regular File Author information left by ECE 391 staff.
frame1.txt Regular File Another frame of fish animation.
hello Executable Used to test the terminal driver (input buffer).

Assembly Linkages

Whenever there is a trap, processor jumps to the assmebly linkage from the IDT.
Assembly linkages for interruption, exception, and system calls are different, but they all construct a hardware context for furture restoring or usage.
They will also push/pass through arguments accordingly, and call the corresponding handlers.
When going back to the user space, it also dispatches any pending signal (see below).

Exception Handlers

Linkage pushes information and calls an unified exception handler.
Then, the handler will send a signal to the process for further handling.

Interrupt Handlers

Linkage pushes information and calls an unified interrupt handler.
Then the handler will dispatch to the corresponding drivers.
The IRQ lines are managed by two i8259 PICs just like any other classic IBM-compatible PC.

Supported Devices

Zinix has drivers for the standard keyboard, programmable interval timer (PIT), real-time clock (RTC), and terminal.
The standard keyboard driver adds support for capital letter handling and combinational keys.
The PIT driver is used to handle the scheduling and can be turned off (see below).
The RTC driver supports frenquency adjusting and is "virtualized," so each process has its own RTC instance (see below).
The terminal driver is for standard input and output and works with keyboard driver. The input buffer is limited at 128-characters.

Memory Addressing

Zinix bypassed segmentation just like any modern operation systems, only paging was used for memory addressing.
The memory layout is fixed (see below).

Physical Memory Layout

From low to high, Zinix utilized 32MB of physical memory:

Virtual Memory Layout

From low to high, Zinix utilized the following in the 4GB virtual memory space:

File System

The Zinix FS has a total size of 8MB, and is divided into 4KB blocks of one boot block, inodes, and data blocks.
Each boot block can track up to 62 inodes and one root directory, and each inode can track up to 1023 data blocks.
The limitations are up to 62 files of 4092KB size and 32 characters name length. Also, it does not support hierarchy and is read-only.

File System Abstraction

Zinix treat any files, device (RTC), and directory as files. Each process has a dynamic file descriptor (FD) that supports 8 open files.
According to the file type, each entry tracks inode, position, flags, and an operation jump table, and is utilized by syscalls (see below).

System Calls

System Call Description
halt Halt the current program (process).
execute Load and execute a new program.
read Read data from a opened file (see file system abstraction above).
write Write data to a file (support terminal and device/RTC only).
open Allocate FD entry and open a file.
close Close the FD entry and close a file.
getargs Read the command line argument from shell.
vidmap Giving user-level access to the VRAM and map it to the user space.
set_handler Set custom handler for signal (see below).
sigreturn Restore the hardware context from signal handler (see below).

Please note that the last two system calls are for extra credit; they are not required.
These system calls are handled accordingly in kernel from linkage.

Process Control

Zinix supports up to 6 processes. Each process holds a process control block (PCB) in the kernel.
The kernel manages the PCB allocation by a custom design called PCB pool.
Each PCB tracks the allocated process ID (PID), parent PID, terminal ID, kernel/user stacks, FD, etc.

Multiterminals

Zinix supports up to 3 terminals. Each terminal holds a custom design called terminal info (TI) block in the kernel.
Each TI block tracks the PCB pointer, coordinations, RTC parameters, etc.

Scheduler

Zinix supports a round-robin scheduler that can be turned off and a virtualized RTC for each process.
The scheduler schedules 3 processes that is shown on each terminal, called active processes, so they can multitask.
But only one process is "actually" running, called running process.
Turning off scheduler will disable the multitasking, but it mimics the environment for your work prior to CP5.

Signals

Please note that signals are for extra credit; they are not required.

Signal Sender Default Handler
DIV_ZERO Exception Handler Kill the process.
SEGFAULT Exception Handler Kill the process.
INTERRUPT Keyboard Driver Kill the process.
ALARM RTC Driver Ignored.
USER1 N/A Ignored.
SYSKILL Kernel Not user-installable, always kill the process.

The first five signals supports a custom user-installed handler through set_handler system call.
You will need to implement the first five to be eligible to receive extra credit for the signals in your MP assignment.
Linkage is carefully engineered to construct the stack, so signals are checked and delivered during any context switch (see above).


Back to Top