From owner-freebsd-net@FreeBSD.ORG Sun Dec 2 19:48:18 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1F9A817D for ; Sun, 2 Dec 2012 19:48:18 +0000 (UTC) (envelope-from Choupani@gmail.com) Received: from sam.nabble.com (sam.nabble.com [216.139.236.26]) by mx1.freebsd.org (Postfix) with ESMTP id ECBF58FC15 for ; Sun, 2 Dec 2012 19:48:17 +0000 (UTC) Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1TfFWS-0001x9-AK for freebsd-net@freebsd.org; Sun, 02 Dec 2012 11:48:16 -0800 Date: Sun, 2 Dec 2012 11:48:16 -0800 (PST) From: Choupani To: freebsd-net@freebsd.org Message-ID: <1354477696312-5766007.post@n5.nabble.com> Subject: protect common resources in kernel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Dec 2012 19:48:18 -0000 Dears, I'm working on kernel in FreeBSD-9. I need to protect a=20 common resource (for example a queue).=20 There are 4 points for access (read/write) this common resource as bellows: 1. ether_input() =E2=80=93 hardware interrupt 2. ip_input() & ip_output() =E2=80=93 software interrupt 3. dev_ioctl() =E2=80=93 local io control in our own kernel module 4. another kernel thread Which scenario is proper to use for this purpose: 1. kernel mutex (MTX_DEF) 2. kernel mutex (MTX_SPIN) 3. kernel share/exclusive lock 4. kernel reader/writer lock -- View this message in context: http://freebsd.1045724.n5.nabble.com/protect-= common-resources-in-kernel-tp5766007.html Sent from the freebsd-net mailing list archive at Nabble.com.