[Simh] race conditions in ethernet code?

Hittner, David T. david.hittner at ngc.com
Thu Aug 30 15:14:09 EDT 2007


The USE_READER_THREAD code was added by Mark, as an option for those
platforms that are so slow that they drop packets.
I have never tested it, but Mark assures me it works on his very slow
(<500 Mhz Intel) platforms.

It should not be enabled unless dropped packets become a problem. Many
protocols retransmit lost packets automatically.

Dave Hittner
SIMH Ethernet developer


-----Original Message-----
From: simh-bounces at trailing-edge.com
[mailto:simh-bounces at trailing-edge.com] On Behalf Of Peter Lund
Sent: Thursday, August 30, 2007 2:50 PM
To: simh
Subject: [Simh] race conditions in ethernet code?

Is it me or are there race conditions and just in general bad threading
code in sim_ether.c?

sim_ether uses libpcap to read and write raw ethernet packets.  If
USE_READER_THREAD is defined, it uses the pthread interface to run an
extra thread that receives packets from libpcap, presumably to avoid the
risk of losing them if the simulator blocks for too long.

sim_ether has some queue routines, which all have names beginning with
'ethq_'.  These routines do not do any locking.

There is apparently a queue per opened ethernet device, which has a
pthread mutex in it.  The reader thread and the function eth_read() lock
the mutex around ethq_ calls but they are the only ones to do so.

-Peter, rather confused by this code


_______________________________________________
Simh mailing list
Simh at trailing-edge.com
http://mailman.trailing-edge.com/mailman/listinfo/simh



More information about the Simh mailing list