|
2012-09-13
| ||
| 20:53 | • Closed ticket [3563391fff]: Drop unused SpBucket fields plus 7 other changes artifact: d6981ff413 user: dgp | |
| 20:44 | • Ticket [3563391fff]: 4 changes artifact: e6e32a9f1a user: vasiljevic | |
| 20:34 | • Ticket [3563391fff]: 4 changes artifact: e948b8c16d user: dgp | |
| 16:54 | • Ticket [3563391fff]: 4 changes artifact: 96e4be5d76 user: vasiljevic | |
|
2012-08-30
| ||
| 17:00 | • New ticket [3563391fff]. artifact: 3979761342 user: dgp | |
Drop unused SpBucket fields
Closed / Accepted3563391fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 14 years ago
Descriptionplain2012-08-30 17:00:33
The struct SpBucket declared in threadSpCmd.h has two fields, lockt and freeCt, that are never used anywhere. In the interest of simplification, I request we remove them. I would also like some comments added explaining the default value of #define NUMSPBUCKETS 32 and why someone customizing Thread source code might choose some other value. I think I'd be just as happy with a value of 1 myself, but that may be an opinion founded in ignorance.
vasiljevicplain2012-09-13 16:54:21
The "lockt" has been removed. The "freeCt" is used in the code as the top of free container list (similar to the list of pre-allocated Tcl Objs) and cannot be removed. The NUMSPBUCKETS is a count of slots containing shared arrays. Instead of locking the array during access, the slot (bucket) containing the array is locked. Arrays are distributed among buckets using a simple hash that maps the array name into one of the buckets. The whole logic was "borrowed" from AOL/Naviserver. Setting the value larger will reduce locking contention for the bucket and thus allow more concurrency. Unfortunately we do not have any metrics built into the code that would allow locking introspection and finding "hot" buckets. This would be necessary in order to experiment with the number of buckets. The value of 32 is found to be "good enough" for most of the applications.
dgpplain2012-09-13 20:34:59
Thanks for reviewing the request. It's not urgent, but good to have others having a look. The "lockt" field is still present in the SpBucket struct on the trunk. I doubt that the "freeCt" is used in the way you claim. (Don't confuse it with the field of the same name in the Bucket struct in threadSvCmd.h) I've had the field commented out for many many weeks in a local sandbox with no apparent ill effect. If I'm overlooking something, then adding something to the test suite that would notice this field being missing would be a good thing to do.
vasiljevicplain2012-09-13 20:44:24
You are right about the freeCt. It is defined twice but one of the instances is unnecessary. I overlooked that. Will remove that now. Apropos lockt... It is removed and I "fossil push"ed so I cannot explain why you still see it. In my sandbox it is gone.
dgpplain2012-09-13 20:53:13
allow_comments - 1 Got it now. Thanks!
Log in (anonymous is fine) to add a comment.