[Seaside] Serving files

David Shaffer cdshaffer at acm.org
Wed Oct 11 17:15:37 UTC 2006

tim Rowledge wrote:
> On 11-Oct-06, at 5:10 AM, David Shaffer wrote:
> Assuming I understand 'tread safe' in same way that you mean it, that 
> isn't strictly correct. The problem is that the squeak model use 
> separate positioning and read/writing calls. Thus is is quite possible 
> (been there....) to have two processes referring to the same file and get
> procA -> position: a
> procB -> position: b
> procA -> read from position (which I thought was a!)
> boom.
I thought my meaning was the obvious one but now that I hear yours I'd 
agree that I was wrong.  So...(let's hope the second try is a charm)

    Just a point of clarification: file I/O on a single Stream is not
    thread safe but Kom uses separate streams for each request so this
    has nothing to do with why Squeak makes a poor web server for
    serving static files.  The problem with it is that the Squeak VM
    uses blocking I/O calls for file I/O (not for socket I/O!).  So is
    quite possible that the OS will block all processes in the Squeak
    image while reading or writing a file.  This can be a problem when
    serving large files.  If you're serious about serving files from
    Squeak you could use a modified ModFile which uses Async-I/O under
    platforms that support it.  I posted a first attempt at a version of
    this to the Squeak Wiki but it required a modified VM.  I think that
    it could be done without modifying the VM though.  Anyway the
    correct solution is, of course, making Squeak's underlying file I/O
    asychronous just as the socket I/O already is.

So I've reworded my first sentence.  Do I need a third try? :-)


More information about the Seaside mailing list