## usemtest

#### OS/161 Reference Manual

### Name

usemtest - test semfs (`sem:`) semaphores

### Synopsis

`/testbin/usemtest`

### Description

`usemtest` forks some subprocesses and uses the semfs semaphores to do coordinated printing. It is somewhat similar to the `sy1` in-kernel test for the in-kernel semaphores.

The first parts of the test open each semaphore separately in each process, so locking issues in the filetable and open-file code should not keep it from running. The last part opens the semaphores once and inherits the file descriptors through fork; it is likely to hang (including sometimes in fork) if the filetable and open-file locking is not just so.

### Requirements

`usemtest` uses the following system calls:

- fork
- open
- read
- remove
- waitpid
- write
- _exit

`usemtest` should run successfully once the basic system calls are complete. Until you implement the `remove()` system call the semaphores from the test will be left lying around afterwards, but this should not keep it from running.