From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.3 required=3.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C5F5C7618B for ; Mon, 29 Jul 2019 18:08:02 +0000 (UTC) Received: from shelob.surriel.com (shelob.surriel.com [96.67.55.147]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 34AC3206DD for ; Mon, 29 Jul 2019 18:08:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="JwRs+HLC" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 34AC3206DD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=kernelnewbies-bounces@kernelnewbies.org Received: from localhost ([::1] helo=shelob.surriel.com) by shelob.surriel.com with esmtp (Exim 4.92) (envelope-from ) id 1hsA3p-0008PG-Qf; Mon, 29 Jul 2019 14:07:49 -0400 Received: from mail-oi1-x236.google.com ([2607:f8b0:4864:20::236]) by shelob.surriel.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1hsA3n-0008P7-H4 for kernelnewbies@kernelnewbies.org; Mon, 29 Jul 2019 14:07:47 -0400 Received: by mail-oi1-x236.google.com with SMTP id w79so45976292oif.10 for ; Mon, 29 Jul 2019 11:07:46 -0700 (PDT) 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=dFA4D4MLrNOQz+ZqnKNqAPmokI4VebQMdE8dKNw/Muo=; b=JwRs+HLCquj9MQ/NLSa+QtdCZTHfvQOG8p7fB2wsP1egvuZPruz7fa9HtIIX13Zrq3 IuWfg0Dm8sUod/ny8lZeL47wJayQsPoa/LEtAfcf+dE1oHB9HJ+3Fm/CpT0oE5JSEwWh mSBLsCI7fHyAUn/XyBIFHOWCJwkq29hgVXa6mNWy1hq0sZi4HiX7VYv2CWAjV48w4qC8 Q2DAhaaEQklq1wOWLuLpNq5vENdki7RokjSUprdn1OGDvQ+ktFSWg9xNff3HegrXdVYo CkZtqrQC8/Ij3mQxpXGjhUXvH44tTPmaghxvt+GM1MkYFY8tG2c+TlkFKxgp1FU+T993 2RCQ== 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=dFA4D4MLrNOQz+ZqnKNqAPmokI4VebQMdE8dKNw/Muo=; b=gx/yo1cFIYFaoIcIjvxQ1C7WVFZAd7F1pMDkb9d2hGFQOortILCtgIPPwMh3U0qGPx 8KFYToGeigQeP2Hm85MO2MgCvAqQzWlCr6Q4gkouSY8QZJERAZVV2ZpI1tiKYeohP5D5 sdVQIRcrgxsqqbrtmPecSasZISCCDtcu4QG7CZdZdd9kOJQUhUmxNkM2li660AlPc3qk rNbPJ9uI0HOwFMlDHcfwbLN7EjDBPKOKQrms9D3y2pgMFWwTsl9R7g00AKEKbukvVNmI SYsF+6R1PWsxpHsAnq2DHBxO8HfbERkXQ2FnQ06YkCIdSZlFofTeHUEi9t+G83OLCK1E uL7w== X-Gm-Message-State: APjAAAW8JANviHzcQzxMflBadEGyPz9/Q8zTjTFotJIEGJj2ycFEIh8H ONZm+LyRggB6AIpsAwR8WSwgK8TmceElcsPdo38= X-Google-Smtp-Source: APXvYqzyKPFHpJwtfv067vx5L9TXxoNXE7yGU2JbJH11qixO8UWSMt6EKe49RL1Z4VwSoyFISZ4lW59NrDg0Jek18hA= X-Received: by 2002:aca:aa93:: with SMTP id t141mr53468916oie.128.1564423665836; Mon, 29 Jul 2019 11:07:45 -0700 (PDT) MIME-Version: 1.0 References: <20190729180122.GA11403@bharath12345-Inspiron-5559> In-Reply-To: <20190729180122.GA11403@bharath12345-Inspiron-5559> From: Muni Sekhar Date: Mon, 29 Jul 2019 23:37:34 +0530 Message-ID: Subject: Re: wait_event()\ wait_event_interruptible()\ wait_event_interruptible_timeout() and wake_up() To: Bharath Vedartham Cc: kernelnewbies X-BeenThere: kernelnewbies@kernelnewbies.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Learn about the Linux kernel List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kernelnewbies-bounces@kernelnewbies.org On Mon, Jul 29, 2019 at 11:31 PM Bharath Vedartham wrote: > > On Mon, Jul 29, 2019 at 10:48:57PM +0530, Muni Sekhar wrote: > > Hi All, > > > > Let us assume that multiple processes are waiting on wait_event()\ > > wait_event_interruptible()\ wait_event_interruptible_timeout(), which > > process gets woken up on calling wake_up()?? > > > > I presume wake_up() picks one process, but is there any algorithm to > > pick which process? > > > > > > -- > > Thanks, > > Sekhar > Sorry to spoil the fun here. But check out what the queue data structure > is all about. 'wait_queue' :) A wait queue is a doubly linked list of wait_queue_t structures that hold pointers to the process task structures of the processes that are blocking. Each list is headed up by a wait_queue_head_t structure, which marks the head of the list and holds the spinlock to the list to prevent wait_queue_t additional race conditions > > Thank you > Bharath > > _______________________________________________ > > Kernelnewbies mailing list > > Kernelnewbies@kernelnewbies.org > > https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies -- Thanks, Sekhar _______________________________________________ Kernelnewbies mailing list Kernelnewbies@kernelnewbies.org https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies