Click here to Skip to main content
15,899,825 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i can't reach a solution for this problem :
i want to design and implement a programming solution to the reader-writer problem
using semaphores in C language under UNIX.
We assume that we have three readers and two writers processes that would run concurrently.
A writer is to update (write) into one memory location (let’s say a variable of type integer named
temp initialized to 0). In the other hand, a reader is to read the content of temp and display its
content on the screen in a formatted output. One writer can access the shared data exclusively
without the presence of other writer or any reader, whereas, a reader may access the shared
memory for reading with the presence of other readers (but not writers).
Posted
Updated 30-Dec-11 22:30pm
v2
Comments
[no name] 30-Dec-11 18:15pm    
What I do not understand: Why divide n readers and writers. Is it not simply a question that "something" is “under construction” (for readers and writers)? And with this assumption is it not more easier simply take a critical section?

Maybe I’m wrong but better ask then speculate.

Regards.
Sergey Alexandrovich Kryukov 31-Dec-11 0:46am    
I would say you are right. Maybe OP is missing something in the description of functionality.
--SA

1 solution

http://en.wikipedia.org/wiki/Readers-writers_problem[^]
We don't do your homework for you. If you can't write C code from the pseudocode solution found in Wikipedia and computer science textbooks, better find some other area of study.
 
Share this answer
 
Comments
hussein12 9-Jan-12 10:32am    
f*** off i don't need your help and this not a homework this is a case that i am tryin to handle it i am an operating system engineer i am lookin for peaple to find solution for this problem if u don't have an answer keep your bullsh**t to your self
hussein12 9-Jan-12 10:32am    
people*

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900