Re: atomic section in code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hendrik van Rooyen

    Re: atomic section in code

    Fredrik Lundh <fredr...ware.c omwrote:
    >sounds like he wants/needs non-cooperative, mandatory locking.
    Could one get there using ctypes to disable interrupts?

    Cross Platform?

    I can think of lots of hassles, starting with permissions
    to use the privileged instructions.

    - Hendrik



  • Tim Roberts

    #2
    Re: atomic section in code

    "Hendrik van Rooyen" <mail@microcorp .co.zawrote:
    >
    >Fredrik Lundh <fredr...ware.c omwrote:
    >
    >>sounds like he wants/needs non-cooperative, mandatory locking.
    More accurately, he THINKS he wants/needs mandatory locking. We need to
    find out what he's really trying to accomplish before we can suggest
    something that is actually achievable.
    >Could one get there using ctypes to disable interrupts?
    No. That can't be done in user mode in any operating system where Python
    runs. Even in kernel mode, it's not reliable, because disabling interrupts
    only affects one core.
    --
    Tim Roberts, timr@probo.com
    Providenza & Boekelheide, Inc.

    Comment

    • Diez B. Roggisch

      #3
      Re: atomic section in code

      Hendrik van Rooyen schrieb:
      Fredrik Lundh <fredr...ware.c omwrote:
      >
      >sounds like he wants/needs non-cooperative, mandatory locking.
      >
      Could one get there using ctypes to disable interrupts?
      Not as such, ctypes can't execute arbitrary machine code. But of course
      you can create a C-lib that does what you want (IF it can be done, that
      is..), and wrap that.
      Cross Platform?
      Certainly not.
      I can think of lots of hassles, starting with permissions
      to use the privileged instructions.

      I don't think there is a chance for this without major system tinkering.
      Under Linux, you could create a real time thread so highly prioritized
      that it won't yield any time to any other scheduler. And in a
      kernel-module, you can call cli (or whatever the needed call is). But
      this will most probably break your system.

      diez

      Comment

      Working...