I have two program problems:
a program that generates this file writing zeros for PID
and TIME and random numbers in the 8 pozitions of the DATA
program that will create at least 3 child
processes, each of which will repeat at least 10 times the
following operations on the file given above. Each child
process will generate a random number STEP between 1 and
10. The child process will process all the records on
positions multiple of STEP. Every number in the DATA field
will be added he largest power of 5 smaller than it. The PID
and TIME fields will be modified accordingly. To avoid
interference among the processes, all the records to be
processed will be locked beforehand using lockf(). After the
processing of the records is over, they will be unlocked. Lock
the records in the order they are stored inthe file. Then, try
to lock them in an arbitrary order and possibly add a second
delay after each lock is applied.

8 Years
Discussion Span
Last Post by baku

the file should be a binary file containing 100 records of 38 bytes each
with the following format:

| Bytes | Name | Content |
| 0 - 1 | PID | PID of the last modifier process (short int) |
| 2 - 5 | TIME | Time of the last chage in milisec (long int) |
| 6 - 37 | DATA | Sequence of 8 natural numbers (int) |

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.