From owner-freebsd-questions@freebsd.org Tue Nov 24 07:30:41 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 71EAB47C0C4 for ; Tue, 24 Nov 2020 07:30:41 +0000 (UTC) (envelope-from lari.sihto@gmail.com) Received: from mail-lj1-x229.google.com (mail-lj1-x229.google.com [IPv6:2a00:1450:4864:20::229]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CgG0040ZLz3syx for ; Tue, 24 Nov 2020 07:30:40 +0000 (UTC) (envelope-from lari.sihto@gmail.com) Received: by mail-lj1-x229.google.com with SMTP id f24so7998935ljk.13 for ; Mon, 23 Nov 2020 23:30:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=YGHV4TQdKa+gSjg4c4ROjColyMyFvRrgOQVBySzJhi0=; b=MSMcJ6YiKwGLgvPgWOErKA09UvbL7hF01o1r70zPhFJGeLYSx+0EIJ57I/1RhHugEC 95estg8NCPsZ5tgQpwoTNrANGWMK9wrGVw8yYpOH5aBERAtnqM72hYejABW4XEE5oba5 29ytDuu5+zGZ3XqLcj/D4+kww5+QAChTCE9eK1rWrwFXs0DteQin9lO08XVL8BFa2Pje o0KltzN3x81+/jHmlNHgdRkC/iOwBJKjq+TpOoxMrhg83N+3NbEVT48cZrP24cElr1AG 57To9zledQQII336aaVbMkglVXH6WS4goDrG8F3sYrCO7dUqUU6kU8zH/+UcXYPKWROL 3Ppw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YGHV4TQdKa+gSjg4c4ROjColyMyFvRrgOQVBySzJhi0=; b=IgB+GkuQQ4OYXFl7DS/Gr6kWhlILK6KWJkO3dmWuPb4i/6IPFtE90ajxuZaPDbIiw+ DcwuT0ZC4hsWQJDkT+IRSREWAFaGiyawtG5i9H32lvh/FGhObOGV4SN1snclXSOGGLY8 mbTy606l3Yecj5an8w6ZLxCwdh4z6Ku++XJ4wbI300S9hSxh0YXv0CDwbfz8do90VZdq PVDL7pndaaZcq24+MaSI/R2zBuFG3Yos2ai1LsBKBvGGjywstcfVpO85qczWfZ+swIjQ 5OqIJeN3towmGfjf8Rxs3d0c2Ias1pzDpkl/TAnmpx1TRuUcKZBkmlQPxDtk/BS/451F 0IqQ== X-Gm-Message-State: AOAM533WfDFMXn87+qoxuaVA5d5wAtzQULDUslIlAWAW17j5xQUB0mMc 4wLCh7iwJ1+tQbTxsx2Ak0VAxB03NzkqTGror415cZj8muQ= X-Google-Smtp-Source: ABdhPJzku/sxWmr5FJiymYF9+o7UjDCs5eLKoT2uLDKlTKCE5ZwYeEfHg0TguuENb/Fw8EuwCYuPw+NEDDxVB8CaW5M= X-Received: by 2002:a05:651c:326:: with SMTP id b6mr1242017ljp.339.1606203038750; Mon, 23 Nov 2020 23:30:38 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Lari Sihto Date: Tue, 24 Nov 2020 09:30:26 +0200 Message-ID: Subject: Re: kernel threads To: "Kevin P. Neal" Cc: freebsd-questions@freebsd.org X-Rspamd-Queue-Id: 4CgG0040ZLz3syx X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=MSMcJ6Yi; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of larisihto@gmail.com designates 2a00:1450:4864:20::229 as permitted sender) smtp.mailfrom=larisihto@gmail.com X-Spamd-Result: default: False [-4.00 / 15.00]; TO_DN_SOME(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; DKIM_TRACE(0.00)[gmail.com:+]; RCPT_COUNT_TWO(0.00)[2]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::229:from]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-questions@freebsd.org]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::229:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::229:from]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[freebsd-questions] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Nov 2020 07:30:41 -0000 Ok, thanks for the clarification. ti 24. marrask. 2020 klo 4.42 Kevin P. Neal (kpn@neutralgood.org) kirjoitti: > On Mon, Nov 23, 2020 at 07:17:50AM +0200, Lari Sihto wrote: > > Yes, that's it. Do you know why the top half is allowed to sleep but the > > bottom half is not? > > The bottom half is hardware interrupt driven. The top half is entered via > system calls or traps on behalf of the process/thread. If you have a > process > or thread context you can sleep and therefore yield to another process or > thread. Interrupts don't have that luxury. The bottom half isn't part of > any process or thread. So no sleeping is allowed in the bottom half. > > > ma 23. marrask. 2020 klo 0.01 Kevin P. Neal (kpn@neutralgood.org) > kirjoitti: > > > > > On Sun, Nov 22, 2020 at 09:59:57PM +0200, Lari Sihto wrote: > > > > Hi, just wondering if there is some technical or philosophical > reason as > > > to > > > > why the freebsd operating system doesn't seem to use kernel-space > threads > > > > like some other unix-like operating systems do. To my knowledge the > need > > > > for kernel threads arises when the kernel code needs to sleep in > kernel > > > > which one cannot do. Kernel threads seem to fix that problem. Have > been > > > > wondering this for a long time and I hope someone here knows the > > > reasoning > > > > behind this implementation detail be it just performance related or > > > > something along the line of "no-one just haven't been up to > implementing > > > > that kind of a functionality"? > > > > > > Are you thinking of something different than what is described in the > > > kthread(9) and kproc(9) man pages? > > > > > > Also, my limited understanding is that the "top" half of the kernel is > > > allowed to sleep, but the "bottom" half is not. > > > > > > You'll get more informed responses to this topic on the freebsd-arch, > > > freebsd-hackers, or maybe freebsd-current lists. Very few if any kernel > > > hackers hang out on this list. > -- > Kevin P. Neal http://www.pobox.com/~kpn/ > > Seen on bottom of IBM part number 1887724: > DO NOT EXPOSE MOUSE PAD TO DIRECT SUNLIGHT FOR EXTENDED PERIODS OF TIME. >