560 Project Specification
DUE : CLOSE WEEK
1. REQUIREMENTS:
To implement and compare the performances of buffer management algorithms
on the MTX system.
2. SYSTEM ORGANIZATION:
The system organization is as shown below.
Box#1
------------------------
| TaskInputs | Display |
------------------------
Box#2
-----------------------
| Multitasking System |
| |
| ReadyQueue -> Tasks;|
| SemaphoreQ -> tasks;|
| |
| BufferManager |
| I/O buffers |
| freelist;dev_lists; | Box#3 Box#4
| (Hash Queues) | ------------- ----------
| | Commands | Disk | | Disk#1 |
| DiskDriver | ============> | Controller| ===> | |
| | DataOut | | Read | Disk#2 |
| I/O_queues | ============> | | Write | |
| | DataIn | | Seek | ..... |
| | <============ | | OFF | |
| | | | | |
| | DiskInterrupts | | | Disk#N |
| IntHandler <----|-----------------| | | |
| | IntStatus | | | |
| | <============ | | | |
| | | | | |
| IntAck ----|==============> | | | |
| | | | | |
----------------------- ------------- ----------
CPU Side InterFace Disk Side Disks
(1). Box#1:
TaskInputs = a sequence READ/WRITE requests of the form:
[R xxx yyyy] or [W xxx yyyy], where xxx=dev,yyyy=blkno;
During development, you may use prompts to input
such commands for the running task.
During final testing, each task should have its own
sequence of input commands. For example, each task
may read commands from an input file. After a task
switch, task inputs will be read from a different
file.
Display = This displays prompt messages, results of the Show
commands, which display task queues, buffer hit ratio,
and Trace information, etc.
(2). Box#2:
This is the CPU side of a Multitasking system. While running,
a task may prompt (during development) for an input command.
In addition to the usual task related commands, two Disk I/O
commands, [R dev blk] and [W dev blk], are needed for reading
writing disk blocks, respectively.
BufferManager : For a Disk I/O command, the task must interact
with BufferManager, which in turn may invoke
DiskDriver to issue physical disk I/O.
DiskDriver : DiskDriver manitain disk I/O_queues and issues
physical I/O to DiskController.
IntHandler : This is the disk interrupt handler. Upon
receiving a disk interrupt, it first ACKs the
interrupt. Then it reads the Interrupt Status
from IntStatus, which contains:
[dev | R/W | StatusCode]
|<--- e.g. 8 chars --->|
where dev is the disk#. The R/W code is optional
since it is also in the buffer of the current
I/O operation.
********** PIO Behavior of IntHandler: ********
For a disk READ interrupt, IntHandler must first
move the block data from DataIn into the buffer's
data area.
Before issuing a disk WRITE operation, IntHandler
must copy the buffer's block data to DataOut.
***********************************************
(3). Box#3: This is the DiskController, which is a (Unix) child process of
the CPU, our main Unix process. As such, it operates (almost)
independently with the CPU except for the communication channels
between them, which are shown as the
Interface Between CPU and DiskController:
********** These are implemented as Unix Pipes ****************
Commands, DataOut : commands and data from CPU to DiskController;
DataIn, IntStatus : data and Status from Diskcontroller to CPU;
***************************************************************
DiskInterrupts : Interrupts from DiskController to CPU;
Implemented by SIGUSR1 (#10) signal.
CPU may mask out/in disk interrupts (signals).
Diskcontroller may use Unix kill() to raise an
interrrupt to CPU. To prevent race condition,
each interrupt must be ACKed before the device
can interrupt again.
(4). Box#4: These are "virtual" disks, which are simulated by Unix files.
Using Unix lseek(), read(), write(), we may support any
block I/O operations on the virtual disks.
3. Requirements:
3-1. Implement 2 versions of UNIPROCESSOR buffer management algorithms:
Unix Algorithm (using sleep/wakeup) Vs.
YOUR algorithms using semaphores.
and COMPARE their performances in terms of
hit-ratio, numbers of actual I/O, task switches, re-tries,
total run time (and other metrics)
under different task/buffer ratios.
3-2. Implement 2 versions of MULTIPROCESSOR buffer management algorithms
SystemV Vs YOUR MP algorithm
and compare their performances.
==============================================================================
Sample Base Code Files:
~560/PROJECT/SIMULATOR/:
HOW ioc.c = IOController
(main.c queue.c s.s) = CPU for Uniprocessor MTX
cc -o IOC ioc.c ===> IOC
cc main.c s.s ===> a.out
a.out ntask nbuffer ndev nblock nsamples
e.g. a.out 4 16 4 16 1000
a.out 16 4 4 16 1000
etc
=============================================================================