Hardware Reference
In-Depth Information
τ
1
τ
2
resource
R
k
wait(S )
wait(S )
k
k
use
resource
use
resource
R
R
k
k
signal(S )
signal(S )
k
k
Figure 7.2
Structure of two tasks that share an exclusive resource.
normal execution
critical section
τ
1
blocked
τ
1
τ
2
t
1
t
2
Figure 7.3
Example of blocking on an exclusive resource.
releases the critical section by executing the
signal(
S
k
)
primitive, which unlocks the
semaphore.
In this simple example, the maximum blocking time that
τ
1
may experience is equal
to the time needed by
τ
2
to execute its critical section. Such a blocking cannot be
avoided because it is a direct consequence of the mutual exclusion necessary to protect
the shared resource against concurrent accesses of competing tasks.
Search WWH ::
Custom Search