【问题标题】:context system call in trusstruss 中的上下文系统调用
【发布时间】:2012-10-17 14:02:24
【问题描述】:

在 Solaris 10 中采用进程的 truss 时, 我找到了下面的语句

<pid>/2:    70.7602 context(1, 0xFC47ABF8)

请解释一下这个系统调用context是什么意思 同样在此调用之后,我看到线程 2 的行为类似于另一个线程 4。

【问题讨论】:

    标签: multithreading solaris truss


    【解决方案1】:
    <ucontext.h>
    int getcontext(ucontext_t *ucp);
    int setcontext(const ucontext_t *ucp);`
    

    这两个调用在 Solaris 中保存和恢复上下文。 我不确定,因为在 McDougal 和 Mauro 的“Solaris Internals”中没有明确提到 context()。 我假设context() 是对应这些 api 入口点的实际内核调用。 也许context(1, &lt;addr&gt; )对应getcontext(),我不知道。

    上下文切换是操作系统允许给定进程在给定时间片(时间片)内使用系统资源的方式。日程安排的一部分。

    【讨论】:

      猜你喜欢
      • 2020-11-01
      • 2012-02-11
      • 1970-01-01
      • 2014-12-25
      • 2013-04-30
      • 1970-01-01
      • 2014-11-21
      • 2021-11-18
      • 2013-05-31
      相关资源
      最近更新 更多