LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Some confusions about the I/O moudle. (https://www.linuxquestions.org/questions/linux-newbie-8/some-confusions-about-the-i-o-moudle-4175646150/)

Yuc 01-14-2019 12:02 AM

Some confusions about the I/O moudle.
 
I'm reading the book,<COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE> 9th edion, by William Stallings.
In chapter 7 input/output,it talks about the I/O moudles,such as progarmmed I/O,interrupted I/O,DMA I/O,that exist in computers.
I wonder what's the relationships between these moudles and the Linux I/O architecture talks about in book <understanding the linux kernel 3rd>?
I was really confused on how the I/O works in hardware level and kernel level.

Hope someone can give me some suggestions. Thank you.

berndbausch 01-14-2019 12:35 AM

Do you mean “modules”?

I have not read the books, but programmed IO probably means that the driver copies data from memory to interface (writing), initiates the IO operation, then polls the interface for IO completion. When reading, it initiates IO, polls the interface, then copies data from interface to memory.

Interrupt IO is the same except that the driver doesn’t poll. Instead, the kernel can do something else while IO is taking place, and the interface raises an interrupt to indicate IO completion. This interrupt is handled by the driver’s interrupt code.

DMA means that the interface copies data between kernel memory and the interface’s memory.

Which method is adequate for which use case is left as an exercise for the reader.

Yuc 01-14-2019 01:43 AM

Thank you.
Only must I read a lot books maybe I can figure out the confusions.
But I can't wait to figure out this quesiton that is : When we make some I/O operations in our program(let say a java program runs on a linux environment and a x86-64 cpu) such as an read operation,this read operation should be implemented by(I'm not sure) invoke the a system call maybe ,int_w(),read a word once time. The function int_w() is the kernel offers to supply to read a word,but what behind the int_w() (the read operation implementation of the kernel) should be a invoke of an assemble language instruction such as in() or insw() offered by intel x86-64 cpu(I'm not sure,I read the intel 64 Developer’s Manual(https://software.intel.com/en-us/art...l-sdm#combined) volume 1,chapter 5,5.1.9,I/O instructions).But how the instructions in(),insw() was implemented?
Does the implementation of in() or insw() will consider whether the I/O just suport programmed I/O or interrupted I/O or DMA?
Or it's the kernel's consideration when implements the int_w() or what else read operation?

Note:I even didn't know whether my question is a reasonable quetion.Ah,if it is not a reasonable question,I'm sorry.

berndbausch 01-14-2019 01:52 AM

I don’t know the Intel CPU architecture, but there is no need for specific IO instructions. IO can be done by reading/writing memory locations that are mapped to interface registers, and I guess that most IO is done by accessing interface registers.

Yuc 01-14-2019 02:22 AM

Thank you.
Obviously,I need a lot books to read.:study:

Yuc 01-14-2019 02:49 AM

The question I want to figure out seems to be what happened underneath(from software level to hardware level) when invoke a java InputStream.read() or a C read();:banghead:

Yuc 01-14-2019 03:01 AM

Life should always be easy,but I don't know why I always make it hard.:mad:

berndbausch 01-14-2019 04:20 AM

Quote:

Originally Posted by Yuc (Post 5948839)
The question I want to figure out seems to be what happened underneath(from software level to hardware level) when invoke a java InputStream.read() or a C read();:banghead:

This is very complex. Reading from a file involves another major player, the file system buffer cache. Java might add its own buffering. Thus, not each read() results in IO, IO may be delayed or performed in anticipation of later read()s, and several read()s may be bundled in one IO request.

Computer science is all about abstraction. My recommendation: Stay at one abstraction level, don't go down to the bottom. When you drive a car with combustion engine, you don't analyse how exactly the petrol is burnt in the cylinders, do you?

Yuc 01-14-2019 07:21 AM

You are right. I will take your advice. Try to make life easy.


All times are GMT -5. The time now is 08:58 AM.