Operating Systems Project 6

This is the second of a two-part capstone project for ICS 612. In this part, you will implement what you proposed in the first part.

If you are working in a group, you implement the project proposed by one of the people in your group.

If you prefer, rather than doing the project (one of) you proposed, you may implement one of the following.

At the end of the project, please let me know how you did.

Alternative 1

Write a program to be executed on seL4. This program must include a driver for the timer interrupt and a driver capable of sending output to the console. The output should be the current time (in any reasonable form, e.g. seconds since boot). The output must be updated every second.

Alternative 2

Do the same as in Alternative 1, but to run on the bare machine (bare metal) rather than on seL4.

Alternative 3

Design and implement a user-space file system. For testing, the file system must provide a user interface for a user to create files of a given size, contents, and name, read them, and remove them. Optionally you may support directories and folders, or you may support writing to the end of a file, which requires some sort of reallocation.

The implementation of the file system must be persistent, and use a regular file as its "disk space", similar to the way many virtual machines provide "disk" space. This "disk space" must be split into as many 512-byte sectors as fit in the file, so for example if the underlying file is 1023 bytes long, you have 1 512-byte sector and 511 bytes of unusable space.

If, to make your life easier, you wish to limit the length of file names, your file system must support at least 12-character filenames.

Alternative 4

Write a fixed-sized queue implemented with an underlying array. The queue must support re-entrant access, that is, insertion and removal operations being called by several threads at the same time. Because of this, access to the queue must be regulated with pthread_mutex_lock and pthread_mutex_unlock.

The queue must be a queue of type int.

A thread inserting into the queue must block if the queue is full. Likewise, a thread removing from a queue must block if the queue is empty.

Write a driver program that takes, on the command line, a number of insert threads and a number of remove threads -- e.g. queue_test 64 15 7 creates a 64-element queue, 15 insert threads, and 7 remove threads.

Each insert thread inserts 1000 values into the queue. For insert thread 77, these values are 77000, 77001, 77002, 77003, up to 77999.

Each remove thread removes 1000 values from the queue. Each value removed is printed, preceded by the thread number, for example, for thread 22, thread 22: removed 77001.

Note that if there are more insert threads than remove threads, some of the insert threads may block forever (depending on the size of the queue). Similarly if there are more remove threads than insert threads, some of the remove threads will block forever. Your driver program should terminate once all the insert or remove threads have completed. In the above example, your program should terminate once all remove threads have completed. With a call of queue_test 10 40 40, the driver program must terminate once all 80 threads (40 insert threads and 40 remove threads) have completed.

Threads must be created with pthread_create.

For All Alternatives

Send me your entire code, and a description of what you did and how well it worked.

You must clearly identify which code you are the author(s) of, and which code you have taken from which source.

For alternatives 3 and 4 (only), you have to be the author(s) of all the code.