Click here to Skip to main content
15,895,813 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello everyone,
I'm supposed to simulate how the operating system solves the reader writer problem using semaphores in c++ language. I spent 3 days working non-stop ( not literally ;P ) on it put it doesn't seem to do the job so i'm thinking of starting over with a new design. Does any have any idea how to do such a thing??
* The program should have reader and writer processes yet it doesn't necessarily has to be multi threaded { i don't know how to have that without using threads which are so hard for me to program ->> i know so little :(( }
* The program should tell if a process tried to enter the critical section put couldn't because another process is already there

please help me ... I only have till Monday to do it :((
Posted
Updated 31-Dec-10 6:52am
v2
Comments
Sergey Alexandrovich Kryukov 31-Dec-10 16:53pm    
This is not clear. If you can use semaphores already available in WIN32 API, what part to OS simulate? -- you only can use them. If you should simulate semaphores (or even implement threads -- I've done that with Assembly code) -- this is different story, but what are you allowed to use for implementation?
Is this a school assignment?
Sergey Alexandrovich Kryukov 31-Dec-10 17:06pm    
Monday? Sorry, this is my assessment: you have about zero chances, even if you get maximum possible help.

By maximum possible help I mean some reasonable help, not the case when someone writes whole assignment for you and let you cheat on your assignment instead of learning everything by yourself.

I don't think anyone would help you cheating, by a few reasons. People who provide help here have purely altruistic motivation. I personally would be happy to help someone to learn and be able to do good job later on. If someone provided you the whole assignment text, there is no chances that you learn something, but there are chances that such "help" only betray you. What you need is serious attitude.

Sorry if this is unpleasant for you, but there is nothing else I could do (and I believe anyone else -- let's see). Good luck and Happy New Year.
zidaneez 1-Jan-11 8:55am    
First of all i would like to say thank you for taking the time to read my question and comment on it :)
But i don't recall asking for someone to provide me with an answer! all i asked for is opinion ... If you were to solve such a problem, how would you do it? that was my point. Contrary to what you think, i'd be happy to learn new things even things that are unrelated to my assignment. And one last thing .... there's plenty of time till Monday,so I'm certain that i can make it by then ;)

Any ways, thanks for your passing by and for your lovely wishes.... Happy new year to you too ;)

P.S : sorry about the answer thing. I didn't know that comments are available ( new here :$)

If you're using semaphores, that implies the need for threading. Looks like you waited too long to a) do your homework, and b) change your approach.

 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 31-Dec-10 16:54pm    
Good point, John -- a 5.
Sergey Alexandrovich Kryukov 31-Dec-10 17:07pm    
See my comment to this question -- one of those sad stories.
Hi Friend,

I hope you are confused when they meant not to use multithreading..it could be multiprocessing..anyway better clear yourself as resource utilization will either be by multiple processes or threads if on Windows or Linux.If any other platform like embedded.. it could be something like active object in case of Symbian.ANyway, better to get yourself cleared
 
Share this answer
 
Comments
zidaneez 1-Jan-11 9:10am    
The dr did not say you can't. She only said you don't have to :)

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