ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Ilya Kuznecov <kuznecov@blok-caf.ru>
To: community@altlinux.ru
Subject: [Comm] при большой нагрузке форки не делаются
Date: Wed, 3 Sep 2003 10:49:44 +0500
Message-ID: <200309031049.45222.kuznecov@blok-caf.ru> (raw)


При большом количестве открытых файлов и запущенных процессов простейший 
скрипт (запускаемый из Makefile) начинает выдавать ошибку:

./sizer: fork: Resource temporarily unavailable
Но стоит позакрывать программы и всё нормально.
ФС -- EXT3.

% find -type d |wc -l
    172
% find -type f |wc -l
   2769

Но скрипт вызывается в гораздо более щадящих условиях (1-2 директории с ~10 
файлами), но много раз (142 раза, точнее) -- по числу директорий верхнего 
уровня.

Идея скрипта -- создать xml-файл вида:
<?xml version="1.0" encoding="utf-8"?><main>
<file name='abc' size='100K'/>
...
<file name='def' size='1M'/>
</main>


#!/bin/sh
rec() {
for i in $1/* ; do
        if [ -d $i ]; then rec $i
        else
                A=`LANG=C du --max-depth 10 -h $i|awk '{print $1}'`
                B=`echo $i | sed 's/\.\///'`
                echo "<file name='$B' size='$A'/>"
        fi
done
}
echo '<?xml version="1.0" encoding="utf-8"?><main>'
cd $1
rec '.'
echo '</main>'

% ulimit 
unlimited

Система -- АЛМ22 с апдейтами.
-- 
chumpa, Cybernetic Humanoid Used for Mathematics and Potential Assassination
kuznecov@blok-caf.ru       http://chumpa.izhnet.ru     icq 122393064




             reply	other threads:[~2003-09-03  5:49 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-03  5:49 Ilya Kuznecov [this message]
2003-09-03  6:46 ` [Comm] " Michael Shigorin
2003-09-03  7:58 ` [Comm] " ipAlex
2003-09-03  8:02   ` Ilya Kuznecov
2003-09-03  9:44   ` [Comm] " Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200309031049.45222.kuznecov@blok-caf.ru \
    --to=kuznecov@blok-caf.ru \
    --cc=community@altlinux.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git