Documentation ¶
Overview ¶
Semfs is a semaphore file system. The original idea is from this book (Ballesteros 2006).
You can mount this file system via 9P using 9pfuse for example. The file system is initially empty, and you can make files on it. Each file represents a semaphore length of which is the number of tickets. To add tickets to an file, write the number of tickets to be added to the file. To consume a ticket, read the file.
$ 9pfuse localhost:5640 /mnt $ echo 1 > /mnt/sem $ ls -l /mnt/sem -rw-rw-rw- 1 kenji kenji 1 Jan 17 08:16 /mnt/sem $ cat /mnt/sem $ ls -l /mnt/sem -rw-rw-rw- 1 kenji kenji 0 Jan 17 08:17 /mnt/sem
Reading a file with length 0 blocks until someone adds tickets to the file.
$ ls -l /mnt/sem -rw-rw-rw- 1 kenji kenji 0 Jan 17 08:17 /mnt/sem $ (cat /mnt/sem; echo done) & sleep 1; echo write; echo 1 > /mnt/sem [2] 42872 write $ done
Usage:
semfs [-D]
The Flags are:
-D print very chatty 9P conversation dialogue to the standard output.
Click to show internal directories.
Click to hide internal directories.