MQ interface - Why are some structures allocated to not cross 64k boundary?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

MQ interface - Why are some structures allocated to not cross 64k boundary?

Terry Raymond

In the MQ interface, when some structures are allocated, the code insures it does

not cross a 64k boundary.  Would anyone know why?

 

Thanks.

 

Terry

 

===========================================================

Terry Raymond

Crafted Smalltalk

80 Lazywood Ln.

Tiverton, RI  02878

(401) 624-4517      [hidden email]

===========================================================

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: MQ interface - Why are some structures allocated to not cross 64k boundary?

Holger Guhl
Frankly, we cannot tell the exact rationale. I have taken over the responsibility for the MQ interface, but that was quite some time after the early developers finished the first implementations. I have asked the developers but none of them can remember back to 2004 when they released it. I have also consulted the "WebSphere MQ - Application Programming Reference" but I couldn't spot any information that justifies the 64k alignment enforced with MQ.AbstractMQInterface #alloc64KAligned:.
I simply gave it a try and ran our SUnit tests after disabling the alignment in #alloc64KAligned: and inserting a notification if repeated allocation should have happened. Here is the code:
alloc64KAligned: aSymbol 
	"Perform the allocation method <aSymbol>. 
	Make sure the allocated memory does not span a multiple of 64K.
	Return: CCompositePointer "

	| sixtyFourK gcProtected |
	sixtyFourK := 64 * 1024.
	gcProtected := nil.
	
	[| heapPtr structSize startAddr |
	heapPtr := self perform: aSymbol.
	structSize := heapPtr type referentType sizeof.
	startAddr := heapPtr referentAddress.
	startAddr \\ sixtyFourK + structSize <= sixtyFourK ifTrue: [^heapPtr].
	Transcript show: ('Warning: Memory allocation for #<1s> across 64k segments<n>' expandMacrosWith: aSymbol).
	true ifTrue: [^heapPtr].
	...] 
			repeat
All tests ran successfully and repeated allocation was extremely rare. Even if the original #alloc64KAligned: would have rejected an allocation, it was ok to continue with memory spreading over two 64k segments. The tests covered remote connection and get/put with queues from a Windows 7 PC to MQ on a linux server.
I'll see what I can do to verify that the alignment is superfluous. If you have troubles with the repeated allocation you could use the code above in own tests and check whether repeated allocation is an issue at all. With my experiences one could also discard all the alignment and use this code:
alloc64KAligned: aSymbol 
	"Perform the allocation method <aSymbol>. 
	Return: CCompositePointer "

	^self perform: aSymbol
I hope this helps.
Holger Guhl
-- 
Senior Consultant * Certified Scrum Master * [hidden email]
Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
Georg Heeg eK Dortmund
Handelsregister: Amtsgericht Dortmund  A 12812

Am 19.03.2013 17:18, schrieb Terry Raymond:

In the MQ interface, when some structures are allocated, the code insures it does

not cross a 64k boundary.  Would anyone know why?

 

Thanks.

 

Terry

 

===========================================================

Terry Raymond

Crafted Smalltalk

80 Lazywood Ln.

Tiverton, RI  02878

(401) 624-4517      [hidden email]

===========================================================

 

_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc