This is for Operating Systems Concepts... Evaluate the performance of the follow
ID: 3720265 • Letter: T
Question
This is for Operating Systems Concepts...
Evaluate the performance of the following solution using locks for 100 threads. Situation: How long does it take to a thread that was already inside of the critical-section and was temporary removed from the CPU to be re-scheduled again in the CPU? Assume round-robin scheduling, and time slide of 5 millisecond int TostAndSet (int -old ptr, int new) nt old -.old ptzs 1/ Eetch old value old ptr-new return old; at old ptr // store 'new into old ptr // return the old value 1typedef struct lock t int flag; void init(lock t lock) 770 indicates that lock is available, 1 that it is held lock->flag-0 void lock (lock t lock) while (TestAndset (&lock-;>flag, 11) ;1 spin-wait (do nothing) 12 13 14 15 void unlock (lock t lock) 16 17 lock->flag 0 a) Using 1 CPU b) Using 100 CPUsExplanation / Answer
a. using single CPU, the round robin scheduling will take the time is number of threads * time slot,
i.e in the above example 99 * 5 ms (1 thread already waiting state and remaining 99 are in queue )
b. using multiple CPU, if 100 CPUs are there and consider each having 1 core, so 100 CPUs and 100 cores, will execute each thread so, it will take only 5 ms to get the next time slot
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.