Unix administration - Every thing is a file

This is Interesting: Free IT Magazines  
Home > Archive > Unix administration > September 2007 > Every thing is a file





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Every thing is a file
alkara.opesh@gmail.com

2007-08-30, 7:21 pm


"In UNIX every thing is a file"


I am quite able to understand this concept.....but to be able to
appreciate the difference in a clear way.....I need to understand why
is everything not a "file" in windows........and if every thing is not a
file.....than what exactly it is? (I read in a site that everything in
windows is an "object")

This is a basic thing to know in Unix and being a Unix resource.....it's
very much required that I make this conception very clear....I request
you geeks to help me make my perception more clear......

I don't need complete details.....any pointers to the subject will
suffice well.........

Please help.....

Lew Pitcher

2007-08-30, 7:21 pm

On Aug 30, 3:21 pm, alkara.op...@gmail.com wrote:
> "In UNIX every thing is a file"
>
> I am quite able to understand this concept.....but to be able to
> appreciate the difference in a clear way.....I need to understand why
> is everything not a "file" in windows


Why? Well, because Microsoft designed it that way.

As for what "everything is a file" means, it means that
a) to access basic hardware, you don't use a special hardware-specific
API. Instead, you use standard file I/O against a "special" file
b) to access OS settings and values, you don't use a special set of
system control APIs. Instead, you use standard file I/O against a
special file
c) to access network services, you don't use a special set of network-
specific APIs (well, mostly you dont :-) ). Instead, you use standard
file I/O against a special file (opened using a network-generic API)
d) to read or write to kernel memory... same as above
e) to read or write to the raw video... same as above

You get the picture


> ........and if every thing is not a
> file.....than what exactly it is? (I read in a site that everything in
> windows is an "object")


And each type of object, in Windows, has it's own API for access.
Wouldn't it be nice if you could read system stats with the same code
as you could read a flat file? Or tune the system with the same API as
one that writes a file? Only one simple API to learn.

> This is a basic thing to know in Unix and being a Unix resource.....it's
> very much required that I make this conception very clear....I request
> you geeks to help me make my perception more clear......
>
> I don't need complete details.....any pointers to the subject will
> suffice well.........
>
> Please help.....



Chris F.A. Johnson

2007-08-30, 7:21 pm

On 2007-08-30, alkara.opesh@gmail.com wrote:
>
> "In UNIX every thing is a file"


The original statement was, "In UNIX everything is a stream of
bytes." A file was one example of a stream of bytes.

--
Chris F.A. Johnson, author | <http://cfaj.freeshell.org>
Shell Scripting Recipes: | My code in this post, if any,
A Problem-Solution Approach | is released under the
2005, Apress | GNU General Public Licence
Dave Hinz

2007-08-30, 7:21 pm

On Thu, 30 Aug 2007 17:24:06 -0400, Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
> On 2007-08-30, alkara.opesh@gmail.com wrote:
>
> The original statement was, "In UNIX everything is a stream of
> bytes." A file was one example of a stream of bytes.


OK since we're on the topic, just this year I first noticed the
existance of a special file type in Unix called a "door". Can someone
explain what that is? I asked our high guru and his answer was probably
accurate but not very enlightening.

Robert Melson

2007-08-31, 1:18 am

In article <5jp4baFlusqU2@mid.individual.net>,
Dave Hinz <DaveHinz@gmail.com> writes:
> On Thu, 30 Aug 2007 17:24:06 -0400, Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
>
> OK since we're on the topic, just this year I first noticed the
> existance of a special file type in Unix called a "door". Can someone
> explain what that is? I asked our high guru and his answer was probably
> accurate but not very enlightening.
>

Errmmmm. This on Solaris? Apart from the concept of jail
doors, Sun/Solaris is evidently the only commercial version
of Unix to use this - at least a quick google search would
seem to indicate that. What it is, what it does, dunno - I'm
about 4 years out of date (retirement's great!).

Bob Melson



--
Robert G. Melson | Rio Grande MicroSolutions | El Paso, Texas
-----
"People unfit for freedom---who cannot do much with it---are
hungry for power." ---Eric Hoffer

Frank Cusack

2007-08-31, 7:17 am

On 31 Aug 2007 00:06:02 GMT Dave Hinz <DaveHinz@gmail.com> wrote:
> On Thu, 30 Aug 2007 17:24:06 -0400, Chris F.A. Johnson <cfajohnson@gmail.com> wrote:
>
> OK since we're on the topic, just this year I first noticed the
> existance of a special file type in Unix called a "door". Can someone
> explain what that is? I asked our high guru and his answer was probably
> accurate but not very enlightening.


An extremely low latency IPC mechanism.
Stefaan A Eeckels

2007-08-31, 7:17 am

On Fri, 31 Aug 2007 05:21:42 -0000
melsonr@aragorn.rgmhome.net (Robert Melson) wrote:

> In article <5jp4baFlusqU2@mid.individual.net>,
> Dave Hinz <DaveHinz@gmail.com> writes:
> Errmmmm. This on Solaris? Apart from the concept of jail
> doors, Sun/Solaris is evidently the only commercial version
> of Unix to use this - at least a quick google search would
> seem to indicate that. What it is, what it does, dunno - I'm
> about 4 years out of date (retirement's great!).


It's a fast RPC mechanism. From the man page:

> Doors are a fast light-weight RPC mechanism for secure con-
> trol transfer between processes on the same machine. Concep-
> tually, a thread in one process can issue a call using a
> door descriptor that causes code to be executed in another
> process and then returns using the traditional synchronous
> RPC model. Doors can also be used to pass data and file
> descriptors between processes.


It's pretty neat actually.

--
Stefaan A Eeckels
--
"We have gone from a world of concentrated knowledge and wisdom to one
of distributed ignorance. And we know and understand less while being
increasingly capable." Prof. Peter Cochrane, formerly of BT Labs
(With thanks to Brian Hamilton Kelly)
Stefaan A Eeckels

2007-08-31, 7:17 am

On Thu, 30 Aug 2007 12:21:52 -0700
alkara.opesh@gmail.com wrote:

> "In UNIX every thing is a file"


In most (if not all) OSes that preceded Unix, devices were treated in a
non-uniform way. In Unix, the file system is used as a
universal name-space.

Basic access to anything (disk file, terminal, printer, the disk
devices themselves etc) is done using the same API. You can look at a
disk the same way you look at a file on that disk, without knowing that
one is a high-level structure in a file system, and the other a
low-level device:

$ od -cx /dev/rdsk/c0d0t0s1

$ od -cx /var/adm/messages

In the first example you'll see the raw bytes on the disk (including
the headers etc), in the second example the contents of a file. In both
cases the "od" program is blissfully unaware of the difference.

Contrast this to some early microcomputer operating systems where
different size floppy disks needed different programs to copy files to
and from them.

MS-DOS and Windows NT also treat devices as files, but do not use the
Unix concept of using the file system as a universal name space.


--
Stefaan A Eeckels
--
"Technically, Windows is an 'operating system,' which means that it
supplies your computer with the basic commands that it needs to
suddenly, with no warning whatsoever, stop operating." -Dave Barry
Robert Melson

2007-08-31, 1:19 pm

In article <20070831100950.46e47ecf.hoendech@ecc.lu>,
Stefaan A Eeckels <hoendech@ecc.lu> writes:
> On Fri, 31 Aug 2007 05:21:42 -0000
> melsonr@aragorn.rgmhome.net (Robert Melson) wrote:
>
>
> It's a fast RPC mechanism. From the man page:
>
>
> It's pretty neat actually.
>


Thank you. Retired or not, there's always something new to
learn.

Bob Melson

--
Robert G. Melson | Rio Grande MicroSolutions | El Paso, Texas
-----
"People unfit for freedom---who cannot do much with it---are
hungry for power." ---Eric Hoffer

Doug Freyburger

2007-08-31, 7:17 pm

Dave Hinz <DaveH...@gmail.com> wrote:
> Chris F.A. Johnson <cfajohn...@gmail.com> wrote:
>
>
> OK since we're on the topic, just this year I first noticed the
> existance of a special file type in Unix called a "door". Can someone
> explain what that is? I asked our high guru and his answer was probably
> accurate but not very enlightening.


Having established that it passes rpc/ipc messages from
thread/process to thread/process, I'd like to move on to
what uses doors?

The first time I saw a file of type door was a version of
Solaris some years ago. Running truss on various processes
never seemed to show any of them using it.

I would think that apps like Oracle that use bunches of process
would use doors. Nope, IPC. I would think that apps like Java
that use bunches of thread would use doors. Nope.

Booker Bense

2007-08-31, 7:17 pm

In article <1188585575.647658.231760@w3g2000hsg.googlegroups.com>,
Doug Freyburger <dfreybur@yahoo.com> wrote:
>Dave Hinz <DaveH...@gmail.com> wrote:
>
>Having established that it passes rpc/ipc messages from
>thread/process to thread/process, I'd like to move on to
>what uses doors?
>


Things written only for Solaris, which pretty much rules out any
third party software unless they REALLY need the extra
performance.

The only software that I personally know uses doors is syslog on
solaris ( this is most annoying if you want to syslog from other
than C. ). There are probably others, but I think this one of
those solutions looking for a problem that pop up from time to
time. Not that most unix systems couldn't use a better
lightweight RPC mechanism, but single platform IPC seems
a poor choice for your typical unix application.

_ Booker C. Bense
Frank Cusack

2007-08-31, 7:17 pm

On Fri, 31 Aug 2007 18:57:22 +0000 (UTC) bbense@telemark.slac.stanford.edu (Booker Bense) wrote:
> In article <1188585575.647658.231760@w3g2000hsg.googlegroups.com>,
> Doug Freyburger <dfreybur@yahoo.com> wrote:
> The only software that I personally know uses doors is syslog on
> solaris ( this is most annoying if you want to syslog from other
> than C. ).


You could use the 'logger' program for most interpreted languages
without a syslog() interface. What wouldn't be covered by that?

> There are probably others, but I think this one of
> those solutions looking for a problem that pop up from time to
> time.


Disagree (humbly). Faster IPC is definitely highly desirable. Also,
the ability to pass file descriptors sounds fantastic.

I think nscd also uses doors.

-frank
Dave Hinz

2007-08-31, 7:17 pm

On Fri, 31 Aug 2007 05:21:42 -0000, Robert Melson <melsonr@aragorn.rgmhome.net> wrote:
> In article <5jp4baFlusqU2@mid.individual.net>,
> Dave Hinz <DaveHinz@gmail.com> writes:


[vbcol=seagreen]
> Errmmmm. This on Solaris?


Sorry, yes, should have specified. Solaris8 I believe.

> Apart from the concept of jail
> doors, Sun/Solaris is evidently the only commercial version
> of Unix to use this - at least a quick google search would
> seem to indicate that. What it is, what it does, dunno - I'm
> about 4 years out of date (retirement's great!).


If you want back in the trenches, Bob, say the word...

Booker Bense

2007-09-03, 11:17 am

In article <m2abs7s14r.fsf@sucksless.myhome.westell.com>,
Frank Cusack <fcusack@fcusack.com> wrote:
>On Fri, 31 Aug 2007 18:57:22 +0000 (UTC) bbense@telemark.slac.stanford.edu (Booker Bense) wrote:
>
>You could use the 'logger' program for most interpreted languages
>without a syslog() interface. What wouldn't be covered by that?


"Annoying", not impossible to work around. All that hoopy "fast IPC"
seems kind of useless if you have to fork a process just to log
a message.

>
>
>Disagree (humbly). Faster IPC is definitely highly desirable.


s/Faster/Faster portable/ and you'll get no arguement from me.

_ Booker C. Bense







Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com