Hello all, U have a project that I am trying to figure out how to start, I don't have very strong programming skills, so I'm actually quite lost here. Any help is appreciated. Basically here is what I have to do:
8 processes are characterized by 5 readers and 3 writers.
Critical section in this problem is reading shared data buffer for reader and updating shared data
buffer for writer processes. It is up to you to implement any shared data for readers and writers
but you have to specify clearly following things in your sample output.
• When reader or writer enters its critical section, it has to report whether there are any reader(s)
or writer(s) other than himself.
• You may print out the data you read or write when you implement real buffer. (Optional)
• You have to print out “Panic Messages” when the rules behind this semi critical section problem
are not observed.
In your main program, you run the random number generator function to choose a process to
execute. The chosen process starts (resumes) execution and after one instruction, it will be
returned. (You should force each process run exactly one instruction then returns and waiting for
its turn.)
You can implement this using switch statement in C. Each process is one big switch statement
and will be returned after each instruction. You need to keep track of program counter of each
process to resume at the right place once it will be chosen to run by keeping global counter
variable per process.
Subproject 1: You should implement a CS problem with test and set operation as studied in the
class for this project.
In this simulation, only one reader or writer should be in its critical section. Panic messages
should be generated whenever multiple reader or writer processes are found in the critical
section.
Subproject 2: You should implement a SCS problem with binary and counting semaphores as
studied in the class for this project.
Multiple reader processes can be inside their critical section without any writer process. For a
practical reason, let’s limit the number of reader inside the critical section is limited to 3.
That means if a reader process trying to get in the critical section finds 3 other readers
already inside their critical section, 4th reader should be blocked entering critical section
until one of the readers already inside the critical section get out of it.
For writer process to go into its critical section, it should check whether there is any reader or
writer process is in the critical section.