In: Computer Science
What is the relocation problem?
What is a spinlock? What are its characteristics?
What is a semaphore? What is a mutex?
Relocation problem :-
Relocation is the process of assigning load address for position-dependant code data of a program and adjusting the cod and data to reflect the assigned address.
Spinlock:-
When a thread tires to lock a spinlock and it does not succeed,it will continuously retry locking it, until it finally succeeds thus it will not allow another thread to take its place. The operating system will forcefully switch to another thread once the cpu runtime quantum of current thread has been exceeded.
Semaphore:-
A semaphore is an shared vairable or integer to synchronise the progress of interacting processes. It is basically a synchronizing tool and is accessed by p() and v() respectively.
Mutex:-
When a thread tries to lock a mutex and it does not succeed because the mutex is already locked. It will go to sleep immediately allowing another thread to run. It will continue to sleep until being woken up,which will be the case once the mutex is being unlocked by whatever thread was holding lock before.