Похожие чаты

Here is my story about that. I am not sure about

the heap, but correct me if there is something wrong.

My question was:
Why the multithreaded process does not StackOverflow?

In this story, I am talking about pthread.
Facts:
1. When a process spawns a thread, its thread shares the same virtual memory address with the main process.
2. Every single thread has its stack.

These facts imply that a single process will have a stack size more than R_LIMIT_STACK.

> Because every single thread has its stack with the same size as the main process
> and the memory owned by the thread is also owned by the main process.

So what happens here?
> mmap is behind this strange limit stack violation.
> When the process spawns a thread with ptread_create, it also maps heap and plugs it to RSP register that is held by the thread.
> So it will not make your program StackOverflow because of spawning thread.
> Stack in the thread is actually heap that is mapped with MAP_STACK.

2 ответов

6 просмотров
Ammar-Faizi Автор вопроса

I could figure it out by using strace.

Ammar-Faizi Автор вопроса

I did, this is my conclusion in the case above, I could not find the article about that. So I would welcome for any correction.

Похожие вопросы

Обсуждают сегодня

Есть какой-нибудь для Delphi/FPC T*Compression(Decompression)Stream на базе LZ4/Zstd/любой другой быстрый(и хорошо сжимающий) алгоритм А ещё лучше в pure pascal А ещё лучше од...
notme
32
А чем вам питонисты не угодили?😂
.
79
Hey guys, did you see the new announcement about $Fun? 🔥
Filip Murphy
55
Язык Си можно выучить за день? По книжке ANSI C на 230 страниц
Vincent Vegan
29
Привет, запускаю werf в dind в k8s, получаю ошибку на этапе build/beforeSetup: /.werf/stapel/embedded/bin/bash: /.werf/scripts/5898bdfe5214357d3706b879cc8d3d78460fb379607cbd...
florius0
7
Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
75
пацаны, как-нибудь можно панель задач заблюрить, что она была похожа на kde или винду 7, 11?
В
16
or do they all have 240?
Ilnur Zaripov
9
HI. Just reviewd Planck website which looks undercooked and some menu is not leading to correct section of site. Also, the vesting is shown to be for 20 months starting next y...
Neo517
4
Дорогие любители Прекрасной Джулии! Есть кто-то имеющий практический опыт построения ML для Систем Управления? Нам нужно сделать нейросеть для автоматической подстройки пара...
Roman Timo
4
Карта сайта