LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-14-2019, 01:02 AM   #1
Yuc
LQ Newbie
 
Registered: Nov 2018
Posts: 13

Rep: Reputation: Disabled
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.
 
Old 01-14-2019, 01:35 AM   #2
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 2,512

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
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.
 
Old 01-14-2019, 02:43 AM   #3
Yuc
LQ Newbie
 
Registered: Nov 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
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.
 
Old 01-14-2019, 02:52 AM   #4
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 2,512

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
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.
 
1 members found this post helpful.
Old 01-14-2019, 03:22 AM   #5
Yuc
LQ Newbie
 
Registered: Nov 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Talking

Thank you.
Obviously,I need a lot books to read.
 
Old 01-14-2019, 03:49 AM   #6
Yuc
LQ Newbie
 
Registered: Nov 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
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();
 
Old 01-14-2019, 04:01 AM   #7
Yuc
LQ Newbie
 
Registered: Nov 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
Life should always be easy,but I don't know why I always make it hard.
 
Old 01-14-2019, 05:20 AM   #8
berndbausch
Senior Member
 
Registered: Nov 2013
Location: Tokyo
Distribution: Redhat/Centos, Ubuntu, Raspbian, Fedora
Posts: 2,512

Rep: Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614Reputation: 614
Quote:
Originally Posted by Yuc View Post
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();
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?

Last edited by berndbausch; 01-14-2019 at 05:22 AM.
 
Old 01-14-2019, 08:21 AM   #9
Yuc
LQ Newbie
 
Registered: Nov 2018
Posts: 13

Original Poster
Rep: Reputation: Disabled
You are right. I will take your advice. Try to make life easy.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Hi....Some confusions with apt s4sarath Ubuntu 5 07-15-2011 06:42 AM
why insmod can't load my moudle ? justme_2008 Linux - Newbie 3 11-17-2008 08:50 PM
dhcpd confusions kidicarus Linux - Networking 6 11-04-2004 05:19 PM
Advansys moudle 2.6.8-pre2 athens101 Linux - Hardware 3 08-17-2004 02:32 AM
kernel confusions? fool_inteligent Slackware 3 08-29-2002 04:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration