English 中文(简体)
深层
原标题:Maximum number of threads

我有一个方案,接受2个<代码>N-数,使用校对和复制进行多倍;印刷产出。

The number of threads produced here are 2 * N - 1.

每当我管理<代码>N >151的方案时,该方案就给我造成分部分错。

是否有从翻新池中获取最大校对数量的上限?

如果是的话,这是否是造成过失的有效理由?

<><>Edit>:

Valgrind没有发现N <=150的记忆泄露。

I m 运行在LC 2.6.x kernel。

最佳回答

每座路面都有8千米。 8MB的300座路面只有2.4GB, 仅用于read子——如果你以32个轨道方式重新运行,那么你允许的加工过程很可能大部分涉及空间。

您可使用<代码>pthread_attr_setstacksize(),在你创建之前,将你的深层sta缩小到比你更便宜的地步:

int pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize)

(新的<代码>pthread_attr, 定下打字的尺寸,然后通过<代码>pthread_create。)

问题回答

POSIX保证了64条read。 这不仅仅是执行过程中的礼物。

这将超过300条。 考虑从加工商经常开关和优先开关,以及从其他应用中穿透。 我认为,利用像这样的线索,是一场等待发生的灾难,也许会赢得帮助。

我怀疑,他们将成为最大数量的read子,因为正是万国邮联管理他们的工作。 我不想再用100条read子,这是一个非常坏的想法。

If under Linux: Check PTHREAD_THREADS_MAX in limits.h . That is the max. allowed thread count per process. And also: this should not be a cause for a seg-fault.

贵问题没有具体说明能够回答你的第一个问题所必需的运作环境,但如果您的CPU约束和校对数量超过加工芯(2或4个,大多数笔记本),你可能浪费资源。

关于第二个问题,没有,它不是造成分裂性错的有效理由。 假设你之所以制造这种可怕的read子,是出于某种良好原因,我们不了解、重复使用你的幻觉和你的资源分配结果。

我的乌兰巴托盒显示123858的限额,因此,我怀疑你用300份重新进入该盒,但是如果你愿意,你就将返回非零。 确保检查收益价值。

Compile with -g andpr with gdb to debug Segationfalls und guess in the causes. 它将把你指到底线,告诉你造成坠毁的确切变值。

我还建议,如失踪的mut夫等可能的同步问题,但如果是造成这种情况的原因,你很可能看到N值较小的问题,尽管情况并不常见。





相关问题
Fastest method for running a binary search on a file in C?

For example, let s say I want to find a particular word or number in a file. The contents are in sorted order (obviously). Since I want to run a binary search on the file, it seems like a real waste ...

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

Tips for debugging a made-for-linux application on windows?

I m trying to find the source of a bug I have found in an open-source application. I have managed to get a build up and running on my Windows machine, but I m having trouble finding the spot in the ...

Trying to split by two delimiters and it doesn t work - C

I wrote below code to readin line by line from stdin ex. city=Boston;city=New York;city=Chicago and then split each line by ; delimiter and print each record. Then in yet another loop I try to ...

Good, free, easy-to-use C graphics libraries? [closed]

I was wondering if there were any good free graphics libraries for C that are easy to use? It s for plotting 2d and 3d graphs and then saving to a file. It s on a Linux system and there s no gnuplot ...

Encoding, decoding an integer to a char array

Please note that this is not homework and i did search before starting this new thread. I got Store an int in a char array? I was looking for an answer but didn t get any satisfactory answer in the ...

热门标签