Reputation: 149
I read everywhere that to implement a lock thread need hardware support - disable interrupts.
No matter how we choose to implement locks, we must have some hardware support. One possibility to implement locks is to disable interrupts,
Upvotes: 1
Views: 521
Reputation: 21617
What you are describing was the mechanism used for simple locking in older OSes that operated on single processor systems. Even then, complex locking (e.g., for a database) required a lot more.
Now, with multiprocessor systems, blocking interrupts all the processors at the same time would not help.
CPUs that support multi-processing have memory interlocked instructions.The olde VAX had an interlocked branch on bit set and set instruction and even a remove from queue interlocked instruction for heavy duty work. Such hardware support has been around for a long time.
Upvotes: 1