2
votes

Is this possible to retrieve the details of a process control block like the values stored in the registers and status of the process,pid and so on. If yes then please tell me how to do that. Thanks in advance.

1
This information is stored in the kernel. You might look at ptrace and gdb.artless noise

1 Answers

0
votes

On Linux, you can get the current process context (registers and everything) using a handy library function getcontext():

http://man7.org/linux/man-pages/man2/getcontext.2.html

And the fun part about it: you can modify it and alter your process behavior using setcontext().

Apart from diagnostics, those can be used to implement all kinds of interesting things, like user space threads and coroutines.