In the figure below, write the action of entry section and exit section to perform critical section in assembly language. (However, suppose that the Lock bit (flag) is at the memory address 0x10000000
The test-and-set function may be implemented with LDREX and STREX commands. LDREX and STREX have the same grammar as LDR and STR, but are always cache miss, write-through, and are always used as pairs for read-modify-write.
If processor 1 reads a memory area in LDREX, it does not occur until processor 1 writes STREX even if processor 2 attempts to read the same memory area in LDR or LDREX. )
Load lock variable No Unlocked? (-07) Yes Try to lock variable using swap read lock variable and then set variable to locked value (1) No Succeed? (-07) Begin update of shared data Finish update of shared data Unlock set lock variable to 0 -Entry Section -Exit Section
In the figure below, write the action of entry section and exit section to perform critical section in assembly language
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am