A lock is sometimes distinguished from a semaphore by being nonblocking: Only one process can acquire a lock at a time, but if a process fails to acquire a lock, it can continue execution. Suppose that a lock L has two operations, a Boolean function lock-lock(L) that returns true if the lock has been acquired and false otherwise, and unlock-lock(L), which unlocks the lock (having no effect if the lock is already unlocked). Write an implementation for a lock in:
(a) Java
(b) Ada
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here