[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] [URGENT] Help! "file table overflow" Problem



Hi.

I use FreeBSD for ns simulator

tenet2@~/work/afd/tcp> uname -a
FreeBSD tenet2.knu.ac.kr 4.1-STABLE FreeBSD 4.1-STABLE #5: Fri Aug 11
14:08:16 KST 2000     [email protected]:/usr/src/sys/compile/TENET2
i386

Of course, I search mail archieve but Can't find any solution yet.

I simulate simple RED gateway

============================================================================
===
here are error message

tenet2@~/work/afd/tcp> ns app.tcl
couldn't open "bw258.tr": file table overflow
    while executing
"open bw$i.tr w"
    ("for" body line 4)
    invoked from within
"for {set i 0} {$i < $NUM} {incr i} {
        set fd($i) [open out-tcp$i.tr w]
        set cfd($i) [open out-ctcp$i.tr w]
        set trace_bw($i) [open bw$i.tr w]
}"
    (file "app.tcl" line 51)



============================================================================
====
my simple scripts as follows.

As you can see, may be I open too many filez for bandwidth, cwnd, seqno
checking.

How can I resove this problem?
============================================================================
====
Class TraceApp -superclass Application

TraceApp instproc init {args} {
   $self instvar bytes_
   $self instvar subsum_
   $self instvar tempbytes
   $self set bytes_ 0
   $self set subsum_ 0
   $self set tempbytes 0
   eval $self next $args
}

TraceApp instproc recv {byte} {
   global ns
   $self instvar tempbytes
   set now [$ns now]
   $self instvar bytes_
   $self instvar subsum_
   set bytes_ [expr $bytes_ + $byte]
   set subsum_ [expr $subsum_ + $byte]
   return $bytes_
}

TraceApp instproc get_bytes {} {
   $self instvar bytes_
   return $bytes_
}
TraceApp instproc get_subsum {} {
    $self instvar subsum_
    return $subsum_
}
TraceApp instproc reset {} {
   $self instvar bytes_
   set bytes_ 0
}
TraceApp instproc reset_subsum {} {
    $self instvar subsum_
    set subsum_ 0
}

set NUM  2048

set START 0
set END  100.0
set END_FILE 100.1
set WINDOWSIZE 20
set PACKETSIZE 1000
set WARMUP 1.0

set f [open out.tr w]
for {set i 0} {$i < $NUM} {incr i} {
 set fd($i) [open out-tcp$i.tr w]
 set cfd($i) [open out-ctcp$i.tr w]
 set trace_bw($i) [open bw$i.tr w]
}

set ns [new Simulator]
for {set i 0} {$i < $NUM} {incr i} {
 set s($i) [$ns node]
}
for {set i 0} {$i < $NUM} {incr i} {
 set r($i) [$ns node]
}
set g0 [$ns node]
set g1 [$ns node]

$ns duplex-link $g0 $g1 10.0Mb 10.0ms RED
for {set i 0} {$i < $NUM} {incr i} {
 $ns duplex-link $s($i) $g0 10.0Mb 10.0ms DropTail
}
for {set i 0} {$i < $NUM} {incr i} {
 $ns duplex-link $r($i) $g1 10.0Mb 10.0ms DropTail
}

# trace the bottleneck queue
$ns trace-queue $g0 $g1 $f

set redq [ [$ns link $g0 $g1] queue]
#$redq set setbit_ true

Agent/TCP set window_ $WINDOWSIZE
Agent/TCP set packetSize_ $PACKETSIZE
Agent/TCP set ecn_ 1
for {set i 0} {$i < $NUM} {incr i} {
 set tcp($i) [new Agent/TCP/Reno]
 $ns attach-agent $s($i) $tcp($i)
 set ftp($i) [new Application/FTP]
 $ftp($i) attach-agent $tcp($i)
}
for {set i 0} {$i < $NUM} {incr i} {
 $tcp($i) set class_ $i
}
for {set i 0} {$i < $NUM} {incr i} {
 set sink($i) [new Agent/TCPSink]
 $ns attach-agent $r($i) $sink($i)
 set counter($i) [new TraceApp]
 $counter($i) attach-agent  $sink($i)
}
for {set i 0} {$i < $NUM} {incr i} {
 $ns connect $tcp($i) $sink($i)
}
for {set i 0} {$i < $NUM} {incr i} {
 $ns at $WARMUP "$counter($i) start"
}

#start
for {set i 0} {$i < $NUM} {incr i} {
 $ns at 0.0 "$ftp($i) start"
}

$ns at $END_FILE "finish"

#Record for drawing Xgraph
$ns at 0.0 "record"
proc record {} {
 global tcp sink counter fd cfd trace_bw NUM
 set ns [Simulator instance]
 set time 0.1
 for {set i 0} {$i < $NUM} {incr i} {
  set seqno [$tcp($i) set t_seqno_]
  set cwnd [$tcp($i) set cwnd_]
  set bw [$counter($i) get_subsum]
  set now [$ns now]
  puts $fd($i) "$now $seqno"
  puts $cfd($i) "$now $cwnd"
  puts $trace_bw($i) "$now [expr ($bw*8)/($time*1000000)]"
 }
 #Reset the bytes_ values on the traffic monitors
 for {set i 0} {$i<$NUM} {incr i}  {
  $counter($i) reset_subsum
 }
 $ns at [expr $now+0.1] "record"
}

proc finish {} {
 global ns f NUM counter END WARMUP
 $ns flush-trace
 close $f
 puts "processing output ..."
 exec cat out.tr | awk -f finish.awk > out

 puts "Goodput per source:"
 for {set i 0} {$i < $NUM} {incr i} {
  set bytes [$counter($i) get_bytes]
  set rate [expr $bytes*8/(1000*($END-$WARMUP))]
  puts "Goodput for source $i : $rate kb/s"
 }
     exit 0
}

$ns run

============================================================================
===================

Thanks a lot in advance,
And with best regards...

--
Young S.Choi
mailto:[email protected]
http://tenet2.knu.ac.kr/~guru0109
/"\ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
\ /   ASCII Ribbon Campaign  . Windows: "Where do you want to go today?"
 X  - NO HTML/RTF in e-mail  . Linux: "Where do you want to go tomorrow?"
/ \ - NO Word docs in e-mail . BSD: "Are you guys coming or what?"