public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Jan Stancek <jstancek@redhat.com>
Cc: ltp-list@lists.sourceforge.net
Subject: Re: [LTP] [PATCH] doc: document tst_checkpoint_create and tst_checkpoint_init
Date: Thu, 16 Oct 2014 19:34:59 +0200	[thread overview]
Message-ID: <20141016173458.GA5149@rei.suse.de> (raw)
In-Reply-To: <270995651.10143129.1413467048364.JavaMail.zimbra@redhat.com>

Hi!
> I thought we had this issue only in parent:
> 
> ---------------------------------------------------------------------------------------------------
>                 parent                        |          child
>                                               | tst_checkpoint_child_wait
>                                               |    - has to wait until parent opens pipe for write
> tst_checkpoint_signal_child (NONBLOCK write)  | 
> tst_checkpoint_parent_wait (NONBLOCK read)    |
>   - parent now races on read with child       |
> ---------------------------------------------------------------------------------------------------
> 
> because child is opening always in blocking mode, it will always wait until other
> side is opened as well:
> ---------------------------------------------------------------------------------------------------
>                 parent                        |          child
>                                               | tst_checkpoint_signal_parent
>                                               |    - has to wait until parent opens pipe for read
> tst_checkpoint_parent_wait (NONBLOCK read)    |
>   - reads from FIFO                           |
>                                               | tst_checkpoint_child_wait
>                                               |    - has to wait until parent opens pipe for write
> tst_checkpoint_signal_child (NONBLOCK write)  |   
>   - at this point first byte was already read |
>     from FIFO, parent writes second byte      |
>                                               |    - and only now will child succeed opening pipe
> ---------------------------------------------------------------------------------------------------
> 
> Am I missing something?

You are right. The problem here is that the fifo can be opened for
NONBLOCK reading even if there are no writers and therefore there are
two readers that fight for the data in the fifo.

The second ordering should be fine as far as I can tell.

-- 
Cyril Hrubis
chrubis@suse.cz

------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

      parent reply	other threads:[~2014-10-16 17:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-16 12:50 [LTP] [PATCH] doc: document tst_checkpoint_create and tst_checkpoint_init Jan Stancek
2014-10-16 13:01 ` Cyril Hrubis
     [not found]   ` <270995651.10143129.1413467048364.JavaMail.zimbra@redhat.com>
2014-10-16 17:34     ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20141016173458.GA5149@rei.suse.de \
    --to=chrubis@suse.cz \
    --cc=jstancek@redhat.com \
    --cc=ltp-list@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox