Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Critical section
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
=== Critical sections in data structures === In parallel programming, the code is divided into threads. The [[Read–write conflict|read-write conflicting]] variables are split between threads and each thread has a copy of them. Data structures such as [[linked list]]s, [[Tree (data structure)|trees]], and [[hash table]]s have data variables that are linked and cannot be split between threads; hence, implementing parallelism is very difficult.<ref name=":1">{{Cite book|title=Fundamentals of Parallel Multicore Architecture|last=Solihin|first=Yan|date=17 November 2015|publisher=Taylor & Francis |isbn=9781482211184}}</ref> To improve the efficiency of implementing data structures, multiple operations such as insertion, deletion, and search can be executed in parallel. While performing these operations, there may be scenarios where the same element is being searched by one thread and is being deleted by another. In such cases, the output may be [[Erroneous program|erroneous]]. The thread searching the element may have a hit, whereas the other thread may subsequently delete it. These scenarios will cause issues in the program running by providing false data. To prevent this, one method is to keep the entire data structure under critical section so that only one operation is handled at a time. Another method is locking the node in use under critical section, so that other operations do not use the same node. Using critical section, thus, ensures that the code provides expected outputs.<ref name=":1" />
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)