Java NIO - copy-on-write buffer
Sivaprasath Murugeshan <[email protected]> Wed, 08 Jun 2005 14:55:37 +0530
| Newsgroups | gmane.linux.redhat.ia64.general |
|---|---|
| Message-ID | <[email protected]> |
This is a multi-part message in MIME format. --===============1819141031== Content-Type: multipart/alternative; boundary="------------000306040608040801030308" This is a multi-part message in MIME format. --------------000306040608040801030308 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I have a Java program that uses MappedByteBuffer. For the same file, there are three buffers - read only, read/write and copy-on-write (cow) First, change contents of cow buffer and print all buffers. The change is reflected only in cow buffer (not in ro or rw) - as expected. Then, change contents of r/w buffer and print all buffers. The change is NOT observed in cow buffer, but reflected in ro and rw buffers (for Linux-IA64). I tried the same program in Linux-X86 and the change is reflected in all buffers (including cow buffer). I used JDK 1.4.2_03 for compiling and running. The doc for MappedByteBuffer says "The content of a mapped byte buffer can change at any time, for example if the content of the corresponding region of the mapped file is changed by this program or another. Whether or not such changes occur, and when they occur, is operating-system dependent and therefore unspecified." Is this behaviour acceptable? Is this observed in any other platform? (I have seen HPUX on IA64 giving a different error) I think Java NIO leaves it to the O/S and JVM is not doing anything here (as different from java.io). This could probably result in inconsistent behaviour across platforms (though it improves performance) Please let me know your thoughts. - Siva. --------------000306040608040801030308 Content-Type: text/html; charset=us-ascii Content-Transfer-Encoding: 7bit <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> I have a Java program that uses MappedByteBuffer. For the same file, there are three buffers - read only, read/write and copy-on-write (cow)<br> <br> First, change contents of cow buffer and print all buffers. The change is reflected only in cow buffer (not in ro or rw) - as expected.<br> <br> Then, change contents of r/w buffer and print all buffers. The change is NOT observed in cow buffer, but reflected in ro and rw buffers (for Linux-IA64). I tried the same program in Linux-X86 and the change is reflected in all buffers (including cow buffer).<br> <br> I used JDK 1.4.2_03 for compiling and running. The doc for MappedByteBuffer says <br> <br> <i>"The content of a mapped byte buffer can change at any time, for example if the content of the corresponding region of the mapped file is changed by this program or another. Whether or not such changes occur, and when they occur, is operating-system dependent and therefore unspecified."</i><br> <br> Is this behaviour acceptable? Is this observed in any other platform? (I have seen HPUX on IA64 giving a different error)<br> <br> I think Java NIO leaves it to the O/S and JVM is not doing anything here (as different from java.io). This could probably result in inconsistent behaviour across platforms (though it improves performance)<br> <br> Please let me know your thoughts.<br> <br> - Siva.<br> </body> </html> --------------000306040608040801030308-- --===============1819141031== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ia64-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/ia64-list --===============1819141031==--