[RTEMS Project] #2555: Eliminate the Giant lock
RTEMS trac
trac at rtems.org
Wed Jan 27 08:35:06 UTC 2016
#2555: Eliminate the Giant lock
-----------------------------+-----------------------------
Reporter: sebastian.huber | Owner: sebastian.huber
Type: enhancement | Status: new
Priority: normal | Milestone: 4.12
Component: cpukit | Version: 4.12
Severity: normal | Keywords:
-----------------------------+-----------------------------
= Background =
The standard approach to turn a uni-processor operating system into an
SMP-capable operating system is to encapsulate virtually the complete
operating system state and protect it by one global recursive lock - the
Giant lock. Thus, at most one processor can modify the operating system
state at a time. Under Giant lock protection interrupt disable/enable
critical sections still work. This approach is easy to realize and leads
to something that runs on SMP with a minimal effort. Unfortunately, such
an operating system does not scale with the processor count and offers
very poor performance. It is quite useless for real applications.
The first steps to get rid of the Giant lock are tackled with the
introduction of fine grained locking for the scheduler, watchdog handler,
timestamps, thread queues, events, semaphores and message queues. The
Giant lock is still used in a couple of places, e.g. all other objects
using thread queues, thread life cycle changes (termination, restart) and
scheduler changes. It is a straight forward task to eliminate it
entirely, but it is also somewhat labour intensive since a lot of code
must be changed.
= Implementation =
Eliminate all remaining code areas that use
* `_ISR_Disable()`,
* `_ISR_Enable()`, and
* `_ISR_Flash()`.
Direct users of these macros are
* `_Chain_Append()`,
* `_Chain_Extract()`,
* `_Chain_Get()`,
* `_Chain_Insert()`, and
* `_Chain_Prepend()`.
Each spot must be dealt with individually. Once this is done, delete
these macros since they are now superfluous. Rename
`_ISR_Disable_without_giant()` into `_ISR_Locale_disable()`. Rename
`_ISR_Enable_without_giant()` into `_ISR_Locale_enable()`.
Eliminate all remaining code areas that use
* `_Thread_Disable_dispatch()` and
* `_Thread_Enable_dispatch()`.
A prominent user of this functions is `_Objects_Get()`. The following
components are affected by these functions
* Classic barrier handler,
* Classic dual-ported memory handler,
* Classic message queue handler,
* Classic partition handler,
* Classic rate-monotonic handler,
* Classic region handler,
* Classic semaphore handler,
* Classic timer handler,
* extension handler,
* IO manager,
* multi-processing management,
* objects management,
* POSIX barrier handler,
* POSIX condition handler,
* POSIX key handler,
* POSIX message queue handler,
* POSIX mutex handler,
* POSIX rwlock handler,
* POSIX semaphore handler,
* POSIX spinlock handler,
* POSIX timer handler,
* signals,
* thread cancellation,
* thread life-cycle changes, and
* thread scheduler changes.
Once this is done, delete `_Thread_Disable_dispatch()` and
`_Thread_Enable_dispatch()`. As a side-effect the Giant lock will be
removed.
--
Ticket URL: <http://devel.rtems.org/ticket/2555>
RTEMS Project <http://www.rtems.org/>
RTEMS Project
More information about the bugs
mailing list