Linux-Development-Sys Digest #719, Volume #8     Tue, 15 May 01 11:13:13 EDT

Contents:
  Re: malloc returns NULL! (Vyacheslav Burdjanadze)
  ttyp? & ptyp? can't work under read-only fs ?? (Kevin Liu)
  Re: AIX coff binaries ("Cameron Kerr")
  Re: kernel timer: microsecond ?? (Tim Roberts)
  Re: Recompile Kernel fails (Vyacheslav Burdjanadze)
  Help with customized install cd ("Charles Williams \(CEO\)")
  Idle state code? ("allan")
  looking for a sed tip ("Winston Smith")
  Re: kernel timer: microsecond ?? (NortonNg)
  Re: Idle state code? (Kasper Dupont)
  Re: looking for a sed tip (Kasper Dupont)
  Generic SCSI driver (Andrzej Stypula)
  Re: malloc returns NULL! (Wolfram Gloger)
  Re: Guid generator for unix. (Nix)
  Re: malloc returns NULL! (Nix)
  Re: malloc returns NULL! ("Karl Heyes")
  Driver-writers wanted for breaking new ground!!! ("Olav Drageset")
  Re: ttyp? & ptyp? can't work under read-only fs ?? ([EMAIL PROTECTED])
  Re: Generic SCSI driver (Kasper Dupont)
  Re: Guid generator for unix. (Kasper Dupont)
  shutdown kernel code (Zhiyong Xu)
  Re: Guid generator for unix. (Nick Andrew)
  Re: Time to read the Disk (Joern Engel)

----------------------------------------------------------------------------

Date: Mon, 14 May 2001 17:34:34 +0400
From: Vyacheslav Burdjanadze <[EMAIL PROTECTED]>
Subject: Re: malloc returns NULL!

[EMAIL PROTECTED] wrote:

>         We have an application that makes repeated calls to malloc(), each
> time requesting small amount of memory (around 10 bytes or less). By
> "repeated
> calls", I mean over 70 million calls...
>         Ok, so the problem is this: eventually, malloc will return NULL even
> though there is free memory available (the machine has 2 GB of RAM).
malloc allocates adittional memory for storing blockinfo. try to
allocate huge amount of memory
and reimplement malloc to make it allocating blocks in this huge block.
But then you need to think about memory managment.

------------------------------

From: Kevin Liu <[EMAIL PROTECTED]>
Subject: ttyp? & ptyp? can't work under read-only fs ??
Date: 15 May 2001 01:29:32 GMT

I build a small system in cramfs filesystem, I have a problems that in.telnetd can't 
work, the reason is /dev is read-only, but tty[0-?] and ttyS[0-1] could work under 
read-only filesystem, what should I do?
I'll keep the read-only filesystem and in.telnetd be work, too.

-- 
Best regards,
Kevin Liu

--
MIS Family, Inc.
No.10, Shuren Rd., Shanhua Jen,
Tainan, Taiwan 741.
Tel:+886-6-583-1381
Fax:+886-6-583-5209
http://mis-family.ath.cx

------------------------------

From: "Cameron Kerr" <[EMAIL PROTECTED]>
Subject: Re: AIX coff binaries
Date: Tue, 15 May 2001 17:17:47 +1200

In article <[EMAIL PROTECTED]>, "BrentRBrian"
<[EMAIL PROTECTED]> wrote:

> I have a friend running AIX 1.3 on x86.  I noticed the AIX COFF binaries
> mentioned in the kernel sources for 2.4, but after #define'ing the AIX
> magic number in the header and rebuilding, still no luck.
> 
> Anybody have any idea what would be involved in getting the AIX binaries
> to execute under Linux ?
> 
> B

You probably want to have a look at something called IBCS. It lets you
run various Unix binary formats under Linux.

Slackware comes with it, although I've never used it.

PS. AIX for x86, is that free by any chance?

-- 
Cameron Kerr -- cameron.kerr @ paradise.net.nz
Praise Slackware, our baud and saviour!
--

------------------------------

From: Tim Roberts <[EMAIL PROTECTED]>
Subject: Re: kernel timer: microsecond ??
Date: Mon, 14 May 2001 22:57:54 -0700

NortonNg <[EMAIL PROTECTED]> wrote:
>
>   i would like to set a timer in kernel space for doing something.
>however, i wonder if i can set a 50us(microsecond) timer, after it expired,
>i would like to do something.
>...
>///////////
> jiffies is 10ms, i suppose. How can i set a timer with 50us??

You can't.  Timer interrupts just don't come in that fast.  If you
absolutely need to delay 50us, you need to spin in a calibrated loop.
--
- Tim Roberts, [EMAIL PROTECTED]
  Providenza & Boekelheide, Inc.

------------------------------

Date: Tue, 15 May 2001 11:53:50 +0400
From: Vyacheslav Burdjanadze <[EMAIL PROTECTED]>
Subject: Re: Recompile Kernel fails

> Just tried to recompile my 2.4.2 kernel to modify processor type to AMD.
> 
> After running make xconfig, make dep, make clean, the command make boot
> fails at the with the following error:
> System is too big. Try using bzImage or modules.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

make bzImage

------------------------------

From: "Charles Williams \(CEO\)" <[EMAIL PROTECTED]>
Subject: Help with customized install cd
Date: Tue, 15 May 2001 10:13:44 +0200

Hello,

I have a Cobalt appliance (hehe).  anyway, I also have the 4i restore CD for
said raq and am in need of booting direct from the cd for a restore..

The problem is that the raq is designed to ONLY restore across a net
connection.  Stupid if you ask me.

The raq we got was used and the warrenty was already void so we had no
problems installing a cdrom to the unit.  Looks a bit funny though. :)

Anyway, I could provide a complete copy of the restore cd ISO for download
to anyone interested in helping with this.  I need to be able to restore
DIRECT from the CD not across the net with netboot.

Any help welcome.

Thanks
chuck




------------------------------

From: "allan" <[EMAIL PROTECTED]>
Subject: Idle state code?
Date: Tue, 15 May 2001 16:38:36 +0800

How can i find the process in the state of Idle.
I just find the process state marked 'S'(sleep),but i want to find processes
in the sleep state for the reason of Idle(not waiting for some resource).
Thanks



------------------------------

From: "Winston Smith" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.development
Subject: looking for a sed tip
Date: Tue, 15 May 2001 10:41:45 -0400

Hi,

I'm trying to make a shell script that use sed to replace in a text
stream some characters with the ' char but if I use
sed -e 's/x/'/g' I get an error because the first ' end the expression.
So I'm looking for a special notation like \' or something.

Thank you in advance.

------------------------------

From: NortonNg <[EMAIL PROTECTED]>
Subject: Re: kernel timer: microsecond ??
Date: Tue, 15 May 2001 09:00:54 +0000 (UTC)

Tim Roberts <[EMAIL PROTECTED]> wrote:
> NortonNg <[EMAIL PROTECTED]> wrote:
> >   i would like to set a timer in kernel space for doing something.
> >however, i wonder if i can set a 50us(microsecond) timer, after it expired,
> >i would like to do something.
> >...
> >///////////
> > jiffies is 10ms, i suppose. How can i set a timer with 50us??
> You can't.  Timer interrupts just don't come in that fast.  If you
> absolutely need to delay 50us, you need to spin in a calibrated loop.

  I wonder how fast qdisc_restart() can be invoked ?
I need to queue packet for some microsecond and then send them out.
any suggestions?

Regards,
jkng.

------------------------------

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Idle state code?
Date: Tue, 15 May 2001 09:25:46 +0000

allan wrote:
> 
> How can i find the process in the state of Idle.
> I just find the process state marked 'S'(sleep),but i want to find processes
> in the sleep state for the reason of Idle(not waiting for some resource).
> Thanks

You can look on the wchan field. (which can be shown
by top or ps) It will tell you which kernel function
the process is currently sleeping in.

-- 
Kasper Dupont

------------------------------

From: Kasper Dupont <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.development
Subject: Re: looking for a sed tip
Date: Tue, 15 May 2001 09:27:53 +0000

Winston Smith wrote:
> 
> Hi,
> 
> I'm trying to make a shell script that use sed to replace in a text
> stream some characters with the ' char but if I use
> sed -e 's/x/'/g' I get an error because the first ' end the expression.
> So I'm looking for a special notation like \' or something.
> 
> Thank you in advance.

sed -e "s/x/\'/g"

-- 
Kasper Dupont

------------------------------

From: Andrzej Stypula <[EMAIL PROTECTED]>
Subject: Generic SCSI driver
Date: Tue, 15 May 2001 11:45:11 +0200

Hi,
Could everyone explain me why scsi generic device is character device 
if normal scsi device is block? 
In my opinion this is a little incompatibility...
Due to this strange type of generic scsi devices I can not to mount
any file system if I want to use ide/atapi-scsi driver.
I do not find how I can to bind/remove a generic scsi driver under 
running kernel (without adding the 'append' line in lilo.conf).

Thanks,
-- 
Andrzej Stypula                                  @Home: altair.krakow.pl
[EMAIL PROTECTED]                     Private Home Domain, Poland
PGP2.x id: 9AB243A5 ####################################################

------------------------------

From: Wolfram Gloger <[EMAIL PROTECTED]>
Subject: Re: malloc returns NULL!
Date: 15 May 2001 12:27:06 +0200

"Karl Heyes" <[EMAIL PROTECTED]> writes:

> Allocating 10 bytes a time using the standard malloc is very wasteful,
> typically (If I remember my data structures classes) about 6 pointers 
> get used for each allocation, ie 24 bytes, as well the actual space requested
> and any alignment.

In glibc-2, space for two pointers is used in every allocation, plus
the size field and alignment: the minimum chunk size is `only' 16
bytes.

malloc()ing 10 bytes therefore `wastes' 6 bytes.

Regards,
Wolfram.

------------------------------

From: Nix <$}xinix{[email protected]>
Subject: Re: Guid generator for unix.
Date: 14 May 2001 23:46:25 +0100

On 14 May 2001, Nick Andrew gibbered:
> Steve Connet <[EMAIL PROTECTED]> writes:
>>The way Microsoft creates GUIDs (if the box has a NIC), is it obtains
>>the MAC address and the current system time and munges those into a
>>128-bit universally unique identifier. It is gauranteed to not be
>>duplicated anywhere in the universe, forever and ever.

Not *quite*.

> Until Mr "Random Number GUID generator" starts pumping out totally random
> GUIDs, that is!

Discounting the fact that they're *supposed* to be random, let's do the
maths.


Assume that you've got a computing element capable of turning out a
billion GUIDs a second. Further, let's turn the Earth into such
computing elements, each weighing a gram.

The Earth weighs about 6x10^24kg, so that's about 6x10^36 GUIDs per
second.

In *that* case, you'd get a lot of collisions; you'd have pretty much
filled the space in a few thousand seconds (unless I fscked up the
maths, which I may well have done).


But this just says that MS didn't think ahead; they should have made
GUIDs 256-bit; in a few million years, or sooner if Vinge is right or we
end up with control of the amount of computing power the Amarantin
Banished had in the _Revelation Space_ universe, we'll need to redesign
the system to use 256 bits instead.


Such short-sightedness. Typical of Microsoft. Pfui. To design a unique
ID system that anyone with a paltry planet composed of computing
elements can crack so easily... I'm *ashamed* of them, that's what.

-- 
`LARTing lusers is supposed to be satisfying. This is just tedious. The
 silly shite I'm doing now is like trying to toothpick to death a Black
 Knight made of jelly.' --- RDD

------------------------------

From: Nix <$}xinix{[email protected]>
Subject: Re: malloc returns NULL!
Date: 15 May 2001 00:10:14 +0100

On 10 May 2001, [EMAIL PROTECTED] gibbered:
>       We have an application that makes repeated calls to malloc(), each
> time requesting small amount of memory (around 10 bytes or less). By
> "repeated
> calls", I mean over 70 million calls...

Ouch.

>       Ok, so the problem is this: eventually, malloc will return NULL even
> though there is free memory available (the machine has 2 GB of RAM).

This, as others have said, could be memory fragmentation --- but I don't
think it is necessarily that. I think you'd have problems anyway.

glibc's malloc/malloc.c says:

,----
| Minimum allocated size: 4-byte ptrs:  16 bytes    (including 4 overhead)
|                         8-byte ptrs:  24/32 bytes (including, 4/8 overhead)
|
|      When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte
|      ptrs but 4 byte size) or 24 (for 8/8) additional bytes are
|      needed; 4 (8) for a trailing size field
|      and 8 (16) bytes for free list pointers. Thus, the minimum
|      allocatable size is 16/24/32 bytes.
|
|      Even a request for zero bytes (i.e., malloc(0)) returns a
|      pointer to something of the minimum allocatable size.
[snip]
| Maximum overhead wastage per allocated chunk: normally 15 bytes
|
|      Alignment demands, plus the minimum allocatable size restriction
|      make the normal worst-case wastage 15 bytes (i.e., up to 15
|      more bytes will be allocated than were requested in malloc), with
|      two exceptions:
|        1. Because requests for zero bytes allocate non-zero space,
|           the worst case wastage for a request of zero bytes is 24 bytes.
|        2. For requests >= mmap_threshold that are serviced via
|           mmap(), the worst case wastage is 8 bytes plus the remainder
|           from a system page (the minimal mmap unit); typically 4096 bytes.
`----

So you're losing in overhead on the average (assuming IA32, with 4-byte
pointers) about 8 bytes per allocation --- or as much as you're
allocating in the first place.

Note that for really small blocks, freeing them doesn't save you
anything until freed blocks are merged, either. And it'll probably get
rather sluggish with a heap with tens of millions of items to manage.

glibc malloc() is a very good general-purpose allocator, but this task
really requires a special-purpose one. No general-purpose allocator can
be efficient with big blocks and microscopic ones; glibc's malloc is
fairly efficient at the low end, but not efficient enough for this.

-- 
`LARTing lusers is supposed to be satisfying. This is just tedious. The
 silly shite I'm doing now is like trying to toothpick to death a Black
 Knight made of jelly.' --- RDD

------------------------------

From: "Karl Heyes" <[EMAIL PROTECTED]>
Subject: Re: malloc returns NULL!
Date: Tue, 15 May 2001 12:43:53 +0100

In article <[EMAIL PROTECTED]>, "Wolfram Gloger"
<[EMAIL PROTECTED]> wrote:


> "Karl Heyes" <[EMAIL PROTECTED]> writes:
>> Allocating 10 bytes a time using the standard malloc is very wasteful,
>> typically (If I remember my data structures classes) about 6 pointers get
>> used for each allocation, ie 24 bytes, as well the actual space requested
>> and any alignment.
> In glibc-2, space for two pointers is used in every allocation, plus the
> size field and alignment: the minimum chunk size is `only' 16 bytes.
> malloc()ing 10 bytes therefore `wastes' 6 bytes.  Regards,
> Wolfram.

I don't know what the implementation of glibc malloc is like but if two 
pointers are used and 10 bytes requested then that a minimum of 18 bytes
for each allocation (not counting alignment, size field and chunk usage).

Surely you must see at least a 1:2 ratio  in this case. 

karl.

------------------------------

From: "Olav Drageset" <[EMAIL PROTECTED]>
Subject: Driver-writers wanted for breaking new ground!!!
Date: Tue, 15 May 2001 14:49:38 +0200

We want to connect a (graphic) display to USB.
We must write a driver for X-server and one for USB.

Do you want to join the party?

Send a mail and say what you can do.

--
Olav Drageset
Thales Communications A/S Oslo
[EMAIL PROTECTED]
tel  +47 9900 2690



------------------------------

From: [EMAIL PROTECTED]
Subject: Re: ttyp? & ptyp? can't work under read-only fs ??
Date: 15 May 2001 13:17:08 GMT

On 15 May 2001 01:29:32 GMT Kevin Liu <[EMAIL PROTECTED]> wrote:
| I build a small system in cramfs filesystem, I have a problems
| that in.telnetd can't work, the reason is /dev is read-only, but
| tty[0-?] and ttyS[0-1] could work under read-only filesystem,
| what should I do?
| I'll keep the read-only filesystem and in.telnetd be work, too.

Is your / also read-only?  If so, then maybe you need to rebuild
the /dev directory in a ramdisk (or ramfs if 2.4) and mount that.

-- 
=================================================================
| Phil Howard - KA9WGN |   Dallas   | http://linuxhomepage.com/ |
| [EMAIL PROTECTED] | Texas, USA | http://phil.ipal.org/     |
=================================================================

------------------------------

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Generic SCSI driver
Date: Tue, 15 May 2001 14:15:10 +0000

Andrzej Stypula wrote:
> 
> Hi,
> Could everyone explain me why scsi generic device is character device
> if normal scsi device is block?
> In my opinion this is a little incompatibility...
> Due to this strange type of generic scsi devices I can not to mount
> any file system if I want to use ide/atapi-scsi driver.
> I do not find how I can to bind/remove a generic scsi driver under
> running kernel (without adding the 'append' line in lilo.conf).
> 

The generic scsi devices is used to send commands
directly to the devices. This interface can be used
to control all different types of scsi devices not
just block devices.

If you need to mount a block device you should not
use the generic driver but the driver specialized
to the type of block device being used. If it is a
CD drive the name is typically /dev/scd0. If it is
a harddisk I think the name is /dev/sda.

-- 
Kasper Dupont

------------------------------

From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Guid generator for unix.
Date: Tue, 15 May 2001 14:35:37 +0000

Nick Andrew wrote:
> 
> Steve Connet <[EMAIL PROTECTED]> writes:
> 
> >[EMAIL PROTECTED] (Nick Andrew) writes:
> 
> >>  ... merely reduces the chance of collision, and does not eliminate it.
> >> I thought GUIDs were supposed to be nominally globally unique, not just
> >> show low chance of collision.
> >>
> >> I'd suggest adding to the 8 random bytes, the FQDN of the local host
> >> and return values from time() and getpid().
> 
> >The way Microsoft creates GUIDs (if the box has a NIC), is it obtains
> >the MAC address and the current system time and munges those into a
> >128-bit universally unique identifier. It is gauranteed to not be
> >duplicated anywhere in the universe, forever and ever.
> 
> Until Mr "Random Number GUID generator" starts pumping out totally random
> GUIDs, that is!
> 
> Nick.
> --
> Do not send me email copies of postings. Keep it in USENET please.

If there is a total of N files in the world
you would need to pick randomly from N*N
values to have a chance of avoiding colisions.

Assume there is 2^32 computers each holding
2^32 files, then you would need 2^128
posible values which is what you get with
128 bits.

Anyway I think it would be better to play
it more safe and add extra bits because the
number of files could be bigger and we want
more than a good chance of avoiding colisons.

So say 2^128 computers each holding 2^64
files and chance of collison at most 2^-128
that would require 512 bits. In that case
using random values can be expected not to
give colisions.

-- 
Kasper Dupont

------------------------------

From: Zhiyong Xu <[EMAIL PROTECTED]>
Subject: shutdown kernel code
Date: Tue, 15 May 2001 10:33:49 -0400

Hi,
         I want to know where's the code related to shutdown process in
kernel, when you submit command shutdown or reboot. Could you please
tell the source file name?

      Thanks in advance.



------------------------------

From: [EMAIL PROTECTED] (Nick Andrew)
Subject: Re: Guid generator for unix.
Date: 16 May 2001 00:58:28 +1000

Nix <$}xinix{[email protected]> writes:

>> Until Mr "Random Number GUID generator" starts pumping out totally random
>> GUIDs, that is!

>Discounting the fact that they're *supposed* to be random, let's do the
>maths.

You missed the point. They're supposed to be random, but not totally
random - one part should be predictable, and unique amongst all the
computers in the world. Hence the MAC address ...

Nick.
-- 
Do not send me email copies of postings. Keep it in USENET please.

------------------------------

From: [EMAIL PROTECTED] (Joern Engel)
Crossposted-To: comp.os.linux.development.apps
Subject: Re: Time to read the Disk
Date: 15 May 2001 14:59:31 GMT
Reply-To: [EMAIL PROTECTED]

Hi!

> The average seek time is around 4 - 5 ms.
> The average rotational latency is 3ms.
> 
> Besides,  those 20 block requests are seeking to different locations. For each
> request, It will seek to a random position and read the disk at a size of
> blocksize. The total time taken  for 20 requests
> for 64KB - 175ms
> for 128KB - 330ms

20 random events are not a good basis. But let's ignore this.

Each block request consumes time for the seek and for the actual read
operation. With the numbers above, the read for 20x64kB costs 155ms while 20
seek operations cost 20ms or 1ms each.

Even if the kernel does not do the trick, most drives will reorder requests
in order to decrease average seek times. The 4-5ms given are average seek
time _for one seek_, whereas several successive seeks will be reordered
resulting in lower average seek times.
1ms instead of 4-5 looks like a real boost. :)

> I feel strange because much of the time should be spent on seeking and rotational
> latency.  Therefore, the difference in blocksize should be account for such large
> difference.

That should be your result if you wait for each requests completion before
issuing the next. But to ensure that, better write in assembler or make
sure, your compiler does absolutely no optimization.

Joern

PS: All the above is taken from common sense. It might be vastly wrong, as I
don't (yet?) know the exact internals.

------------------------------


** 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 by posting to the
comp.os.linux.development.system newsgroup.

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
******************************

Reply via email to