Redian新闻
>
does the system guarantee this? (转载)
avatar
does the system guarantee this? (转载)# Programming - 葵花宝典
c*e
1
【 以下文字转载自 Linux 讨论区 】
发信人: crystalike (New Start), 信区: Linux
标 题: does the system guarantee this?
发信站: BBS 未名空间站 (Wed Oct 24 20:50:25 2007)
in c++ using std::endl or iostream.flush will flush the buffer in the user
space. does this also flush the kernel buffer?
we know that when exit () is called, buffers will be flushed but what about
the case when the process crashes upon a seg fault or memory shortage?
basically in my case I need to guarantee that when my programs dies for whatever reason, w
avatar
t*t
2
kernel buffer shall be transparent to user. i think you can not "flush" a
descriptor, no?

about
whatever reason, we must perserve as much log as possible. also I dont want
to call flush or use endl much to avoid performance impact in logging.

【在 c********e 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: crystalike (New Start), 信区: Linux
: 标 题: does the system guarantee this?
: 发信站: BBS 未名空间站 (Wed Oct 24 20:50:25 2007)
: in c++ using std::endl or iostream.flush will flush the buffer in the user
: space. does this also flush the kernel buffer?
: we know that when exit () is called, buffers will be flushed but what about
: the case when the process crashes upon a seg fault or memory shortage?
: basically in my case I need to guarantee that when my programs dies for whatever reason, w

avatar
P*f
3
I think no way to guarantee that unless you write your know kernel patch.
In userspace you cannot get chance to handle SIGKILL or SIGSTOP signal for
example.

【 以下文字转载自 Linux 讨论区 】
发信人: crystalike (New Start), 信区: Linux
标 题: does the system guarantee this?
发信站: BBS 未名空间站 (Wed Oct 24 20:50:25 2007)
in c++ using std::endl or iostream.flush will flush the buffer in the user
space. does this also flush the kernel buffer?
we know that when exit () is called, buffers will be flushed but what about
th

【在 c********e 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: crystalike (New Start), 信区: Linux
: 标 题: does the system guarantee this?
: 发信站: BBS 未名空间站 (Wed Oct 24 20:50:25 2007)
: in c++ using std::endl or iostream.flush will flush the buffer in the user
: space. does this also flush the kernel buffer?
: we know that when exit () is called, buffers will be flushed but what about
: the case when the process crashes upon a seg fault or memory shortage?
: basically in my case I need to guarantee that when my programs dies for whatever reason, w

avatar
m*t
4
if u refering to the message dmesg prints, sync will flush those thing to
disk. but segfault is hopeless, would core file contain what you need?

about
whatever reason, we must perserve as much log as possible. also I dont want
to call flush or use endl much to avoid performance impact in logging.

【在 c********e 的大作中提到】
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: crystalike (New Start), 信区: Linux
: 标 题: does the system guarantee this?
: 发信站: BBS 未名空间站 (Wed Oct 24 20:50:25 2007)
: in c++ using std::endl or iostream.flush will flush the buffer in the user
: space. does this also flush the kernel buffer?
: we know that when exit () is called, buffers will be flushed but what about
: the case when the process crashes upon a seg fault or memory shortage?
: basically in my case I need to guarantee that when my programs dies for whatever reason, w

avatar
t*t
5
what i meant is, whatever you do to the user space process, if the data is
already in kernel (e.g. in the file descriptor buffer), it will be sent out
no matter what happens, be it SIGKILL or SIGSEGV. all opened files will be
closed automatically.

about

【在 P*****f 的大作中提到】
: I think no way to guarantee that unless you write your know kernel patch.
: In userspace you cannot get chance to handle SIGKILL or SIGSTOP signal for
: example.
:
: 【 以下文字转载自 Linux 讨论区 】
: 发信人: crystalike (New Start), 信区: Linux
: 标 题: does the system guarantee this?
: 发信站: BBS 未名空间站 (Wed Oct 24 20:50:25 2007)
: in c++ using std::endl or iostream.flush will flush the buffer in the user
: space. does this also flush the kernel buffer?

avatar
P*f
6
any reference for this behavior? especially in case of SIGKILL

what i meant is, whatever you do to the user space process, if the data is
already in kernel (e.g. in the file descriptor buffer), it will be sent out
no matter what happens, be it SIGKILL or SIGSEGV. all opened files will be
closed automatically.
about

【在 t****t 的大作中提到】
: what i meant is, whatever you do to the user space process, if the data is
: already in kernel (e.g. in the file descriptor buffer), it will be sent out
: no matter what happens, be it SIGKILL or SIGSEGV. all opened files will be
: closed automatically.
:
: about

avatar
t*t
7
that's my wild guess, yes, hehe

out

【在 P*****f 的大作中提到】
: any reference for this behavior? especially in case of SIGKILL
:
: what i meant is, whatever you do to the user space process, if the data is
: already in kernel (e.g. in the file descriptor buffer), it will be sent out
: no matter what happens, be it SIGKILL or SIGSEGV. all opened files will be
: closed automatically.
: about

avatar
c*x
8
When developers write a OS kernel, the kernel crash, how do they preserve
the err msg? That is the way you want.
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。