aboutsummaryrefslogtreecommitdiff
path: root/sync/assign.rst
diff options
context:
space:
mode:
authorTucker Evans <tuckerevans24@gmail.com>2019-02-18 07:35:54 -0500
committerTucker Evans <tuckerevans24@gmail.com>2019-02-18 07:35:54 -0500
commite8b1808eaf87a49e4c34ebbfb66854baa627418c (patch)
tree8a4bb15321992702b6b26e34bd2ed3a55bb7b0d9 /sync/assign.rst
parent6cc5652a8af3361288393718ec2adb2889c9af1e (diff)
Moves assignments to given course folder.
Diffstat (limited to 'sync/assign.rst')
-rw-r--r--sync/assign.rst41
1 files changed, 0 insertions, 41 deletions
diff --git a/sync/assign.rst b/sync/assign.rst
deleted file mode 100644
index ea4a566..0000000
--- a/sync/assign.rst
+++ /dev/null
@@ -1,41 +0,0 @@
-================
-Syncronization 1
-================
-
-Write a program that uses semaphores to implement a readers/writers solution. Your program should:
-
- - be written in C and use the standard kernel IPC mechanisms (semget,semop,shmget etc)
- - be written as a single top level source file compiled as: gcc –o myprog myprog.c
- - take two arguments on the command line: myprog NR NW where NR,NW are each integers specifying the number of reader/writer processes respectively
- - use fork/exec to create the readers/writers
-
-The shared memory segment should be 16k bytes in size, with all bytes initialized to 0x30
-
-Reader:
-
-.. code ::
-
- open a file (for append) named reader.N, where N is the reader number
- while (1) {
- for (i=0; i<16k; i++) {
- read the next byte of the shared memory segment
- write that byte to the file
- flush the file
- }
- sleep a random number of seconds, between 0 and N inclusive
- }
-
-Writer:
-
-.. code ::
-
- while (1) {
- for (i=0; i<16k; i++)
- shared memory segment[i] = N + 0x30;
- sleep a random number of seconds between 0 and 2*N inclusive
- }
-
-readers and writers should be mutually exclusive
-multiple concurrent readers are allowed
-writers have priority over readers
-writers are mutually exclusive relative to each other