Google Answers Logo
View Question
 
Q: C programming (Algorithms) ( No Answer,   3 Comments )
Question  
Subject: C programming (Algorithms)
Category: Computers > Programming
Asked by: dilan-ga
List Price: $25.00
Posted: 23 Mar 2003 10:59 PST
Expires: 24 Mar 2003 09:53 PST
Question ID: 179912
A specialised monitor capable of acquiring and
releasing a resource in a system with R resources and N processes,
each having a unique priority number, following the rule that the
lowest priority number gets the resource
 
We can start by defining 
#define MAXRESOURCES R 
#define MAXPROCESSES N

The solution for the above problem needed in C Language

Request for Question Clarification by studboy-ga on 23 Mar 2003 14:51 PST
Does this have anything to do with deadlock prevention and resource
sharing?  We need a more detail spec (ie, post your assignment spec,
etc).  The instructor usually gives you a template / library of things
to modify in addition to a handout.  We need those.  Thanks.  Also, I
think the cost of implementation for this will need to be a little
higher...

Clarification of Question by dilan-ga on 23 Mar 2003 15:17 PST
Hi studboy-ga

I have seen this question in a C programming book and that doesnt
mention anything about deadlock prevention and resource sharing. It
further syas as its a short algorithm we do not need a computer to
write this code.

Any way I would be grateful if you can give me a solution for this
problem.(I have made a change in the price list)

Request for Question Clarification by studboy-ga on 23 Mar 2003 17:14 PST
Thanks dilan-ga.  Now we have more clue--can you tell me the title of
the book you mentioned?  Is this an operating systems / computer
architecture book by chance?  Usually the questions are at the end of
a particular chapter--if you can tell me what that chapter is all
about maybe I can get a better idea of where this fits in.  Resources
and processes are a common theme in several computer algorithms--not
just one.  Also, you mention "dos not require a computer to write the
code"--how are you going to check the code if you don't have a
computer?  Is this for a class?  If this is for a class that does not
require computers I suspect that what your instructor is looking for
is not C code, but some kind of "pseudo" code per se.  Thanks.

Clarification of Question by dilan-ga on 23 Mar 2003 18:25 PST
Hi studboy!
This question book is from my university and its an operating systems
book.
Actually what was meant by, "no need for a computer" is this question
should not take that long to figure out the answer, I think.
The chapter was Pointers and I'm not sure whether its fully related to
the topic of pointers.
No doubt, answer needed in C code.

Thanks

Request for Question Clarification by studboy-ga on 23 Mar 2003 20:46 PST
Hi dilan-ga,

First of all, thanks for the clarification.  Secondly, I need more
clarification: can you tell me the title/author of this book an dthe
chapter/page #?  There's a library/bookstore nearby from where I can
take a look, but you must provied me enough info to find this book. 
Thanks.

Request for Question Clarification by studboy-ga on 23 Mar 2003 20:48 PST
Also, if this is a university specific book (like a collection of quad
questions), please specify the universoty name.  Thanks.
Answer  
There is no answer at this time.

Comments  
Subject: Re: C programming (Algorithms)
From: mathtalk-ga on 23 Mar 2003 20:38 PST
 
If a question is not understood, figuring out the answer may take a
very long time indeed.

The word "monitor" has a special meaning in connection with mechanisms
of interprocess communication for the purpose of resource sharing in a
manner that avoids deadlocks.  If the context of this question is
unclear to the poser, it is not likely that a researcher will quickly
guess the answer, even supposing that it is to be "simple".

For example, the question does not make clear whether resources are to
be shared on a pre-emptive basis, or on a basis of retaining the
"best" priority request for a resource during the time it is being
held by an existing job.

Some search terms that might help the customer clarify the request:

"resource allocation" monitor "critical section"
mutex
semaphore
preemption
deadlock

regards, mathtalk-ga
Subject: Re: C programming (Algorithms)
From: studboy-ga on 23 Mar 2003 20:58 PST
 
Yes, I'm just curious as to what this book is and the extend of the
class--a few things doesn't make sense:

1) This is a college level OS book.
2) There's a chapter on "Pointers"???  Presumably stack pointers? 
Pointers to processes?  Unlikely that an author would name the chapter
"Pointers".
3) So no deadlock or resource sharing is mentioned...  and the
question is about a monitor on processes and resources... with
priorities?
4) Author wants C code but mentions "no computer required."

Man, I would like to see this book!!!
Subject: Re: C programming (Algorithms)
From: dilan-ga on 24 Mar 2003 01:14 PST
 
Hi all!!
I have posted this question as this is a problem to me. Basically this
question book written by a Lecturer from an English University
(University of London)

I have contacted a Lec regarding this q and he said we can assume that
the
"best" priority request for a resource during the time it is being
held by an existing job.

I have given all the information I can get and this question was under
revision section of Pointers. So it mite cover some more areas which I
cant figure out.

Thank you.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy