All of lore.kernel.org
 help / color / mirror / Atom feed
* OS I/O operations concepts
@ 2004-12-15 21:10 tony osborne
  2004-12-15 22:54 ` Kyle Moffett
  2004-12-16  8:25 ` Martin Waitz
  0 siblings, 2 replies; 3+ messages in thread
From: tony osborne @ 2004-12-15 21:10 UTC (permalink / raw)
  To: linux-kernel; +Cc: tonyosborne_a

Hello,

I wish to be personally CC'ed the answers/comments posted to the list in 
response to this post

I have some questions regarding the I/O file operations efficiency.

1-)
Consider I/O operations involving the disk. Assume that I write periodically 
one Byte in the file after executing one processing block of code. Does this 
mean that at each of these periods, that only Byte will be stored in the 
disk despite its slow access time, or instead it will be stored in the 
memory buffer (of what size?) first then moved into the disk once the buffer 
is full?

What about the disk bitmap and the one loaded into the memory. Will this be 
updated at each Byte write operation? This will slow down extremely the 
system speed.

Should the programmer force the second option (by using BufferOutputStream 
as in java) or is it done automatically by the JVM or OS?

(I am taking Java only as an example, same hold for C++ and othe r 
languages)


I have read also that writing and reading should be done on chunks of 256 
(512,1024) bytes since the disk sector is of this size. Should I specify 
explicitly the buffer size or will it be handled automatically by the JVM or 
OS?

Say I have a stream of X bytes, should write it into the disk per once, or 
instead repetitively on X/256 bytes size ?


2-)
I/O controller privileges

Does the I/O controller (once the device driver installed) full privileges 
as the main CPU when on kernel mode?

will the driver code be loaded at the top of the kernel code adress space on 
the memory?


3-)   asyncronous I/O operations

i am looking for good tutorial on how asynchrnous I/O operations is 
implemented by OS?
will there be re-ordering of the code sequence execution


is Java system.in.read (system.out.println) synchronous or asynchronous I/O 
Op


thanks for your assistance

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: OS I/O operations concepts
  2004-12-15 21:10 OS I/O operations concepts tony osborne
@ 2004-12-15 22:54 ` Kyle Moffett
  2004-12-16  8:25 ` Martin Waitz
  1 sibling, 0 replies; 3+ messages in thread
From: Kyle Moffett @ 2004-12-15 22:54 UTC (permalink / raw)
  To: tony osborne; +Cc: linux-kernel

On Dec 15, 2004, at 16:10, tony osborne wrote:

[snipped Java efficiency questions]

Overall, the Linux kernel is sufficiently fast and good at scheduling 
IO that
unless you're using well optimized C or assembly, you'll never be able 
to get
better IO results than by just letting the kernel manage it for you.  
Java has
sufficiently many extra layers of indirection that any slowdowns due to 
the
fact that Java is a heavily interpreted language are orders of magnitude
bigger  than any slowdowns from improper IO scheduling.

Cheers,
Kyle Moffett

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GCM/CS/IT/U d- s++: a18 C++++>$ UB/L/X/*++++(+)>$ P+++(++++)>$
L++++(+++) E W++(+) N+++(++) o? K? w--- O? M++ V? PS+() PE+(-) Y+
PGP+++ t+(+++) 5 X R? tv-(--) b++++(++) DI+ D+ G e->++++$ h!*()>++$ r  
!y?(-)
------END GEEK CODE BLOCK------



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: OS I/O operations concepts
  2004-12-15 21:10 OS I/O operations concepts tony osborne
  2004-12-15 22:54 ` Kyle Moffett
@ 2004-12-16  8:25 ` Martin Waitz
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Waitz @ 2004-12-16  8:25 UTC (permalink / raw)
  To: tony osborne; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]

hoi :)

On Wed, Dec 15, 2004 at 09:10:03PM +0000, tony osborne wrote:
> What about the disk bitmap and the one loaded into the memory. Will this be 
> updated at each Byte write operation? This will slow down extremely the 
> system speed.

no, all data is first written into the buffer cache and will be written
to disk later.

> Should the programmer force the second option (by using BufferOutputStream 
> as in java) or is it done automatically by the JVM or OS?

Writing single bytes can be slow because of another reason:
system calls are expensive and it makes sense to buffer data in the
application and send it to the operating system in one big system call.

> Does the I/O controller (once the device driver installed) full privileges 
> as the main CPU when on kernel mode?

I'm not sure if i understood your question correctly but yes,
The IO Controller has full access to physical memory through DMA.

> is Java system.in.read (system.out.println) synchronous or asynchronous I/O 
> Op

They are synchronous. Otherwise you couldn't access your data at the
moment read() returns.

-- 
Martin Waitz

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-12-16  8:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-15 21:10 OS I/O operations concepts tony osborne
2004-12-15 22:54 ` Kyle Moffett
2004-12-16  8:25 ` Martin Waitz

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.