Synchronization Hardware
• Many systems provide hardware support for critical section code
• Uniprocessors
– could disable interrupts
– Currently running code would execute without preemption
– Generally too inefficient on multiprocessor systems
• Operating systems using this not broadly scalable
• Modern machines provide special atomic hardware instructions
• Atomic = non-interruptable
– Either test memory word and set value
– Or swap contents of two memory words
· Implementable, but not trivial, in multiprocessor environments (atomicity has to be across all CPUs)
In general, solutions to the critical-section problem use the concept of a lock, locks are acquired before entering a critical section, then released on exit. When a process wants to enter a CS, it checks if lock is 0. If so, it sets it to 1 and enters CS. After it is done, it resets it to 0.
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .