From owner-freebsd-java@FreeBSD.ORG Fri Aug 24 01:10:02 2007 Return-Path: Delivered-To: freebsd-java@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D7E716A419 for ; Fri, 24 Aug 2007 01:10:02 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id F185413C457 for ; Fri, 24 Aug 2007 01:10:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.14.1/8.14.1) with ESMTP id l7O1A1fV035407 for ; Fri, 24 Aug 2007 01:10:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.1/8.14.1/Submit) id l7O1A1kb035406; Fri, 24 Aug 2007 01:10:01 GMT (envelope-from gnats) Resent-Date: Fri, 24 Aug 2007 01:10:01 GMT Resent-Message-Id: <200708240110.l7O1A1kb035406@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-java@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Nick Johnson Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9C2B16A417 for ; Fri, 24 Aug 2007 01:09:03 +0000 (UTC) (envelope-from root@turing.morons.org) Received: from turing.morons.org (turing.morons.org [208.96.51.42]) by mx1.freebsd.org (Postfix) with ESMTP id 99C8813C458 for ; Fri, 24 Aug 2007 01:09:03 +0000 (UTC) (envelope-from root@turing.morons.org) Received: by turing.morons.org (Postfix, from userid 0) id 8352B1704B; Thu, 23 Aug 2007 18:09:01 -0700 (PDT) Message-Id: <20070824010901.8352B1704B@turing.morons.org> Date: Thu, 23 Aug 2007 18:09:01 -0700 (PDT) From: Nick Johnson To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: java/115773: java.nio channel selectors should use kqueue/kevent instead of poll X-BeenThere: freebsd-java@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Nick Johnson List-Id: Porting Java to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Aug 2007 01:10:02 -0000 >Number: 115773 >Category: java >Synopsis: java.nio channel selectors should use kqueue/kevent instead of poll >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-java >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Aug 24 01:10:01 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Nick Johnson >Release: FreeBSD 6.2-STABLE i386 >Organization: morons.org >Environment: System: FreeBSD turing.morons.org 6.2-STABLE FreeBSD 6.2-STABLE #0: Sun Jan 21 16:53:54 PST 2007 root@turing.morons.org:/usr/src/sys/i386/compile/TURING i386 java version "1.5.0_12-p6" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-p6-root_29_jul_2007_13_27) Java HotSpot(TM) Client VM (build 1.5.0_12-p6-root_29_jul_2007_13_27, mixed mode) >Description: The FreeBSD Java port uses the poll(2) interface to implement java.nio channels. For high performance, especially when large numbers of descriptors are involved, it would be nice to use kqueue(2) / kevent(2) instead. >How-To-Repeat: Currently channel selection for java.nio involves these files in the JVM: j2se/src/share/classes/sun/nio/ch/AbstractPollArrayWrapper.java j2se/src/solaris/classes/sun/nio/ch/PollArrayWrapper.java j2se/src/solaris/native/sun/nio/ch/PollArrayWrapper.c j2se/src/share/classes/sun/nio/ch/AbstractPollSelectorImpl.java j2se/src/solaris/classes/sun/nio/ch/PollSelectorImpl.java j2se/src/solaris/classes/sun/nio/ch/DefaultSelectorProvider.java j2se/src/share/classes/sun/nio/ch/PollSelectorProvider.java j2se/src/share/classes/sun/nio/ch/DatagramChannelImpl.java j2se/src/share/classes/sun/nio/ch/ServerSocketChannelImpl.java j2se/src/share/classes/sun/nio/ch/SocketChannelImpl.java j2se/src/solaris/classes/sun/nio/ch/SinkChannelImpl.java j2se/src/solaris/classes/sun/nio/ch/SourceChannelImpl.java As well as these files used for building: j2se/make/java/nio/Makefile j2se/make/java/nio/mapfile-solaris >Fix: I think the cleanest thing may be to create a KEventArrayWrapper.c, KEventArrayWrapper.java, KEventSelectorProvider.java and KEventSelectorImpl.java to handle the low-level kevent(2) functions. The Linux EPoll classes and native code could be examined for some ideas on how to structure these classes. Then DatagramChannelImpl.java, ServerSocketChannelImpl.java, SocketChannelImpl.java, SinkChannelImpl.java, SourceChannelImpl.java and DefaultSelectorProvider.java would need to be updated to point at the new KEvent* handlers. The AbstractPoll* stuff could probably be ignored / done away with; it looks like it was done that way to provide for both DevPoll* and Poll*. The Linux EPoll classes do not extend from AbstractPoll*. An alternative might be to just modify the polling classes to wrap calls to use kevent(2), but this would be fairly messy and possibly just as much work. If I have some time I may take a stab at this, but if someone else is interested, please feel free to jump on it- don't wait on me. >Release-Note: >Audit-Trail: >Unformatted: