This assignment implements a simple batch-oriented operating system, which behaves as follows:
The index block - disk block 0, the first block on the disk - contains an index of the programs in the disk. The ith word of the index block contains the size in disk blocks of the ith program in the batch disk. Unused entries in the index block are set to zero. Every batch disk contains an index block.
For example, this diagram
shows a batch disk containing three programs. The first program has size 3; that is, the first program occupies three disk blocks. The second program has size 1 and the third program has size 2.
A program is laid out on disk as a sequence of disk blocks. The order of the program’s contents on disk must be preserved in primary storage when a program is loaded into primary storage for execution. The program’s disk-block contents must not be re-arranged in primary storage, and all the program’s disk blocks must be read into primary storage before the program can be run.
A program is loaded in User Space in order of increasing addresses. The
contents of the program’s first disk block is loaded into User Space
starting at location i; the contents of the program’s second disk
block is loaded into User Space starting at location i +
Hardware.Disk.blockSize
, and so on. The
program’s blocks must all fit in User Space. A program may be loaded
anywhere in User Space it can fit.
Once loaded into primary storage, the program’s first instruction has address i, the address of the first word of the program. The program counter should be set to i when the process first executes.
After boot-up initialization, the operating system should load and begin executing the first program on the batch disk; word 0 of the index block contains information on the first program. If the batch disk contains no programs, the operating system should halt.
Your operating system needs to support one system call: exit
. This is the
first of many system calls you will be implementing in these assignments, so
you might want to give some though to designing an easily changeable
system-call implementation (or you have to be willing to throw-away and rewrite
your system-call implementation several times, which is probably the better
approach to take).
OperatingSystem.SystemCall.exit
)
pa1-empty.dsk
- The empty disk; it contains no programs.pa1-solo.dsk
- A single program does nothing for a while and then
calls exit.Here are examples of successful runs of an operating system on each disk:
$ java -cp arcsim.jar:. main os pa1-empty The system is halted. Total execution time: 10 ticks, idle time: 9 ticks (90%). $ java -cp arcsim.jar:. main os pa1-solo The system is halted. Total execution time: 429 ticks, idle time: 99 ticks (23%). $
For this assignment, as long as your operating system runs correctly the numbers produced by your operating system don’t matter. As a sanity check, however, the numbers produced should be within 50% of the numbers shown above.
Here are the same executions with run-times included:
$ time java -cp arcsim.jar:. main os pa1-empty The system is halted. Total execution time: 10 ticks, idle time: 9 ticks (90%). real 0m0.415s user 0m0.300s sys 0m0.080s $ time java -cp arcsim.jar:. main os pa1-solo The system is halted. Total execution time: 429 ticks, idle time: 99 ticks (23%). real 0m0.410s user 0m0.316s sys 0m0.076s $
If you’re looking for a way to proceed, you might want to consider the following steps: