This is a discussion on Re: Some FreeBSD performance Issues - FreeBSD ; > > > Hello Randy, > > First, let me out myself as a fan of yours. It was your book that got me > started on ASM and taught me a lot about computers and logic, plus it > ...
> Hello Randy,
> First, let me out myself as a fan of yours. It was your book that got me
> started on ASM and taught me a lot about computers and logic, plus it
> provided some entertainment and mental sustenance in pretty boring
> times, so thanks!
> Now, as for your problem: I think I have to agree with the others in
> this thread when they say that the problem likely isn't in FreeBSD. The
> following C program, which uses the read(2) call to read socket.h
> byte-by-byte, runs quickly (0.05 secs on my 2.1GHz system, measured with
<< code snipped>>
> This should be quite equivalent to your second and third code fragment;
> it does one read system call per byte, no buffering involved. This leads
> me to believe that the slowdown occurs in your fileio.read wrapper, or
> maybe in the process setup/teardown process.
Actually, I'd already gone that route. Looking at the wrong copy of read.c
(in the libstd directory) is what had me convinced of the buffering issue.
However, the code you posted is still going through libc, so I'm not ready
to trust that.
However, I just used the syscall system call to make the same INT $80 calls
from C that I'm making from the assembly code and that seems to work okay.
I've disassembled the code for both programs (my assembly code and the C
code that's making direct system calls) and for the life of me, I can't
(yet) see any reason why the C code would run two orders of magnitude
faster. I guess I'm going to have to look at the start-up code used by the C
run-time system and see if it is doing something funny.
Note to others: still haven't done ktrace, through looking at the object
code for the two programs it's hard to believe that there would be extra
system calls taking place or anything like that. If I had to guess at this
point, I'd say that my calls are blocking a lot longer than the C program's.
My user and system times are low, but real time is very high. Still haven't
done ktrace. I'll try that when I get back into town later this week.
email@example.com mailing list
To unsubscribe, send any mail to "firstname.lastname@example.org"