Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
O_DIRECT and tcl
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
ikeon  
View profile  
 More options Nov 11, 9:08 am
Newsgroups: comp.lang.tcl
From: ikeon <shay.ro...@gmail.com>
Date: Wed, 11 Nov 2009 06:08:49 -0800 (PST)
Local: Wed, Nov 11 2009 9:08 am
Subject: O_DIRECT and tcl
Hi,

I'm writing a pure TCL application that one program is reading
commands from a file in NFS (network file share).
I'm using "open" command and "gets" command, than "seek" to the first
line and "gets" again.
One scripts is writing to the file locally and other script reads it
from NFS.
the file is being changed in 100 ms rate.
When i read the file from NFS I see only per second changes.

I was told it has to do with NFS cache and stuff and after reading NFS
behavior the cache can be reduced but not disabled.
One recommendation was to open the file with O_DIRECT flag which is an
option like blocking or non_blocking - this way there is a direct I/O
to the file and no cache/buffers.

Can it be done in TCL ? Somehow control the flags related to the file
opening.

Thank.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nick Hounsome  
View profile  
 More options Nov 11, 9:31 am
Newsgroups: comp.lang.tcl
From: Nick Hounsome <nick.houns...@googlemail.com>
Date: Wed, 11 Nov 2009 06:31:41 -0800 (PST)
Local: Wed, Nov 11 2009 9:31 am
Subject: Re: O_DIRECT and tcl
On 11 Nov, 14:08, ikeon <shay.ro...@gmail.com> wrote:

If you think about it a bit more you will realise that the compiler/
library/OS cannot implement anything like O_DIRECT for remote files
and that buffering is unavoidable. This isn't a limitation of Tcl.

NFS is just not suitable for the sort of communication that you are
trying to do.

I think that you really need sockets.
If you really have to write to a file then maybe you could try named
pipes, possibly with a pipe to cocket converter app on the writing
machine.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Donal K. Fellows  
View profile  
 More options Nov 11, 10:15 am
Newsgroups: comp.lang.tcl
From: "Donal K. Fellows" <donal.k.fell...@manchester.ac.uk>
Date: Wed, 11 Nov 2009 07:15:54 -0800 (PST)
Local: Wed, Nov 11 2009 10:15 am
Subject: Re: O_DIRECT and tcl
On 11 Nov, 14:08, ikeon <shay.ro...@gmail.com> wrote:

> I was told it has to do with NFS cache and stuff and after reading NFS
> behavior the cache can be reduced but not disabled.
> One recommendation was to open the file with O_DIRECT flag which is an
> option like blocking or non_blocking - this way there is a direct I/O
> to the file and no cache/buffers.

There is no way that that could ever be made to work over a network,
even if Tcl supported passing that flag through (which it doesn't, as
it happens). The issue is that network systems have buffers *anyway*
in the OS and the fileserver probably buffers stuff too (to say
nothing of the other machine). Sorry, but it won't ever work.

Instead, you need a different system architecture (e.g., a dedicated
server that acts as a control point, or maybe a database server).
Changing from one way of doing things to another is non-trivial, but
can't be helped as you're hitting the point where simple hacks don't
cut it.

Donal.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ikeon  
View profile  
 More options Nov 12, 8:15 am
Newsgroups: comp.lang.tcl
From: ikeon <shay.ro...@gmail.com>
Date: Thu, 12 Nov 2009 05:15:25 -0800 (PST)
Local: Thurs, Nov 12 2009 8:15 am
Subject: Re: O_DIRECT and tcl
On Nov 11, 5:15 pm, "Donal K. Fellows"

Thank for your help !
I did some workaround that work...
Instead of reading remotley and writeing locally i've turned it the
other way around -
Reading locally and writing remotely using "flush" so that way the
file get updated through the network immediately and the reading is
locally so it solved my problems.

Thanks again.
Shay.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alexandre Ferrieux  
View profile  
 More options Nov 12, 8:55 am
Newsgroups: comp.lang.tcl
From: Alexandre Ferrieux <alexandre.ferri...@gmail.com>
Date: Thu, 12 Nov 2009 05:55:02 -0800 (PST)
Local: Thurs, Nov 12 2009 8:55 am
Subject: Re: O_DIRECT and tcl
On Nov 12, 2:15 pm, ikeon <shay.ro...@gmail.com> wrote:

Still, you've been given a strong signal that it was a flawed
approach. Any reason to ignore better interprocess communication
primitives (like sockets) ?

-Alex


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Nick Hounsome  
View profile  
 More options Nov 13, 3:05 am
Newsgroups: comp.lang.tcl
From: Nick Hounsome <nick.houns...@googlemail.com>
Date: Fri, 13 Nov 2009 00:05:07 -0800 (PST)
Local: Fri, Nov 13 2009 3:05 am
Subject: Re: O_DIRECT and tcl
On 12 Nov, 13:15, ikeon <shay.ro...@gmail.com> wrote:

Good.

But "network" and "immediately" are incompatible so you might as well
forget about the flush.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
ikeon  
View profile  
 More options Nov 15, 3:33 am
Newsgroups: comp.lang.tcl
From: ikeon <shay.ro...@gmail.com>
Date: Sun, 15 Nov 2009 00:33:15 -0800 (PST)
Local: Sun, Nov 15 2009 3:33 am
Subject: Re: O_DIRECT and tcl
On Nov 13, 10:05 am, Nick Hounsome <nick.houns...@googlemail.com>
wrote:

Gentelmans,

I'm sure sockets is a much better approch.
The thing is that I'm in a bit of a rush and my twisted solution is
good enough for now.
I'll try to implement sockets later on.
Thank you all for the good advises.

Shay.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google