Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
Niidae Wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Thread safety
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
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!
==Levels of thread safety== Different vendors use slightly different terminology for thread-safety,<ref>{{cite web|url=https://www.ibm.com/docs/en/i/7.5?topic=safety-api-thread-classifications |title=API thread safety classifications |publisher=IBM |date=2023-04-11 |access-date=2023-10-09}}</ref> but the most commonly used thread-safety terminology are:<ref name=":1">{{cite web |last=Oracle |date=2010-11-01 |title=Oracle: Thread safety |url=https://docs.oracle.com/cd/E37838_01/html/E61057/compat-14994.html#scrolltoc |access-date=2013-10-16 |publisher=Docs.oracle.com |postscript="A procedure is thread safe when the procedure is logically correct when executed simultaneously by several threads"; "3 level of thread-safe"}}</ref> *'''Not thread safe''': Data structures should not be accessed simultaneously by different threads. *'''Thread safe, serialization''': Uses '''a single mutex for all resources''' to guarantee the thread to be free of [[race condition#Computing|race conditions]] when those resources are accessed by multiple threads simultaneously. *'''Thread safe, MT-safe''': Uses '''a mutex for every single resource''' to guarantee the thread to be free of [[race condition#Computing|race conditions]] when those resources are accessed by multiple threads simultaneously. Thread safety guarantees usually also include design steps to prevent or limit the risk of different forms of [[deadlock (computer science)|deadlock]]s, as well as optimizations to maximize concurrent performance. However, deadlock-free guarantees cannot always be given, since deadlocks can be caused by [[callback (computer programming)|callbacks]] and violation of [[architectural layer]]ing independent of the library itself. [[Library (computing)|Software libraries]] can provide certain thread-safety guarantees.<ref>{{Cite web |title=MT Safety Levels for Libraries |url=https://docs.oracle.com/cd/E37838_01/html/E61057/compat-89113.html#scrolltoc |access-date=2024-05-17 |website=Docs Oracle}}</ref> For example, concurrent reads might be guaranteed to be thread-safe, but concurrent writes might not be. Whether a program using such a library is thread-safe depends on whether it uses the library in a manner consistent with those guarantees.
Summary:
Please note that all contributions to Niidae Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Encyclopedia:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Thread safety
(section)
Add topic