Blog
CSE 330 – Operating Systems
CSE
330 – Operating Systems, Spring 2020
Project
4, Due:
April 25th 2020, 23:59 PM
Strictly
Individual Projects, 10% deduction for each day late
1.Readers
and Writers:
Using
the semaphores you have implemented, implement the Readers and
Writers Problem.
2.Test
case:
Have
a global variable int
i
and set it to 0 initially.
The
readers should read the variable value and print the current value of
the variable. Each reader should print the variables twice. The
writers should write their ids in the variable. The writer should
write in one go and then verify that the correct Id is written into
the variable.
Readers
and writers do not run in infinite loop, but reader reads twice while
writer writes and then again verifies.
The
reader yields after one read and then finishes after the second read.
- On
the first
read the reader prints:- Printf(“This
is the %d th reader reading value i = %d for the first time”,
readerID, i );
- Printf(“This
- On
the second read
the reader prints:- Printf(“This
is the %d th reader reading value i = %d for the second time”,
readerID, i );
- Printf(“This
The
writer yields after the first write and then exits after the
verification step.
- On
the first
write the writer prints:- Printf(“This
is the %d th writer writing value i = %d ”, writerID, i );
- Printf(“This
- On
the verification
loop the writer should print:- Printf(“This
is the %d th writer verifying value i = %d ”, writerID, i );
- Printf(“This
Have
5 readers then 1 writer then 4 readers then 2 writers then 5 readers
then 1 writer and then 3 readers.
The post CSE 330 – Operating Systems appeared first on My Assignment Online.

