|
|
Subject:
Help in scheme
Category: Computers > Programming Asked by: mott85-ga List Price: $15.00 |
Posted:
14 Nov 2004 15:33 PST
Expires: 18 Nov 2004 20:08 PST Question ID: 428923 |
I need tsome hlep finding an answer to soemthing in scheme. This is not a homework problem and top prove it i will post my orginal code if any one can help I appreciate it. A semaphore (of size n) is a generalization of a mutex. Like a mutex, a semaphore supports acquire and release operations, but it is more general in that up to n processes can acquire it concurrently. Additional processes that attempt to acquire the semaphore must wait for release operations. Give implementations of semaphores in terms of mutexes and in terms os atomict-test-and set. Here is what i think i need to do for setting mutxes is therre somehwre i can confirm this? (define (make-mutex) (let ((cell (list false))) (define (the-mutex m) (cond ((eq? m 'acquire) (if (test-and-set! cell) (the-mutex 'acquire))) ; retry ((eq? m 'release) (clear! cell)))) the-mutex)) (define (clear! cell) (set-car! cell false)) |
|
There is no answer at this time. |
|
There are no comments at this time. |
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 Home - Answers FAQ - Terms of Service - Privacy Policy |