9fans archive / 1997 / 08 / 18 / prev next
From: forsyth@cal... forsyth@cal...
Subject: [9fans] plan9 extensions
Date: Fri, 15 Aug 1997 17:22:30 BST
>>Has Brazil (or any future development) at Lucent given any thought to this
>>matter? Your insights and suggestions are most welcome.
BSD style readv/writev are arguably just optimisations (although they
usually boil down to a copy inside the kernel), and thus cause no
serious reasoning problems. asynchronous i/o, like signals/notes and
those unbelievable `call back' functions, reintroduce the Interrupt,
which is bad for reasoning and certainly for the morale of subsequent
maintainers of an application. i'd put my effort into improving the
efficiency of what is there, rather than going back to un-reasonable hacks.
it might be of interest that in Limbo/Inferno one can do something like:
input(c: chan of array of byte)
{
for(;;){
a := array [N] of byte;
n := sys->read(fd, a, len a);
if(n <= 0){
c <-= nil;
break;
}
c <-= a[0:n]; # slice to n bytes
}
}
and some other process can do
c := chan of array of byte;
spawn input(c);
while((a := <-c) != nil)
dosomethingwith(a);
or pass a along another channel to another process, and so on,
the point being that transmission is by reference (you can get
your garbage collector to help you with this one).
Sys->file2chan is even cooler: it eliminates copying between the system
and the file server, though not between system and file client, because
that isn't safe.