LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 05-29-2012, 06:34 PM   #1
john_
LQ Newbie
 
Registered: May 2012
Posts: 1

Rep: Reputation: Disabled
Retransmission queue


Dear All,

I'm trying to understand how TCP is working in linux kernel, I've been reading this lxr.free-electrons.com/source/net/ipv4/tcp_input.c#L3685", and flylib.com/books/en/3.475.1.124/1/ and I'm interested in how many timers are accessing one data structure, like retransmission queue is being accessed by retransmit timer and also by another processes when the ack is actually received, is spinlock/mutux used in here.
And the above made me think about another question. which is what will happen if ACK is received at the same time retransmit timer reached 0 and interrupted the first thread, what will happen then?
 
Old 05-30-2012, 04:56 PM   #2
sundialsvcs
LQ Guru
 
Registered: Feb 2004
Location: SE Tennessee, USA
Distribution: Gentoo, LFS
Posts: 10,679
Blog Entries: 4

Rep: Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947Reputation: 3947
There are a few things that you need to generally keep in mind when studying code like this. "Spinlocks" are used by low-level kernel code when it is necessary to prevent two CPUs from accessing the same data structures. "Mutexes" are used to coordinate the actions of processes and threads... kernel or otherwise. "Queues" are used obviously to manage lists of work that must happen "soon but not always immediately." The list of packets that have recently been received and the list of packets that are due to be transmitted are in both cases handled by queues.

Within the kernel, by design, most activities are non-preemptable. The kernel never has control "taken away from it," although it can "give it up." This simplifies the kernel considerably vs. the "microkernel" architecture that is used by other systems. (BTW: that's a large kettle of fish which I choose to keep firmly and tightly shut.)

Speaking generally, software drivers of all types have the same basic design: they are notified of activities by means of queues and/or flags in a data structure that they can examine "without the possibility of that data structure changing while they are doing it," and they respond (if at all) to whatever condition they discover, then loop back and do it again. For example, in the case you described, a driver might observe that "there is an ACK in the queue, and the retransmit timer has popped, and oh by the way the latest asynchronous I/O operation that you performed has been completed with error #53." The driver will now, given all of this, choose how to respond. The ACK won't disappear from the queue unless the driver removes it; the timer won't be started again unless the driver restarts it. There is only one driver instance, one way or the other, for any device.

Last edited by sundialsvcs; 05-30-2012 at 04:57 PM.
 
  


Reply



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
Unexpected TCP Retransmission. $ubbu Linux - Networking 10 06-01-2012 02:09 PM
Any chance to get length of run queue and swap queue? emJ4y Programming 1 11-03-2010 02:13 PM
How to untar my tarred mail queue folder back to the sendmail queue directory again? Md.Abul Quashem Linux - Server 6 02-16-2010 08:32 AM
Is it possible for me to write in front of queue in case of message queue? hemanthv414 Linux - Newbie 1 11-17-2008 04:40 PM
ack retransmission jackandking Linux - Networking 5 07-05-2007 06:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 10:42 PM.

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
Open Source Consulting | Domain Registration