Question: Assume that a system has multiple processing cores. For each of the following scenarios, describe which is a better locking mechanisma spinlock or a mutex
Assume that a system has multiple processing cores. For each of the following scenarios, describe which is a better locking mechanisma spinlock or a mutex lock where waiting processes sleep while waiting for the lock to become available: Thelockistobeheldforashortduration. Thelockistobeheldforalongduration. Athreadmaybeputtosleepwhileholdingthelock.Exercises critical section Chapter Process Synchronization #define MAX PROCESSES int number of processes ; the implementation of fork calls this function int allocate processint new pid;if number of processes MAX PROCESSES return ;else allocate necessary process resources number of processes;return new pid; the implementation of exit calls this function void release process release process resources number of processes;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
