Linux-Development-Sys Digest #185, Volume #7 Sun, 12 Sep 99 13:13:42 EDT
Contents:
Re: You can now use Winmodems in Linux!!!!!!! (webx1)
Re: select() and FD_SETSIZE (Alan Curry)
Re: Max threads and TCP connections? (Leslie Mikesell)
Re: Max threads and TCP connections? (Leslie Mikesell)
Re: threads (Leslie Mikesell)
Re: Figure Out The MS Source Code Yourself (Robin Becker)
Re: Linux parport question (Kai Stuke)
Writing an own simple bootloader for Linux (Lennart Poettering)
Re: You can now use Winmodems in Linux!!!!!!! ("Joon Nan")
Re: threads (Joseph H Allen)
Re: glibc2.1.2 and libX11 problem ("Dawg Lone")
Re: Win95 is a bloody pain in th ass(after I installed linux)!!
([EMAIL PROTECTED])
Re: threads (Kaz Kylheku)
Re: threads (Joseph H Allen)
Re: threads (Kaz Kylheku)
Re: glibc2.1.2 and libX11 problem (Andreas Jaeger)
Re: glibc2.1.2 and libX11 problem (Paul J Collins)
----------------------------------------------------------------------------
From: webx1 <[EMAIL PROTECTED]>
Subject: Re: You can now use Winmodems in Linux!!!!!!!
Date: Sun, 12 Sep 1999 03:31:15 GMT
shoot me that program please, I would to go on the net with my winmodem!!!
thanks a lot!!
================== Posted via CNET Linux Help ==================
http://www.searchlinux.com
------------------------------
Subject: Re: select() and FD_SETSIZE
From: [EMAIL PROTECTED] (Alan Curry)
Date: Wed, 08 Sep 1999 01:58:05 GMT
In article <[EMAIL PROTECTED]>,
Nix <$}xinix{[email protected]> wrote:
>[EMAIL PROTECTED] (Alan Curry) writes:
>
>> I'd rather edit
>> /etc/termcap than go through the tic/untic/infocmp compilation cycle.
>
>Users cannot edit /etc/termcap.
That's why they have the TERMCAP environment variable.
Would you like to mention any other non-problems that terminfo solves?
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
[EMAIL PROTECTED]|bigotries (should| [ | | ] / _> / _>
==============+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
From: [EMAIL PROTECTED] (Leslie Mikesell)
Subject: Re: Max threads and TCP connections?
Date: 12 Sep 1999 00:35:20 -0500
In article <[EMAIL PROTECTED]>,
No Spam <[EMAIL PROTECTED]> wrote:
>What i'm talking about is a server listening for incoming connections
>on a port or ports and happily (hopefully) accepting 1 million
>connections (from machines over internet each with a different IP.
Do these really need to be maintained as open connections or
can the clients re-connect as they need something the way
web browsers do?
>But what I'm really getting at is comments or thoughts on actually
>servicing these 1 million+ connections. Assuming i have infinite
>network bandwidth, I still have to have data structures and shit
>associated with each of the connections on the server to actually
>respond to stuff coming in on them. Additionally, I assume on Linux
>each of these TCP connections will use some default TCP window size
>which is some number of bytes of buffers. No to mention TCP timers and
>other crap.
Yes, tcp needs space to re-assemble the stream from potentially
out-of-order packets. Consider what will happen when a major
internet router fails and the next third of your received packets
have to be buffered while a re-routed intermediate packet catches
up. Likewise your outbound packets have to be buffered until
acknowledged, and some small percentage never will be.
>Then the big one, I essentailly *can't* simply create a thread
>or process to handle each connection do to the shear number. So is
>there a way to have an ultra light chunk of C code sit on top of each
>connection (perhaps one glorious process with a magic TCPIN and TCPOUT
>function) and process incoming data and outgoing data basically in a
>callback from TCP without going through thread or other sychronization
>object overhead?
Select() or poll() will watch many connections at once and tell
you which are ready. But somewhere way before you reach that
scale I think you will want to fan the connections out to many
servers, and if necessary connect them all to a backend database
to maintain consistent state.
Les Mikesell
[EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (Leslie Mikesell)
Subject: Re: Max threads and TCP connections?
Date: 12 Sep 1999 00:41:39 -0500
In article <[EMAIL PROTECTED]>,
David Schwartz <[EMAIL PROTECTED]> wrote:
>
>Kaz Kylheku wrote:
>
>> What task cannot be solved without requiring hundreds of threads on one
>> machine?
>
> A web server that gets all its pages from NFS servers mounted over
>potentially unreliable WAN links. Even then, it may well be better to
>use non-blocking reads -- the problem is knowing when to do them.
That's bordering on insanity... Why not run a web server on the
machine with the disks or at least on the same ethernet, then
use a reverse proxy on the primary web server to transparently
pass them through (possibly with local caching)? Apache does
this with the ProxyPass directive. Or, if the pages are fairly
static, just mirror the disk with rsync periodically.
Les Mikesell
[EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED] (Leslie Mikesell)
Subject: Re: threads
Date: 12 Sep 1999 00:49:15 -0500
In article <[EMAIL PROTECTED]>,
David Schwartz <[EMAIL PROTECTED]> wrote:
>
>> >To do this with separate processes means you have the extra overhead
>> >associated with maintaining separate address spaces. There is also the
>> >overhead associated with synchronization and communications between
>> >processes. Threads are essentially a light weight form of multitasking.
>>
>> Yes, but linux's processes aren't that much more heavyweight than
>> threads (on VMS or NT, processes are indeed relatively high overhead).
>
> This is true but irrelevant.
>
> A model of 'one process per connection' that needs to handle ten
>connections will _always_ need ten context switches. A multithreaded
>program that does _NOT_ use a model of 'one thread per connection' may
>be able to handle ten connections without ever switching threads even
>once.
How do you do that? Aren't you going to do a context switch into
the kernel and back every time you perform I/O? And doesn't
the kernel know the 'right' process to run when something is
available for it's connection?
Les Mikesell
[EMAIL PROTECTED]
------------------------------
From: Robin Becker <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.misc
Subject: Re: Figure Out The MS Source Code Yourself
Date: Sun, 12 Sep 1999 04:50:19 +0100
In article <[EMAIL PROTECTED]>, Phil Hunt
<[EMAIL PROTECTED]> writes
>In article <[EMAIL PROTECTED]> [EMAIL PROTECTED] "David Frantz" writes:
>> You have to be very carefull now a days with recieving RF
>> transmissions. We in the USA are now in the unique position of sharing
>> a law that make the reception of radio signals from Cell Phones a
>> crime. The only other country that we share such a law with is North
>> Korea, really make you wonder!
>>
>> Also the FCC, under pressure from the FBI, CIA, NSA and other goverment
>> organizations, to restrict what you can listen to. The FCC was also
>> just recently forced to change its Cell Phone regulations to require Cell
>> Phone companies to provide tracking capabilities. This is so Big
>> Brother will always know were you are.
>
>In the light of things like this, I find it surprising that anyone
>doubts that the NSA might force Microsoft to put a backdoor in
>Windows.
>
last time I checked the British Home Secretary was allowed to control
communication by means of electromagnetic radiation. No winking now :)
--
Robin Becker
------------------------------
From: Kai Stuke <[EMAIL PROTECTED]>
Subject: Re: Linux parport question
Date: Sun, 12 Sep 1999 13:15:20 +0200
Reply-To: [EMAIL PROTECTED]
Bas Rijniersce wrote:
[...]
> struct pardevice res;
[...]
> struct pardevice *parport_register_device(struct parport *port,
> const char *name,
> int (*pf)(void *), void (*kf)(void *),
> void (*irq_func)(int, void *, struct pt_regs
> *),
> int flags, void *handle);
>
> What am I dowing wrong??
parport_register_device returns a _pointer_ to a struct pardevice. Your
variable res is declared as struct pardevice and not as a pointer to it,
hence the 'incompatible types in assignment' error.
Just change the first line to
struct pardevice *res;
Kai
------------------------------
From: Lennart Poettering <[EMAIL PROTECTED]>
Subject: Writing an own simple bootloader for Linux
Date: Sun, 12 Sep 1999 16:36:10 +0200
Reply-To: Lennart Poettering <[EMAIL PROTECTED]>
Hello!
I am working on a project to develop an open-sourced MP3-Hardware-Player
based on a PC-Architecture and Linux. I want to boot from a self-built
EEPROM-Device on the ISA-Bus. The code on this device shall load a
Linux-Kernel from another device attached to the parallel Port. For that
i need to write a very simple, minimalistic bootloader, which gets the
address of a memory-block containing the raw linux-kernel.
How is this done? Has anybody already written such a simplistic
bootloader?
What do i need to start a linux-kernel? Where do I get information about
it?
I just wanted to be sure that I do not reenvent the wheel by looking on
the sourcecodes of LILO and loadlin.
--
name { Lennart Poettering } mail { [EMAIL PROTECTED] }
icq# { 11060553 } www { http://www.poettering.de/lennart }
dynamic dns { poettering.ath.cx || poettering.dyndns.org }
------------------------------
From: "Joon Nan" <[EMAIL PROTECTED]>
Subject: Re: You can now use Winmodems in Linux!!!!!!!
Date: Sun, 12 Sep 1999 21:31:51 +0800
How? Could you please show me. I'm urge to get my modem work.
Regards,
JNC
webx1 <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> shoot me that program please, I would to go on the net with my winmodem!!!
>
> thanks a lot!!
>
> ------------------ Posted via CNET Linux Help ------------------
> http://www.searchlinux.com
------------------------------
From: [EMAIL PROTECTED] (Joseph H Allen)
Subject: Re: threads
Date: Sun, 12 Sep 1999 13:44:36 GMT
In article <[EMAIL PROTECTED]>,
David Schwartz <[EMAIL PROTECTED]> wrote:
> I must admit, it frequently winds up being convenient to do just this,
>but it really is more elegant to have a 'any thread can do any job'
>model. This way, you are never forced to have a context switch unless a
>shared resource is contended for, an I/O operation blocks, or a blocking
>I/O operation completes.
I've been thinking about this 'any thread can do any job' model some more.
I think you want a large pool of fixed threads- the limit should really only
be dictated by how much memory you want to waste on per-thread overhead. I'm
wondering if all free threads should be waiting on select() though-
certainly there should be at least as many as there are processors. This
way a new request will be processed if all of the other threads are blocked,
and each processor will always be doing something. You may want even more
threads waiting on select()- perhaps you want some timesharing to take place
on each processor if you expect each request to take a long time. So should
there be a semaphore to limit the threads waiting on select() or should all
threads wait on select()? What happens to threads which are waiting on
select() when new I/O becomes available- they all must get waken right?
This is bad right?
Is there any reason that the threads waiting in select() should have a lower
priority (at least while they're actually in select()) than blocked threads?
I'm thinking that you may not want to start new requests if existing threads
are ready to be scheduled.
Should threads read and enque requests from all ready fds, or just take the
first available request? I think it should probably read everything, since
the context switch overhead from a bunch of read()s in a row is probably
less than that from a bunch of read()s with delays in between them (the
cache will be reused if there are delays). On the other hand, there should
be a limit as to how many requests you accept- so as not to allocate
infinite memory in the input queue if the clients are feeding you data
faster than you can process it.
I'm actually writing a new database, so this discussion is good because I
have to deal with these issues soon.
--
/* [EMAIL PROTECTED] (192.74.137.5) */ /* Joseph H. Allen */
int a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0)
+r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p<1659?79:0:p>158?-79:0,q?!a[p+q*2
]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n"," #"[!a[q-1]]);}
------------------------------
From: "Dawg Lone" <[EMAIL PROTECTED]>
Subject: Re: glibc2.1.2 and libX11 problem
Date: Sun, 12 Sep 1999 10:47:21 -0400
Thanks for the reply, I upgraded from libc5.
I re-compiled the library and double checked that the headers in include
were 2.1.2. Still no luck though, I am trying to run both the blackdown
jdk1.2 and the ibm jdk1.1, if I ldd the executeables, they are both linked
with libc.so.6.
Still I get the _xstat not found when I try to start any windows with it.
Any other ideas?
[EMAIL PROTECTED]
Andreas Jaeger <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]...
> >>>>> Dawg Lone writes:
>
> > Hi, i have just upgraded to glibc2.1.2. The build and install went
fine, an
> From which library did you upgrade?
> > di follwed the instructions in the glibc2-howto. I can compile programs
and
> > everything wokrs fine except for pre-compiled programs using X, i am
> > getting an undefined symbol: _xstat in libX11.so.6..
> Recompile your libraries and check that you really have the glibc
> 2.1.2 headers in /usr/include. _xstat is not declared/defined in
> glibc, it comes with libc5 only.
>
> Andreas
> --
> Andreas Jaeger [EMAIL PROTECTED] [EMAIL PROTECTED]
> for pgp-key finger [EMAIL PROTECTED]
------------------------------
From: [EMAIL PROTECTED]
Subject: Re: Win95 is a bloody pain in th ass(after I installed linux)!!
Date: Sun, 12 Sep 1999 14:39:08 GMT
Not trying to start a flame war, but are you sure Win95
is the pain in the A**? I used slackware ver 3.4 for
two years, then my sound card went bad. I spent countless
hours trying to configure linux for my new sound device.
Somewhere I read that linux 2.2.x incorporated modular
sound support, so I ftp'd the entire slackware-4.0
directory from cdrom.com. With a 24K modem connection
and several ISP disconnects, it took the better of 3
nights. Still, I wasn't paying CheapBytes $8 for shipping
$8 worth of CD's for something I could get free. I
deleted the linux native partition & swap partition,
added them again, then went throught the install. Then
I used menuconfig to identify my ethernet card, my OSS
sound device, and to remove support for SCSI and PCMCIA.
Menuconfig told me that I was ready to make zImage. No,
I wasn't. I had not made dev or made clean. After
doing that, I started make zImage. It crashed looking
for md_disk or md_install or md_something. The bare.i
that I downloaded worked without network support, but
isapnp would not recognize my internal modem that worked
fine under slackware 3.4. My sound didn't work, my modem
didn't work, my network card wasn't recognized, and I
hadn't even started the misery of trying to get StarOffice,
ICQJava, or RealPlayer installed. I sat there, asked
myself, is it worth it? I want to use netscape, quicken
(for Checkfree bill payment), realplayer, irc, ICQ, play
music CD's, install CD-distributed software, play gin
rummy, and use my pc for networking my notebook for
printing and tape backups. Windows did all that without
tweaking, cussing, searching newsgroups for answers, or
downloading massive files with a modem. I went into DOS
fdisk, deleted the nonDOS partitions, created DOS
extended partitions in their place, gave them a logical
drive letter, and instantly had 2 gig of hard drive
space that had been squandered with new and outdated
libraries to run various linux apps. I'm not a Microsoft
advocate, but my ass was sore from sitting for hours
trying to get my computer to make a noise other than "honk".
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: threads
Reply-To: [EMAIL PROTECTED]
Date: Sun, 12 Sep 1999 15:28:20 GMT
On Sun, 12 Sep 1999 13:44:36 GMT, Joseph H Allen <[EMAIL PROTECTED]> wrote:
>In article <[EMAIL PROTECTED]>,
>David Schwartz <[EMAIL PROTECTED]> wrote:
>
>> I must admit, it frequently winds up being convenient to do just this,
>>but it really is more elegant to have a 'any thread can do any job'
>>model. This way, you are never forced to have a context switch unless a
>>shared resource is contended for, an I/O operation blocks, or a blocking
>>I/O operation completes.
>
>I've been thinking about this 'any thread can do any job' model some more.
>I think you want a large pool of fixed threads- the limit should really only
>be dictated by how much memory you want to waste on per-thread overhead. I'm
>wondering if all free threads should be waiting on select() though-
>certainly there should be at least as many as there are processors. This
>way a new request will be processed if all of the other threads are blocked,
>and each processor will always be doing something.
I think that this is what I/O completion ports on NT are basically supposed
to to.
------------------------------
From: [EMAIL PROTECTED] (Joseph H Allen)
Subject: Re: threads
Date: Sun, 12 Sep 1999 15:50:30 GMT
Actually I have another question about mutexes (actually spin locks)... is
it worth while to busy wait a while before yielding? In a multi-cpu
situation this might be more efficient if the locked code sequence is short.
Do the system calls or threads calls do this for you already?
--
/* [EMAIL PROTECTED] (192.74.137.5) */ /* Joseph H. Allen */
int a[1817];main(z,p,q,r){for(p=80;q+p-80;p-=2*a[p])for(z=9;z--;)q=3&(r=time(0)
+r*57)/7,q=q?q-1?q-2?1-p%79?-1:0:p%79-77?1:0:p<1659?79:0:p>158?-79:0,q?!a[p+q*2
]?a[p+=a[p+=q]=q]=q:0:0;for(;q++-1817;)printf(q%79?"%c":"%c\n"," #"[!a[q-1]]);}
------------------------------
From: [EMAIL PROTECTED] (Kaz Kylheku)
Subject: Re: threads
Reply-To: [EMAIL PROTECTED]
Date: Sun, 12 Sep 1999 16:49:43 GMT
On Sun, 12 Sep 1999 15:50:30 GMT, Joseph H Allen <[EMAIL PROTECTED]> wrote:
>Actually I have another question about mutexes (actually spin locks)... is
>it worth while to busy wait a while before yielding? In a multi-cpu
>situation this might be more efficient if the locked code sequence is short.
>Do the system calls or threads calls do this for you already?
There is no simple answer to this, but we can restrict ourselves to the kinds
of architectures that Linux supports.
There are two main problems with busy waiting on a spinlock (in user space):
1. Whoever is holding the lock may be currently descheduled. By spinning, you
simply waste cycles until you yield. Even in a multiprocessor, the thread that
is holding the lock may have an affinity for the same processor where the
spinning is taking place.
2. The bigger problem is with priorities. If the busy waiter has a higher
priority than the thread holding the lock, there is a potential for a livelock
situation. The higher priority thread is hogging the CPU, preventing the low
priority thread from executing in order to give up the lock. This is true
regardless of whether the busy waiter yields or not! One solution to boost the
priority of each thread that holds one of these locks, but you need some
light-weight way to do this. If you have to call the kernel in order to do
this, you might as well implement a kernel synchronization mechanism. Another
solution is to implement a backoff whereby you switch from yielding to doing a
fine-grained sleep that is intended to allow another thread to be scheduled.
The early implementations of LinuxThreads used spinlocks in the implementations
of pthread_mutex_t as well as internal locks. This was changed in favor of a
fast lock mechanism which uses a wait-free suspend queue to resolve contention.
The wait-free queue mechanism relies on an atomic compare-and-exchange
instruction. It basically allows a processor to add a node at the head of a
queue without acquiring any kind of lock. The pointer manipulation is done
using an atomic instruction. The insertion can fail, in which case the thread
tries again. But the eventual success is guaranteed; there can be no livelocks,
because a thread cannot be interrupted while it is executing the atomic compare
and exchange, and if it is interrupted at other times, it can't prevent other
threads from doing the insertion.
What about architectures that don't have an atomic compare and exchange?
LinuxThreads supports these by implementing a ``fake'' atomic compare and
exchange function which uses a spinlock based on the less powerful atomic
test-and-set. Livelock problems are prevented using the backoff sleep
technique. The spinlock function looks like this:
static void __pthread_acquire(int * spinlock)
{
int cnt = 0;
struct timespec tm;
while (testandset(spinlock)) {
if (cnt < MAX_SPIN_COUNT) {
sched_yield();
cnt++;
} else {
tm.tv_sec = 0;
tm.tv_nsec = SPIN_SLEEP_DURATION;
nanosleep(&tm, NULL);
cnt = 0;
}
}
}
The SPIN_SLEEP_DURATION has to be large enough to allow a meaningful scheduling
action to take place which will resolve the suspected livelock, but small
enough to avoid introducing an excessive delay.
In the Linux kernel, the picture is simpler, because you have access to
privileged instructions to disable interrupts on the local processor, and have
control over preemption. Thus simple spinlocks make an effective mechanism.
One form of the spinlock (spin_lock_irqsave/spin_unlock_irqrestore) disables
local interrupts while the critical region is executing. This gives a guarantee
to any busy waiter that the wait will not be very long; the current owner will
execute a sequence of instructions without being interrupted and promptly give
up the lock. On a single processor kernel, this spinlock mechanism is simply
reduced to disabling interrupts.
------------------------------
From: Andreas Jaeger <[EMAIL PROTECTED]>
Subject: Re: glibc2.1.2 and libX11 problem
Date: 12 Sep 1999 18:08:11 +0200
>>>>> Dawg Lone writes:
> Thanks for the reply, I upgraded from libc5.
> I re-compiled the library and double checked that the headers in include
> were 2.1.2. Still no luck though, I am trying to run both the blackdown
> jdk1.2 and the ibm jdk1.1, if I ldd the executeables, they are both linked
> with libc.so.6.
> Still I get the _xstat not found when I try to start any windows with it.
How does _xstat come into the library? Where is it declared?
You might want to grep through your X11 sources and through your
include paths (/usr/include _and_ /usr/local/include) for an _xstat
declaration.
Andreas
--
Andreas Jaeger [EMAIL PROTECTED] [EMAIL PROTECTED]
for pgp-key finger [EMAIL PROTECTED]
------------------------------
From: Paul J Collins <[EMAIL PROTECTED]>
Subject: Re: glibc2.1.2 and libX11 problem
Date: 12 Sep 1999 17:07:50 +0100
>>>>> "Dawg" == Dawg Lone <[EMAIL PROTECTED]> writes:
Dawg> Still I get the _xstat not found when I try to start any
Dawg> windows with it.
I saw the problem the time I upgraded from libc5 to glibc2. It
appears that the X libs depended upon _xstat being exported from
libc. The glibc developers have taken steps to prevent internal
symbols being used. I do not know what these steps are.
So, the best thing to do is probably grab a new copy of the XFree
libraries, make backups of your old ones, and install em. I have a
way to get *some* libc5 apps to run using a LD_LIBRARY_PATH hack. If
you want details, just ask and I will be happy to supply em.
Cheers,
Paul.
--
Paul Collins <[EMAIL PROTECTED]> Public Key On Keyserver.
Fingerprint: 88BA 2393 8E3C CECF E43A 44B4 0766 DD71 04E5 962C
"I am a stranger in a strange land,
distracted by bright and shiny objects."
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list (and comp.os.linux.development.system) via:
Internet: [EMAIL PROTECTED]
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************