Manually save & restore thread context with QNX!

Hello!

Is there a way under QNX to manually save and restore a thread context like
with Win32 “Fibers”.
In fact, I am implementing an other RT OS kernel on top of Neutrino and I
need to schedule the threads my own way.

Thanks!

Vincent

Previously, Vincent wrote in comp.os.qnx:

Is there a way under QNX to manually save and restore a thread context like
with Win32 “Fibers”.
In fact, I am implementing an other RT OS kernel on top of Neutrino and I
need to schedule the threads my own way.

What about setjmp() and longjmp()?


Mitchell Schoenbrun --------- maschoen@pobox.com

setjmp() & longjmp() functions don’t meet my needs because I would like to
save & restore the context of an other thread than the calling one.

Vincent

Previously, Vincent wrote in comp.os.qnx:

setjmp() & longjmp() functions don’t meet my needs because I would like to
save & restore the context of an other thread than the calling one.

Well if you examine this requirement carefully I think you will find
that there are only three routes to this, none of which are very good.

  1. If your OS provides a facility for one process to control the
    context of another. I’ve never worked with an OS that provided this
    type of control, and I don’t think RTP provides it.

  2. Hack this control away from the OS. This would involve poking
    your way into system areas and making modifications. Aside from the
    unlikely possibility you would be able to figure out the system areas
    and how to manipulate them, the OS should thrwart you from doing this
    as part of normal process security.

  3. Write your own OS, or maybe hack something that is open source like
    Linux.


    Mitchell Schoenbrun --------- maschoen@pobox.com

Mitchell Schoenbrun <maschoen@pobox.com> wrote:

Previously, Vincent wrote in comp.os.qnx:

setjmp() & longjmp() functions don’t meet my needs because I would like to
save & restore the context of an other thread than the calling one.

Um, thinking of how gdb/pdebug could gather these informations,
he probably could play the same trick. Might want to
asking in devtool group to get the detail (some messages to proc) ?

-xtang

Well if you examine this requirement carefully I think you will find
that there are only three routes to this, none of which are very good.

  1. If your OS provides a facility for one process to control the
    context of another. I’ve never worked with an OS that provided this
    type of control, and I don’t think RTP provides it.

  2. Hack this control away from the OS. This would involve poking
    your way into system areas and making modifications. Aside from the
    unlikely possibility you would be able to figure out the system areas
    and how to manipulate them, the OS should thrwart you from doing this
    as part of normal process security.

  3. Write your own OS, or maybe hack something that is open source like
    Linux.

Mitchell Schoenbrun --------- maschoen@pobox.com

Previously, Mitchell Schoenbrun wrote in comp.os.qnx:
[…]

  1. If your OS provides a facility for one process to control the
    context of another. I’ve never worked with an OS that provided this
    type of control, and I don’t think RTP provides it.
    […]

‘man ptrace’. The linux man page says “conforming to: svr4, svid ext, at&t, x/open, bsd 4.3”. If you’ve never worked in an OS with ptrace, I gotta wonder what planet you’re hiding on. :wink:

I too am in need of the functionality of messing with another thread’s context, so I’d be very interested to know how this can be done in RTP.


Cheers - Tony ‘Nicoya’ Mantler :slight_smile:


Tony Mantler | Proud ---- Days since the last
QNX Consulting | of our | 27 |
tony@astra.mb.ca | Record ---- “Gerbil Incident”

Previously, Tony Mantler wrote in comp.os.qnx:

‘man ptrace’. The linux man page says “conforming to:
svr4, svid ext, at&t, x/open, bsd 4.3”. If you’ve never
worked in an OS with ptrace, I gotta wonder what planet
you’re hiding on. > :wink:

Well thanks for the nice hostile howdy do. ptrace() allows
you to stop and start a child process if it consents. I
suspect that you can do this with RTP. I figured the thread
author was looking for more.




Mitchell Schoenbrun --------- maschoen@pobox.com

Previously, Mitchell Schoenbrun wrote in comp.os.qnx:

Previously, Tony Mantler wrote in comp.os.qnx:

‘man ptrace’. The linux man page says “conforming to:
svr4, svid ext, at&t, x/open, bsd 4.3”. If you’ve never
worked in an OS with ptrace, I gotta wonder what planet
you’re hiding on. > :wink:

Well thanks for the nice hostile howdy do.

My appologies if I came across that way.


ptrace() allows
you to stop and start a child process if it consents. I
suspect that you can do this with RTP. I figured the thread
author was looking for more.

ptrace() doesn’t just start and stop. It can also read and write from the data and text areas of a process, read and write from the process’ registers, etc.

ptrace() has pretty much all the functionality you’d need to completely checkpoint and ressurect a process, or do manual context switching, or whatever.


Cheers - Tony ‘Nicoya’ Mantler :slight_smile:


Tony Mantler | Proud ---- Days since the last
QNX Consulting | of our | 27 |
tony@astra.mb.ca | Record ---- “Gerbil Incident”