-
Some pitfalls
• Threads in abundance can give rise to thread switching and thread management
penalties. This is something that needs to be watched for at the design time.
• The logic for mutexlconditions needs to be designed carefully. A small mistake there can cause mutexl conditions deadlocks or starvations.
• Writing 'Thread Safe' code is extremely important. It basically boils down to understanding what is shared and what's not shared. Following are the things that are shared across threads (and hence need managed access):
• Global data
• Static variables.
•Heap/dynamically allocated memory if the address gets communicated across threads.
•Any system resource (such as file descriptors,
sockets etc.)

Things that are not shared
•Local and stack variables.
•Thread specific data.
•Consistent system state and proper recovery in case of thread getting killed.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks