LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-22-2005, 12:04 PM   #1
mjl3434
Member
 
Registered: Sep 2003
Location: USA
Distribution: Ubuntu 20.04
Posts: 111

Rep: Reputation: 15
multi-threaded sliding window


I have to write a reliable multi-threaded file server over (unreliable) udp for simultaneous file transfer of files from the server to the client.

I wanted to start coding but we're getting graded based on efficiency and a number of questions came up.

First we're using a sliding window protocol with 2 byte sequence numbers to implement reliable in order delivery to the upper level protocol.

My question is since the window size should be slightly larger than the delay bandwith product what do you think the best way to measure the delay would be?

My partner and I originally planned on sending a request for what we call a delay determing packet (DDP), and then sending ten of these DDPs, and taking the average of what arrives, and then sending that result back to the other side using stop and wait. This way both sides get the measured delay.

An alternative idea came up however that really avoids all this handshaking (which would be superior for small files where delay dominates anyway) The idea was to start with a default window size and then have a variable length window at the server and to calculate the delay based upon the time acks are received. Of course the receiver would have to have an unnecessarily large window size in order to avoid having to have a variable length window sizeThis seems complex but does anyone think it might be better?
 
Old 10-24-2005, 03:25 PM   #2
Mara
Moderator
 
Registered: Feb 2002
Location: Grenoble
Distribution: Debian
Posts: 9,696

Rep: Reputation: 232Reputation: 232Reputation: 232
Second solution should be better. In the first case you assume that delay will be tha same during the whole transmission. It's usually true for short ones, but for longer it's not (you can also have packets lost etc). Second solutions allows you to change, as the network changes.
 
Old 10-24-2005, 04:16 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
If you *really* wanted a good grade, you'd implement *both* and chart the efficiencies under:

1. High bandwidth/low latency (e.g. LAN) vs Low bandwidth/high latency(e.g. dialup) bandwidth
... and ...
2. Small (1-20 byte) vs large (512 byte - 1K) payloads

It's not necessarily as much work as it might sound like.

And you'd probably come up with a cleaner design by figuring out how to "factor out" the "window-size" protocol from the rest of your send/receive code.

Please consider it!

PS:
Refer to Stevens (Unix Network Programming) and Tanenbaum (Computer Networks, 3rd Ed), too. They've both got some interesting "tips" on flow control issues!

Last edited by paulsm4; 10-24-2005 at 04:20 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
fork()'ed or multi threaded socket I/O? thedevilsjester Programming 5 09-24-2008 12:41 AM
pthreads - multi-threaded server elitecodex Programming 1 08-20-2005 03:58 PM
how to do waitpid() using a multi-threaded server? Thinking Linux - Software 1 04-13-2005 09:50 PM
how to debug multi threaded application sibtay Programming 3 10-15-2004 12:02 PM
Multi-Threaded C pragti Programming 1 06-01-2004 10:50 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:45 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